/* Copium Counter colour schemes. Orange/red only for attention. Theme and light/dark are set by theme.js. */
:root {
  --paper: #F5F3F8;
  --card: #FFFFFF;
  --ink: #241F2E;
  --muted: #6A6375;
  --accent: #6B4FA0;
  --accent-soft: #ECE6F5;
  --line: #DDD7E6;
  --attention: #B4531F;
  --danger: #A23B2A;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    --paper: #17141D;
    --card: #211C29;
    --ink: #ECE8F2;
    --muted: #A8A0B4;
    --accent: #B9A2E8;
    --accent-soft: #2E2640;
    --line: #362F42;
    --attention: #E39A6B;
    --danger: #E3876F;
    color-scheme: dark;
  }
}
:root[data-theme="haze"] {
  --paper: #F5F3F8;
  --card: #FFFFFF;
  --ink: #241F2E;
  --muted: #6A6375;
  --accent: #6B4FA0;
  --accent-soft: #ECE6F5;
  --line: #DDD7E6;
  --attention: #B4531F;
  --danger: #A23B2A;
  color-scheme: light;
}
:root[data-theme="haze"][data-dark] {
  --paper: #17141D;
  --card: #211C29;
  --ink: #ECE8F2;
  --muted: #A8A0B4;
  --accent: #B9A2E8;
  --accent-soft: #2E2640;
  --line: #362F42;
  --attention: #E39A6B;
  --danger: #E3876F;
  color-scheme: dark;
}
:root[data-theme="ember"] {
  --paper: #FAF5F0;
  --card: #FFFFFF;
  --ink: #2B211A;
  --muted: #76675C;
  --accent: #A4532B;
  --accent-soft: #F6E6DA;
  --line: #E6DACF;
  --attention: #B03A48;
  --danger: #A12A38;
  color-scheme: light;
}
:root[data-theme="ember"][data-dark] {
  --paper: #1A1512;
  --card: #241D18;
  --ink: #F1E9E2;
  --muted: #B3A397;
  --accent: #E8956A;
  --accent-soft: #3A2A20;
  --line: #3B2F27;
  --attention: #F08A96;
  --danger: #F08A96;
  color-scheme: dark;
}
:root[data-theme="ocean"] {
  --paper: #F2F6F8;
  --card: #FFFFFF;
  --ink: #18262E;
  --muted: #5C6E78;
  --accent: #1F6F8B;
  --accent-soft: #DDEDF3;
  --line: #D3DFE5;
  --attention: #B4531F;
  --danger: #A23B2A;
  color-scheme: light;
}
:root[data-theme="ocean"][data-dark] {
  --paper: #10181C;
  --card: #172227;
  --ink: #E4EEF2;
  --muted: #9AB0BA;
  --accent: #6CC3DE;
  --accent-soft: #1D3540;
  --line: #27363D;
  --attention: #E39A6B;
  --danger: #E3876F;
  color-scheme: dark;
}
:root[data-theme="mono"] {
  --paper: #FFFFFF;
  --card: #FFFFFF;
  --ink: #000000;
  --muted: #444444;
  --accent: #000000;
  --accent-soft: #E6E6E6;
  --line: #8A8A8A;
  --attention: #B4531F;
  --danger: #A0001A;
  color-scheme: light;
}
:root[data-theme="mono"][data-dark] {
  --paper: #000000;
  --card: #111111;
  --ink: #FFFFFF;
  --muted: #CCCCCC;
  --accent: #FFFFFF;
  --accent-soft: #333333;
  --line: #777777;
  --attention: #FFB27A;
  --danger: #FF8A8A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h2, h3, legend { font-family: Georgia, "Times New Roman", serif; font-weight: normal; }
h1 { font-size: 1.3rem; margin: 0; color: var(--accent); }
h2 { font-size: 1.4rem; margin: 0.5rem 0; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 0.92rem; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.private { margin: 0; font-size: 0.85rem; color: var(--muted); }
main { max-width: 560px; margin: 0 auto; padding: 16px; }

button, .button {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
button:focus-visible, .button:focus-within, textarea:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 4px 8px; min-height: 0; }

.tap {
  display: flex; flex-direction: column; width: min(70vw, 240px); aspect-ratio: 1; margin: 16px auto 8px;
  border-radius: 50%; background: var(--accent); color: var(--paper); border: none;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15); transition: transform 0.08s;
}
.tap:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.tap-plus { font-family: Georgia, serif; font-size: 3.4rem; line-height: 1; letter-spacing: 0.06em; }
.tap-label { font-size: 1.1rem; letter-spacing: 0.05em; }
.counts { text-align: center; color: var(--muted); margin: 0 0 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.card.attention { border-color: var(--attention); }
.card h3 { margin-top: 0; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.saved { margin: 0; color: var(--accent); }
fieldset { border: none; padding: 0; margin: 12px 0; }
legend { font-size: 1rem; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 6px 12px; min-height: 40px; font-size: 0.95rem; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.scale .chip { min-width: 48px; }
.note { display: block; margin: 12px 0; }
.note small { color: var(--muted); }
textarea, input[type="text"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 4px;
}
.warn { color: var(--attention); }

.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent time { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 2.5rem; gap: 10px; align-items: center; padding: 4px 0; }
.bar { height: 12px; background: var(--accent-soft); border-radius: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.n { text-align: right; font-variant-numeric: tabular-nums; }

details { border-bottom: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; min-height: 32px; }
.plain { padding-left: 1.1rem; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row input[type="text"] { flex: 1 1 10rem; width: auto; margin-top: 0; }
.preview { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px; overflow-x: auto; font-size: 0.8rem; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: none; border-radius: 0; background: none; min-height: 56px; font-size: 0.9rem; color: var(--muted); }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity 0.2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.chips.spaced { margin-top: 8px; }
.lockscreen { max-width: 420px; margin: 18vh auto 0; padding: 16px; text-align: center; }
.lockscreen details { text-align: left; margin-top: 2rem; }
.tabs[hidden], main[hidden] { display: none; }
.tabs button[hidden] { display: none; }
.help-inline { border-left: 3px solid var(--attention); padding-left: 10px; }
.onboarding { max-width: 560px; margin: 0 auto; padding: 16px; }
.options { display: grid; gap: 8px; }
.option { display: block; text-align: left; width: 100%; padding: 12px 14px; }
.option[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.option strong { display: block; font-weight: 600; }
.option small { color: var(--muted); }
.wide { width: 100%; margin-top: 20px; }
.pops { font-size: 1.4rem; font-family: Georgia, serif; margin: 8px 0; }
.pops small { font-family: "Segoe UI", system-ui, sans-serif; font-size: 0.9rem; color: var(--muted); }
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 360px; margin: 12px auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.bubble { aspect-ratio: 1; border-radius: 50%; padding: 0; min-height: 0; background: radial-gradient(circle at 35% 30%, var(--card), var(--accent-soft) 70%); border: 1px solid var(--line); }
.bubble.popped { background: var(--paper); border-style: dashed; transform: scale(0.9); }
.shop { list-style: none; padding: 0; margin: 0; }
.shop li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shop small { color: var(--muted); display: block; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; border: 1px solid var(--line); }
.goal { margin: 10px 0; }
.goal strong { display: block; margin-bottom: 4px; font-weight: 600; }
.goal input[type="number"] { width: 5.5rem; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; margin-left: 6px; }
.goal-lines { list-style: none; padding: 0; margin: -6px 0 16px; text-align: center; color: var(--muted); font-size: 0.95rem; }
.goal-lines li { padding: 2px 0; }
#safety fieldset { margin: 18px 0 8px; }
#safety legend { font-family: inherit; font-weight: 600; }
.goal label { display: block; margin-top: 8px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 64px; border-radius: 10px; font-size: 0.85rem; }
.day[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.day .n { font-size: 1.15rem; font-family: Georgia, serif; text-align: center; }
.day .clear { color: var(--accent); font-size: 0.75rem; }
.day-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: none; }
select, input[type="time"] { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; }

/* What's new guide */
.guide {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(68px + env(safe-area-inset-bottom));
  width: min(420px, calc(100% - 32px)); background: var(--card); border: 2px solid var(--accent); border-radius: 14px;
  padding: 12px 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); z-index: 10;
}
.guide[hidden] { display: none; }
.guide h3 { margin: 4px 0; }
.guide p { margin: 4px 0; }
.guide .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.guide .row .link { margin-left: auto; }
.guide-focus { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
body.guiding main { padding-bottom: 260px; }
