:root {
  --bg: #0b0d12;
  --surface: #111622;
  --surface-2: #0f172a;
  --surface-3: #161d2e;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #ec4899;
  --accent-2: #22d3ee;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

button, input, select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-2);
}

/* Auth Gate */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(236, 72, 153, 0.14), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(34, 211, 238, 0.12), transparent 45%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.auth-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.auth-title {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.auth-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

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

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: #07090d;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.12em;
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-2);
}

.auth-btn {
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #d946ef);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auth-btn:hover {
  filter: brightness(1.08);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
  font-size: 12px;
  font-weight: 600;
}

.auth-setup-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  font-size: 12px;
  line-height: 1.45;
}

.auth-setup-note code {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  word-break: break-all;
}

/* Main Header */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 13, 18, 0.97);
  border-bottom: 1px solid var(--border);
  padding: 14px 0 12px;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-block {
  min-width: 0;
  flex: 1 1 320px;
}

.game-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.game-select {
  appearance: none;
  background-color: var(--surface-2);
  background-image: linear-gradient(45deg, transparent 50%, var(--accent-2) 50%),
    linear-gradient(135deg, var(--accent-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.game-select:focus {
  outline: none;
  border-color: var(--accent-2);
}

.site-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.site-title .accent {
  color: var(--accent);
}

.site-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stat-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  text-align: right;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.stat-value.cyan {
  color: var(--accent-2);
}

.stat-value.pink {
  color: var(--accent);
}

.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: #e2e8f0;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent-2);
  color: #fff;
}

.btn-cyan {
  color: var(--accent-2);
}

.btn-danger:hover {
  border-color: rgba(251, 113, 133, 0.7);
  color: #fda4af;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--text-dim);
}

.sync-pill.synced {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
}

.sync-pill.synced .sync-dot {
  background: var(--emerald);
}

.sync-pill.saving {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
}

.sync-pill.saving .sync-dot {
  background: var(--accent-2);
}

.sync-pill.error {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.15);
  color: #fda4af;
}

.sync-pill.error .sync-dot {
  background: var(--rose);
}

/* Progress Bar */
.progress-track {
  margin-top: 12px;
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #e879f9, var(--accent-2));
  transition: width 0.25s ease;
}

/* Habits Strip */
.habits-strip {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 12px;
  color: #cbd5e1;
}

.habits-label {
  font-weight: 700;
  color: #fcd34d;
}

.habits-warning {
  font-weight: 700;
  color: var(--rose);
}

/* Section Tabs */
.section-tabs {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar {
  display: none;
}

.section-tab {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #cbd5e1;
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.section-tab:hover {
  border-color: #475569;
  color: #fff;
}

.section-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-count {
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.section-tab.active .tab-count {
  color: rgba(255, 255, 255, 0.85);
}

/* Filter & Search Bar */
.controls-section {
  padding-top: 16px;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  border-radius: 14px;
  padding: 12px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: #07090d;
  color: #cbd5e1;
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: #475569;
  color: #fff;
}

.filter-btn.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #082f49;
  font-weight: 700;
}

.search-wrap {
  flex: 1 1 220px;
  max-width: 280px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: #07090d;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-2);
}

.legend-strip {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot.emerald { background: var(--emerald); }
.dot.amber { background: var(--amber); }
.dot.rose { background: var(--rose); }

.text-emerald { color: #6ee7b7; }
.text-amber { color: #fcd34d; }
.text-rose { color: #fda4af; }

/* Main Content */
.main-content {
  padding-top: 18px;
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.72);
  overflow: hidden;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  padding: 14px 16px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.section-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.bulk-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.btn-xs {
  border: 1px solid var(--border-strong);
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-xs:hover {
  border-color: var(--emerald);
  color: #6ee7b7;
}

.btn-xs.muted {
  color: var(--text-muted);
}

.btn-xs.muted:hover {
  border-color: #64748b;
  color: #e2e8f0;
}

/* Reminders Banner */
.reminders-box {
  border-top: 1px solid rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.09);
  padding: 12px 16px;
}

.reminders-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fcd34d;
}

.reminders-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #fef3c7;
}

.reminders-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.reminder-bullet {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--amber);
  margin-top: 6px;
  flex-shrink: 0;
}

/* Checklist Rows */
.item-row {
  border-top: 1px solid rgba(30, 41, 59, 0.85);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.item-row:hover {
  background: rgba(30, 41, 59, 0.35);
}

.item-row.is-checked {
  background: rgba(6, 78, 59, 0.16);
}

.item-row.is-skip {
  background: rgba(2, 6, 23, 0.45);
  opacity: 0.85;
}

input[type="checkbox"].custom-check {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  border-radius: 6px;
  border: 1.5px solid #475569;
  background: var(--surface-2);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

input[type="checkbox"].custom-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"].custom-check:checked::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.skip-icon {
  margin-top: 2px;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.item-row.is-checked .item-title {
  color: var(--text-muted);
  text-decoration: line-through;
}

.item-row.is-skip .item-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(251, 113, 133, 0.65);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.badge-do-now {
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

.badge-save-later {
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.14);
  color: #fcd34d;
}

.badge-skip {
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.14);
  color: #fda4af;
}

.kind-chip {
  border-radius: 5px;
  background: #1e293b;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.1);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #67e8f9;
  text-decoration: none;
}

.guide-link:hover {
  border-color: var(--accent-2);
  background: rgba(34, 211, 238, 0.2);
}

.note-btn {
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.note-btn:hover {
  border-color: #64748b;
  color: #fff;
}

.note-btn.has-note {
  border-color: rgba(236, 72, 153, 0.45);
  background: rgba(236, 72, 153, 0.15);
  color: #f9a8d4;
}

.item-note {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.saved-note-box {
  margin: 7px 0 0;
  border-radius: 7px;
  border: 1px solid rgba(236, 72, 153, 0.25);
  background: rgba(236, 72, 153, 0.07);
  padding: 6px 10px;
  font-size: 12px;
  color: #fbcfe8;
}

.note-editor {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-input {
  flex: 1 1 240px;
  border: 1px solid var(--border-strong);
  background: #07090d;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.note-input:focus {
  border-color: var(--accent);
}

.note-save-btn {
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.note-save-btn:hover {
  filter: brightness(1.1);
}

/* Shortcuts & Phases Overview */
.phases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px;
}

.phase-card {
  border: 1px solid var(--border);
  background: #0b101b;
  border-radius: 12px;
  padding: 14px;
}

.phase-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.18);
  border: 1px solid rgba(236, 72, 153, 0.45);
  color: #f9a8d4;
  font-size: 12px;
  font-weight: 800;
  margin-right: 8px;
}

.phase-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
}

.phase-sub {
  margin: 4px 0 8px 32px;
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 600;
}

.phase-points {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.shortcuts-table-wrap {
  overflow-x: auto;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.shortcuts-table th {
  text-align: left;
  padding: 10px 16px;
  background: #0b101b;
  color: var(--accent-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.shortcuts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.7);
  vertical-align: top;
  line-height: 1.45;
}

.shortcuts-table td:first-child {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.shortcuts-table td:nth-child(2) {
  color: #fcd34d;
  font-weight: 600;
  white-space: nowrap;
}

.shortcuts-table td:nth-child(3) {
  color: #cbd5e1;
}

/* Empty State */
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.65);
  padding: 36px 20px;
  text-align: center;
}

.empty-state p {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}

.btn-primary-cyan {
  border: none;
  border-radius: 9px;
  background: var(--accent-2);
  color: #082f49;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(7, 9, 13, 0.75);
  padding: 20px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: var(--accent-2);
  text-decoration: underline;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
}

.modal-card {
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.modal-desc {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-modal-danger {
  border: none;
  border-radius: 9px;
  background: #e11d48;
  color: #fff;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.toast-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(15, 23, 42, 0.96);
  color: #a5f3fc;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
}

@media (max-width: 640px) {
  .site-title {
    font-size: 17px;
  }
  .stat-card {
    padding: 5px 9px;
  }
  .stat-value {
    font-size: 14px;
  }
  .search-wrap {
    max-width: none;
    flex-basis: 100%;
  }
}
