/* Practice Hub — styles */

:root {
  --rb-50:  #FDF3F7;
  --rb-100: #FBE3EC;
  --rb-200: #F5C4D6;
  --rb-500: #C2185B;
  --rb-700: #9E1149;
  --rb-900: #4D0A25;

  --gr-50:  #EEF6EF;
  --gr-100: #DCEBDD;
  --gr-600: #2E7D32;
  --gr-800: #1B5E20;

  --ink:    #2B1F26;
  --ink-2:  #5F4F58;
  --ink-3:  #7A6972;
  --canvas: #FBF7F9;
  --surface:#FFFFFF;
  --line:   #EADFE4;

  --ok:     var(--gr-600);
  --warn:   #8A5A00;

  --accent:        var(--rb-500);
  --accent-press:  var(--rb-700);
  --accent-tint:   var(--rb-50);

  --font-ui:      -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-micro: 12px;
  --t-small: 14px;
  --t-body:  17px;
  --t-lead:  20px;
  --t-title: 28px;
  --t-hero:  44px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;

  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --tap: 48px;
  --shadow-sheet: 0 -8px 32px rgba(77,10,37,.14);
  --shadow-dock:  0 6px 20px rgba(194,24,91,.28);

  --ease: cubic-bezier(.2,.7,.2,1);
  --dur: 200ms;
}

[data-theme="green"] {
  --accent-2: var(--gr-600);
  --accent-2-tint: var(--gr-50);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:    #F6ECF1;
    --ink-2:  #CDBBC4;
    --ink-3:  #A8939D;
    --canvas: #171016;
    --surface:#211820;
    --line:   #3A2B35;
    --accent-tint: #2E1522;
    --warn:   #E6B34D;
    --ok:     #81C784;
    --shadow-sheet: 0 -8px 32px rgba(0,0,0,.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: 1.4;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

/* Install gate */
.install-gate {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.install-content {
  max-width: 320px;
  padding: var(--s6);
  text-align: center;
}
.install-content h1 {
  font-size: var(--t-title);
  font-weight: 600;
  margin-bottom: var(--s5);
}
.share-icon {
  margin: var(--s6) 0;
}
.install-content p {
  font-size: var(--t-body);
  color: var(--ink-2);
  line-height: 1.5;
}

/* Lock screen */
.lock-screen {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.lock-content {
  width: 100%;
  max-width: 360px;
  padding: var(--s6);
  text-align: center;
}
.lock-content h1 {
  font-size: var(--t-title);
  font-weight: 600;
  margin-bottom: var(--s6);
}
.passcode-dots {
  display: flex;
  gap: var(--s4);
  justify-content: center;
  margin-bottom: var(--s6);
}
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: all var(--dur) var(--ease);
}
.dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}
.passcode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  max-width: 280px;
  margin: 0 auto var(--s5);
}
.key {
  min-height: 56px;
  border: none;
  background: var(--accent-tint);
  color: var(--ink);
  font-size: var(--t-title);
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.key:active { transform: scale(.95); background: var(--rb-100); }
.key-blank { visibility: hidden; }
.key-del { font-size: var(--t-lead); }
.lock-error {
  color: var(--warn);
  font-size: var(--t-small);
  margin-top: var(--s4);
}
.setup-hint {
  font-size: var(--t-small);
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: var(--s5);
}

/* App */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.statusbar { height: 47px; flex: none; }
.screen {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0 var(--s5);
  padding-bottom: 120px;
  position: relative;
}
.tab-content { display: none; padding-top: var(--s5); }
.tab-content:not(.hidden) { display: block; }

/* Header */
.header {
  margin-bottom: var(--s6);
}
.eyebrow {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin-bottom: var(--s2);
}
.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--accent-tint);
  color: var(--ok);
  border-radius: var(--r-pill);
  font-size: var(--t-micro);
  font-weight: 600;
  cursor: pointer;
}

