/* Quotidian house style: navy ground, Georgia headings, Helvetica body, one orange rule per screen. */
:root {
  --navy: #10324c;
  --navy-2: #1b4565;
  --line: #5a6b79;
  --muted: #8a98a3;
  --soft: #d3dbe1;
  --white: #ffffff;
  --orange: #ff7300;
  --focus: #0080ff;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: var(--white); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
a { color: var(--white); }
a:hover { color: var(--soft); }
button, input, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.loading { margin: auto; color: var(--soft); }

/* top bars */
.brand { font-family: var(--serif); font-weight: 400; color: var(--white); }
.top { padding: 40px 24px 0; display: flex; justify-content: space-between; align-items: center; }
.top .brand { font-size: 30px; }
.bar { border-bottom: 1px solid var(--line); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; }
.bar .brand { font-size: 22px; }
.bar .day { font-size: 13px; font-weight: 700; color: var(--soft); }
.back-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-row .ctx { font-size: 13px; font-weight: 700; color: var(--soft); text-align: right; }

/* layout */
.center { flex: 1; padding: 0 24px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.main { flex: 1; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.pad { padding: 0 24px; }

h1, h2.serif { margin: 0; font-family: var(--serif); font-weight: 400; line-height: 1.15; color: var(--white); }
.h-xl { font-size: 40px; line-height: 1.1; }
.h-l { font-size: 34px; }
.h-m { font-size: 28px; }
.h-s { font-size: 26px; }
h2 { margin: 0; font-size: 15px; font-weight: 700; }
.rule { width: 48px; height: 4px; background: var(--orange); }
.rule.wide { width: 96px; height: 5px; }
.lede { margin: 0; font-size: 17px; line-height: 1.55; }
.small { margin: 0; font-size: 13px; line-height: 1.5; color: var(--soft); }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.step { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--soft); }

/* buttons and links */
.primary { display: flex; align-items: center; justify-content: center; min-height: 52px; width: 100%;
  background: var(--white); color: var(--navy); border: 1px solid var(--white); font-weight: 700; font-size: 15px; text-decoration: none; }
.primary:hover { color: var(--navy); background: var(--soft); }
.primary[disabled] { opacity: .45; cursor: default; }
.foot { padding: 20px 24px 32px; }
.link { background: none; border: 0; padding: 0; min-height: 44px; display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 700; color: var(--white); text-decoration: none; }
.link.sm { font-size: 14px; }
.link.quiet { color: var(--soft); font-weight: 400; text-decoration: underline; }
.ghost { min-height: 44px; padding: 0 16px; background: none; border: 1px solid var(--line); color: var(--white); font-size: 14px; font-weight: 700; }
.danger { border-color: #c96a5a; color: #ffd3c9; }

/* register */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 700; }
.line-input { height: 44px; border: 0; border-bottom: 1px solid var(--muted); background: transparent; padding: 0; font-size: 16px; color: var(--white); width: 100%; }
.line-input::placeholder { color: var(--muted); }
.code-input { font-family: var(--serif); font-size: 30px; letter-spacing: .3em; height: 56px; }
.privacy { margin: 22px 24px 0; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.privacy p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--soft); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--focus); }
.msg { margin: 0; font-size: 14px; line-height: 1.5; color: #ffd3c9; min-height: 1em; }
.msg.ok { color: var(--soft); }

/* home */
.panel { padding: 16px; background: var(--navy-2); display: flex; flex-direction: column; gap: 4px; }
.panel .k { font-size: 13px; font-weight: 700; color: var(--soft); }
.panel .card-name { font-family: var(--serif); font-size: 22px; }
.panel .v { font-size: 14px; color: var(--soft); }

/* choose */
.choices { display: flex; flex-direction: column; margin-top: 6px; }
.choice { text-align: left; text-decoration: none; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--white);
  display: flex; flex-direction: column; gap: 2px; width: 100%; }
