:root {
  color-scheme: light dark;
  --bg: #f7f4ef;
  --bg-soft: #f1ede6;
  --text: #22211f;
  --muted: #6c6760;
  --border: #d8d1c6;
  --accent: #2f6f4e;
  --card: #fffaf3;
  --danger: #b13a2f;
  --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1e1b;
  --bg-soft: #262420;
  --text: #f0ede6;
  --muted: #a5a097;
  --border: #3a342c;
  --accent: #7dc29d;
  --card: #292620;
  --danger: #d67d75;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, p {
  margin: 0;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px;
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-menu {
  position: relative;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px var(--shadow);
  padding: 12px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.menu-toggle {
  display: inline-flex;
  gap: 8px;
}

.menu-option {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
}

.menu-option.active {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}

#app-title {
  font-size: 22px;
  font-weight: 600;
}

#app-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.auth-panel {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: min(420px, 100%);
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 20px var(--shadow);
}

.auth-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.auth-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.auth-divider {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-color: var(--accent);
}

.primary-button,
.ghost-button,
.mode-button,
.danger-button,
.google-button {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 40px;
  min-width: 40px;
}

.primary-button {
  background: var(--accent);
  color: var(--bg);
}

.google-button {
  background: #ea4335;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 999px;
  padding: 2px;
  color: #ea4335;
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.danger-button {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 50%, var(--border));
}

.tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  height: 40px;
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.board-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.board-meta h2 {
  font-size: 16px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.mode-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.mode-button {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.mode-button.active {
  background: var(--card);
  border-color: var(--border);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 160px));
  gap: 8px;
  justify-content: center;
}

@media (min-width: 720px) {
  .board-grid {
    gap: 10px;
  }
}

@media (min-width: 1024px) {
  .board-grid {
    gap: 12px;
  }
}

.cell {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 8px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.cell.empty {
  background: color-mix(in srgb, var(--card) 70%, transparent);
}

.cell-content {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.cell.completed {
  opacity: 0.7;
}

.completion-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cell:hover .cell-overlay,
.cell.is-active .cell-overlay {
  opacity: 1;
  pointer-events: auto;
}

.cell-overlay button {
  min-width: 40px;
  min-height: 40px;
}

.archive {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.archive-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
}

.archive-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.helper-text {
  font-size: 12px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}
