/* Penny: soft, round, calm. Tokens from shared/design/E27-penny-style-and-screens.txt. System fonts only (CSP: self). */
:root {
  --bg: #FFF8F2; --ink: #3B2331; --ink-soft: #6A4A5C; --primary: #5B3FA0; --primary-dark: #43297E; --card: #FFFFFF; --line: #E8D7E0;
  --border: #748A8D; --mint: #CDEFD9; --mint-ink: #1F6B40; --sky: #D6E9FF; --lilac: #E3DDF8; --sun: #FFE9A8; --focus: #0B57D0; --error: #8F1D1D; --track: #EFE4EA;
  --muted: #6A4A5C; --accent: #5B3FA0;
}
:root[data-theme="dark"] {
  --bg: #1E1628; --ink: #F6EEF8; --ink-soft: #CDBFD6; --primary: #C9B6FF; --primary-dark: #E3DDF8; --card: #2B2038; --line: #4B3B5C;
  --border: #9FB2B5; --mint: #25503A; --mint-ink: #BFF0D2; --sky: #28405F; --lilac: #3A3060; --sun: #5B4A18; --focus: #8AB4FF; --error: #FFB4AB; --track: #130D1B; --muted: #CDBFD6; --accent: #C9B6FF;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 17px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); padding-bottom: 88px; }
h1, h2, h3 { font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif; font-weight: 800; line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 18px; }
p { margin: 0 0 10px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: #000; padding: 8px; }
.skip:focus { left: 8px; z-index: 30; }
.top-in { max-width: 480px; margin: 0 auto; padding: 12px 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { font: 800 20px ui-rounded, "Trebuchet MS", system-ui, sans-serif; color: var(--primary); }
main { max-width: 480px; margin: 0 auto; padding: 8px 16px 16px; }
main:focus { outline: none; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 24px; padding: 16px; margin: 12px 0; box-shadow: 0 6px 18px rgba(91, 58, 74, .12); }
.card h2 { margin-top: 0; }
.stage { border-radius: 24px; overflow: hidden; border: 2px solid var(--line); background: var(--card); margin: 8px 0; }
.scene { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.stage .scene { max-width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 2px 14px; border-radius: 18px; background: var(--sky); color: var(--ink); font-size: 15px; font-weight: 700; }
.chip.streak { background: var(--lilac); } .chip.goal { background: var(--mint); color: var(--mint-ink); }
.btn { font: 800 18px ui-rounded, "Trebuchet MS", system-ui, sans-serif; min-height: 56px; padding: 8px 24px; border-radius: 999px; border: 2px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
:root[data-theme="dark"] .btn { color: #1E1628; }
:root[data-theme="dark"] .btn.secondary { color: var(--primary); }
:root[data-theme="dark"] .btn.danger { color: var(--error); }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--card); color: var(--primary); }
.btn.secondary:hover { background: var(--lilac); }
.btn.small { min-height: 44px; font-size: 16px; padding: 4px 18px; }
.btn.danger { background: var(--card); color: var(--error); border-color: var(--error); }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: default; }
.field { margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.field label, legend { font-weight: 700; }
input[type="text"], input[type="number"], select { font: inherit; min-height: 48px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--card); color: var(--ink); width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; accent-color: var(--primary); }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
fieldset { border: 0; padding: 0; margin: 10px 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.visually-hidden:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.bar { height: 16px; border-radius: 8px; background: var(--track); overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--mint); border-top: 2px solid #2F7A4B; }
.bar:not(.w0) > span { min-width: 8px; } /* any progress is visible; only a true zero is empty */
:root[data-theme="dark"] .bar > span { background: #7FD6A0; border-top-color: #BFF0D2; }
body.toast-on { padding-bottom: 168px; } /* room for the toast above the tab bar, so it never hides the last line (XP bar) */
.bar.w0 > span { width: 0; } /* widths are set by classes below so no inline style is needed */
.w5 > span{width:5%}.w10 > span{width:10%}.w15 > span{width:15%}.w20 > span{width:20%}.w25 > span{width:25%}.w30 > span{width:30%}.w35 > span{width:35%}.w40 > span{width:40%}.w45 > span{width:45%}.w50 > span{width:50%}
.w55 > span{width:55%}.w60 > span{width:60%}.w65 > span{width:65%}.w70 > span{width:70%}.w75 > span{width:75%}.w80 > span{width:80%}.w85 > span{width:85%}.w90 > span{width:90%}.w95 > span{width:95%}.w100 > span{width:100%}
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 2px; background: var(--card); border-top: 2px solid var(--line); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); }
.tabs button { flex: 1 1 0; max-width: 96px; min-height: 56px; font: 700 13px system-ui, sans-serif; border: 0; border-radius: 16px; background: transparent; color: var(--ink-soft); cursor: pointer; padding: 4px 2px; }
.tabs button[aria-current="page"] { background: var(--lilac); color: var(--ink); }
.tabs .ico { display: block; font-size: 20px; line-height: 24px; }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); margin: 0 auto; max-width: 456px; max-height: 64px; overflow: hidden; z-index: 25; padding: 4px 14px; background: #3B2331; color: #fff; border-radius: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
/* A short phone (about 460 px high): the toast moves to the TOP so it can never cover the XP line or the Log button (Lena H3). One line, 14 px. */
@media (max-height: 520px) { .toast { bottom: auto; top: 8px; font-size: 14px; line-height: 1.3; } }
.toast:empty { display: none; }
.toast.bad { background: var(--error); color: #fff; }
:root[data-theme="dark"] .toast.bad { color: #1E1628; }
:root[data-theme="dark"] .toast.bad button { color: #1E1628; border-color: #1E1628; }
.toast button { font: 800 16px system-ui, sans-serif; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid #fff; background: transparent; color: #fff; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin: 10px 0; padding: 0; list-style: none; }
.cell { min-height: 48px; min-width: 48px; width: 100%; /* squares are never under 44 px (WCAG 2.5.8 target size is 24, our own rule is 44) */ border-radius: 12px; border: 2px solid var(--border); background: var(--card); color: var(--ink); font: 700 15px system-ui, sans-serif; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; padding: 0; }
/* done: mint fill and a 16 px check under the number. today: sun fill and a 6 px dot under the number. (state is also in the aria-label: "done", "this week") */
.cell.done { background: var(--mint); color: var(--mint-ink); border-color: #2F7A4B; cursor: default; }
.cell.done::after { content: "\2713"; display: block; font-size: 16px; line-height: 16px; font-weight: 800; }
.cell.now { background: var(--sun); border-style: dashed; color: var(--ink); }
.cell.now::after { content: ""; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); margin-top: 3px; }
.cell.box { display: flex; align-items: center; justify-content: center; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; list-style: none; padding: 0; margin: 0; }
.tile { border: 2px solid var(--line); border-radius: 18px; padding: 8px; background: var(--card); text-align: center; }
.tile.sel { border-color: var(--primary); }
.tile { position: relative; }
.tile.locked .scene, .tile.locked .thumb { filter: grayscale(.6) opacity(.75); } /* softer than full grey: the pet keeps its colour */
.tile .lock { color: #fff; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: #3B2331; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; z-index: 1; }
.tile .scene, .tile .thumb { border: 2px solid var(--line); border-radius: 12px; }
.chip.earn { background: var(--lilac); min-height: 28px; font-size: 13px; margin: 0 0 4px; }
.chip.pro { background: var(--sun); color: var(--ink); min-height: 28px; font-size: 13px; margin: 0 0 4px; }
.tile .lock svg { width: 16px; height: 16px; display: block; }
.tile .scene { max-width: 140px; }
.tile h3 { min-height: 2.6em; font-size: 16px; }
.tile .thumb { width: 100%; max-width: 120px; height: auto; display: block; margin: 0 auto 4px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.seg button { flex: 1 1 auto; min-height: 48px; border-radius: 999px; border: 2px solid var(--primary); background: var(--card); color: var(--primary); font: 800 15px system-ui, sans-serif; cursor: pointer; padding: 4px 12px; }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #1E1628; }
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: auto; padding: 16px; }
.overlay > div { max-width: 480px; margin: 0 auto; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(59, 35, 49, .6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal > div { background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 24px; padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.msg { min-height: 1.5em; font-weight: 700; }
.msg.bad { color: var(--error); }
.banner { background: var(--sun); border-radius: 18px; padding: 10px 14px; margin: 8px 0; color: #3B2331; font-weight: 700; }
:root[data-theme="dark"] .banner { color: #F6EEF8; }
.dots { color: var(--ink-soft); font-weight: 700; }
code, .linkbox { font: 14px ui-monospace, Consolas, monospace; word-break: break-all; }
[hidden] { display: none !important; }

/* ---- 1 Dec 2026 design review fixes (Lena) ---- */
/* M1: every control is at least 44 x 44 px (primary buttons stay 56). */
button, select, summary { min-height: 44px; } /* element selectors only: they never beat the class rules that make buttons 48 or 56 */
button, .btn { min-width: 44px; }
.check label { flex: 1; min-height: 44px; display: flex; align-items: center; } /* the whole row is tappable, not just the 24 px box */
details > summary { display: flex; align-items: center; cursor: pointer; }
/* L1: placeholder text keeps 4.5:1 (light #6A4A5C on white, dark #C9B8D4 on the dark card) */
input::placeholder { color: #6A4A5C; opacity: 1; }
:root[data-theme="dark"] input::placeholder { color: #C9B8D4; opacity: 1; }
/* L2: the three Log tabs share one row, short labels (the full names are in aria-label) */
.seg.three { flex-wrap: nowrap; }
.seg.three button { flex: 1 1 0; min-width: 0; padding: 4px 6px; font-size: 14px; }
/* M9: the first-run pet never takes more than 38% of the screen height, so the name field and Next are visible on a short phone */
.overlay .stage { width: fit-content; max-width: 100%; margin: 8px auto; }
.overlay .stage .scene { max-height: 38vh; width: auto; display: block; }
/* M8: the dialog buttons are 48 px high, 16 px apart; Cancel (filled) first */
.dialog-row { gap: 16px; margin-top: 12px; }
.dialog-row .btn { min-height: 48px; }
.btn.danger { border-width: 2px; border-color: var(--error); }
/* M3: share card preview, at most 240 px wide */
.card-preview-box { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.card-preview { display: block; width: 240px; max-width: 100%; height: auto; border: 2px solid var(--line); border-radius: 12px; }

/* Pet motion: only when allowed. The :root.reduce-motion class (Settings) and the media query both switch it all off. */
@keyframes pet-bob { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes pet-blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes pet-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pet-hop { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(-10px); } 50% { transform: translateY(0); } 75% { transform: translateY(-6px); } }
.pet-bob { transform-box: fill-box; transform-origin: center bottom; animation: pet-bob 3s ease-in-out infinite; }
.scene-celebrate .pet-bob { animation: pet-hop 1s ease-in-out 2; }
.blink { transform-box: fill-box; transform-origin: center; animation: pet-blink 5s infinite; }
.float { animation: pet-float 2.4s ease-in-out infinite; }
.zzz { animation: pet-float 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .pet-bob, .blink, .float, .zzz, .scene-celebrate .pet-bob { animation: none !important; }
  * { scroll-behavior: auto !important; transition: none !important; }
}
.reduce-motion .pet-bob, .reduce-motion .blink, .reduce-motion .float, .reduce-motion .zzz, .reduce-motion .scene-celebrate .pet-bob { animation: none !important; }
.reduce-motion * { transition: none !important; }
@media print { .tabs, .top, .toast, .overlay { display: none; } body { background: #fff; } }