/* Month figure */
.month-figure {
  margin-bottom: var(--s6);
}
.month-label {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin-bottom: var(--s2);
}
.figure {
  font-family: var(--font-display);
  font-size: var(--t-hero);
  font-weight: 400;
  color: var(--rb-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.fy-line {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin-top: var(--s2);
}

/* Month selector */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s4);
  padding: var(--s3) 0;
}
.month-nav {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 24px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#currentMonth {
  font-size: var(--t-body);
  font-weight: 600;
}
.year-switch {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.year-btn {
  flex: 1;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  font-size: var(--t-small);
  cursor: pointer;
}
.year-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Coming up */
.coming-up h3 {
  font-size: var(--t-body);
  font-weight: 600;
  margin-bottom: var(--s3);
}
.date-row {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.date-row:last-child { border-bottom: none; }
.date-title {
  font-weight: 500;
  margin-bottom: var(--s1);
}
.date-when {
  font-size: var(--t-small);
  color: var(--ink-2);
}
.date-when.soon {
  color: var(--warn);
}
.date-when.soon::before {
  content: '▲ ';
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--s6) var(--s5);
  color: var(--ink-2);
}

/* Backup reminder */
.backup-reminder {
  margin-top: var(--s5);
  padding: var(--s4);
  background: var(--accent-tint);
  border-radius: var(--r-md);
}
.backup-reminder p {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin-bottom: var(--s3);
}

/* Search field */
.search-field {
  width: 100%;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--t-body);
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--ink);
  margin-bottom: var(--s4);
  outline: none;
}
.search-field:focus {
  border-color: var(--accent);
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s5);
  overflow-x: auto;
  padding-bottom: var(--s2);
}
.chip {
  flex-shrink: 0;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--r-pill);
  font-size: var(--t-small);
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Phrase list */
.phrase-card {
  padding: var(--s4);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.phrase-code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-press);
  margin-bottom: var(--s1);
}
.phrase-title {
  font-weight: 600;
  margin-bottom: var(--s1);
}
.phrase-preview {
  font-size: var(--t-small);
  color: var(--ink-2);
  line-height: 1.5;
  margin-bottom: var(--s2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.phrase-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.in-epic-mark {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-micro);
  color: var(--ok);
}

/* Reference cards */
.ref-card {
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--s3);
  cursor: pointer;
}
.ref-card h3 {
  font-size: var(--t-body);
  font-weight: 600;
  margin-bottom: var(--s2);
}
.currency-stamp {
  font-size: var(--t-small);
  color: var(--ink-2);
}
.currency-stamp.ok {
  color: var(--ok);
}
.currency-stamp.warn {
  color: var(--warn);
}

/* Feedback */
.feedback-intro {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin-bottom: var(--s4);
  line-height: 1.5;
}
.feedback-field {
  width: 100%;
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--t-body);
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  margin-bottom: var(--s4);
  outline: none;
  min-height: 160px;
}
.feedback-field:focus {
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 54px;
  padding: 0 var(--s6);
  border: 0;
  border-radius: var(--r-pill);
  font: 600 var(--t-body)/1 var(--font-ui);
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  width: 100%;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:active {
  background: var(--accent-press);
  transform: scale(.985);
}
.btn-quiet {
  background: transparent;
  color: var(--accent-press);
  min-height: var(--tap);
}
.btn-quiet:active {
  color: var(--accent);
}

/* Docked button */
.btn-dock {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s6);
  min-height: 58px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font: 600 var(--t-body)/1 var(--font-ui);
  cursor: pointer;
  box-shadow: var(--shadow-dock);
  transition: all var(--dur) var(--ease);
  z-index: 10;
}
.btn-dock:active {
  background: var(--accent-press);
  transform: translateX(-50%) scale(.98);
}

/* Tab bar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 83px;
  padding: 8px 8px 28px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 11px;
  text-decoration: none;
  min-height: var(--tap);
}
.tab svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

/* Ask tab */
.ask-notice {
  font-size: var(--t-small);
  color: var(--ink-2);
  padding: var(--s3) var(--s4);
  background: var(--accent-tint);
  border-radius: var(--r-md);
  margin-bottom: var(--s4);
  line-height: 1.5;
}
.ask-controls {
  margin-bottom: var(--s5);
}
.ask-agent-select, .ask-mode-select {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s3);
}
.ask-thread {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: var(--s4);
  padding: var(--s3);
  background: var(--accent-tint);
  border-radius: var(--r-md);
}
.ask-message {
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s3);
  border-radius: var(--r-md);
  line-height: 1.5;
}
.ask-message.user {
  background: var(--accent);
  color: #fff;
  margin-left: var(--s5);
}
.ask-message.assistant {
  background: var(--surface);
  margin-right: var(--s5);
}
.ask-composer {
  position: sticky;
  bottom: 0;
  background: var(--canvas);
  padding-top: var(--s3);
}

/* Toast */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--s3) var(--s5);
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-md);
  font-size: var(--t-small);
  font-weight: 500;
  z-index: 1001;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.toast.show {
  opacity: 1;
}

:focus-visible {
  outline: 3px solid var(--accent-press);
  outline-offset: 2px;
}