.choice b { font-size: 16px; }
.choice span { font-size: 14px; color: var(--soft); }
.choice.lead { background: var(--white); color: var(--navy); border: 1px solid var(--white); }
.choice.lead span { color: var(--line); }
.choice.own { margin-top: 12px; background: var(--navy-2); border: 0; }
.choice[disabled] { opacity: .45; cursor: default; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--navy); color: var(--white); font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--white); color: var(--navy); border-color: var(--white); font-weight: 700; }

/* card */
.flip { padding: 0; border: 0; background: none; align-self: center; perspective: 1200px; width: min(300px, 78vw); aspect-ratio: 300 / 383; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flip.turned .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--white); overflow: hidden; }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.face.back { transform: rotateY(180deg); }
.face.typed { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 28px; color: var(--navy); text-align: left; }
.face.typed .t { font-family: var(--serif); font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
.face.typed .s { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--line); }
.face.typed .r { width: 48px; height: 4px; background: var(--orange); }
.under { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--soft); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.tools button { min-height: 44px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--navy); font-size: 14px; color: var(--white); }
.tools button[aria-pressed="true"] { background: var(--navy-2); font-weight: 700; }
.note { width: 100%; min-height: 88px; padding: 10px; background: var(--navy-2); border: 1px solid var(--line); color: var(--white); font-size: 16px; line-height: 1.45; resize: vertical; }
.rating { border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; }
.rating legend { padding: 0; font-size: 15px; font-weight: 700; }
.scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.scale button { min-height: 44px; border: 1px solid var(--line); background: var(--navy); font-family: var(--serif); font-size: 18px; color: var(--white); }
.scale button[aria-pressed="true"] { background: var(--white); color: var(--navy); border-color: var(--white); }
.ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); }
.push { margin-top: auto; }

/* browse */
.search { height: 44px; padding: 0 12px; background: var(--navy-2); border: 1px solid var(--line); font-size: 16px; color: var(--white); width: 100%; }
.search::placeholder { color: var(--muted); }
.deck { list-style: none; margin: 0; padding: 0; }
.deck button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 2px; color: var(--white); }
.deck .nm { font-family: var(--serif); font-size: 19px; }
.deck .tg { font-size: 13px; color: var(--soft); }
.deck-h { margin: 14px 0 0; font-size: 13px; font-weight: 700; color: var(--soft); }

/* record */
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-head .nav { display: flex; gap: 4px; }
.cal-head .nav button { width: 44px; height: 44px; border: 0; background: none; color: var(--white); display: flex; align-items: center; justify-content: center; }
.cal-head .nav button[disabled] { opacity: .3; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.cal .d { height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--soft); font-size: 13px; background: none; padding: 0; }
.cal .d.on { background: var(--white); color: var(--navy); border-color: var(--white); font-weight: 700; }
.cal .d.today { outline: 2px solid var(--orange); outline-offset: -2px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; scroll-margin-top: 16px; }
.log li.flash { background: var(--navy-2); }
.log .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.log .dt { font-size: 12px; font-weight: 700; color: var(--muted); }
.log .nm { font-family: var(--serif); font-size: 19px; overflow-wrap: anywhere; }
.log .how { font-size: 13px; color: var(--soft); }
.log .nt { font-size: 14px; font-style: italic; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.log .rt { font-family: var(--serif); font-size: 22px; white-space: nowrap; }
.log .rt small { font-family: var(--sans); font-size: 12px; color: var(--soft); }
.mine { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.empty { padding: 18px 0; color: var(--soft); font-size: 15px; line-height: 1.5; }

/* usage */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; height: 120px; border-bottom: 1px solid var(--line); }
.bars div { background: var(--soft); min-height: 2px; }
.bars-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--white); color: var(--navy);
  padding: 12px 16px; font-size: 14px; font-weight: 700; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }

@media (prefers-reduced-motion: reduce) { .flip-inner { transition: none; } }
