/* Giri Gains — the Giri Eats game-island look (Peach Milk), shaped like a Strong-style logger.
   Fonts: Fredoka (headings), Nunito (text), M PLUS Rounded 1c (Japanese). Colours are tokens; dark follows the device. */

:root {
  --bg: #fdeee4;          /* peach milk */
  --card: #fffaf3;
  --card-2: #fff3e6;
  --ink: #6e4a3f;         /* warm brown */
  --ink-2: #9a7a6c;
  --line: #f1dccb;
  --sun: #ffd75e;         /* primary buttons */
  --sun-deep: #e3b23c;
  --on-sun: #5d3f33;
  --coral: #ff9f87;
  --mint: #8fd5d8;        /* sea */
  --leaf-c: #7cc35a;
  --done: #dff3cf;        /* ticked set row */
  --done-ink: #3f7a2a;
  --danger: #c2415a;
  --focus: #3aa7ad;
  --edge: #ecd6c2;        /* the ledge under buttons */
  --shadow: 0 2px 0 rgba(110, 74, 63, 0.1), 0 6px 16px rgba(110, 74, 63, 0.08);
  --r: 20px;
  --font-pop: 'Fredoka', 'M PLUS Rounded 1c', system-ui, sans-serif;
  --font-body: 'Nunito', 'M PLUS Rounded 1c', system-ui, -apple-system, sans-serif;
  /* island art */
  --sky1: #bfe9ec; --sky2: #fdf3ea; --sea: #8fd5d8; --shallow: #b9e7e2; --foam: #fffaf3; --beach: #fde3c8; --grass: #b7dd93;
  --roof: #ff9f87; --door: #ffd75e; --wall: #fff7ef; --leaf: #8cc96b; --rock: #d9c2b0;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d2329; --card: #262e35; --card-2: #2e373f; --ink: #f2e8d6; --ink-2: #b6a99a; --line: #3a444d;
    --sun: #ffd75e; --sun-deep: #c99a2c; --on-sun: #3b2a1f; --done: #2f4a2a; --done-ink: #b8e6a2; --edge: #151a1f;
    --shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.25);
    --sky1: #1b3a4f; --sky2: #2a4656; --sea: #1b4558; --shallow: #235b6b; --foam: #9cc7d1; --beach: #a8946c; --grass: #3d6a3a;
    --roof: #c46f5e; --door: #c99a2c; --wall: #e9dcc6; --leaf: #4f8a45; --rock: #6b6158;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body); font-weight: 700; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
}
body.logging { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-pop); font-weight: 600; margin: 0; }
p { margin: 0; line-height: 1.45; }
.muted { color: var(--ink-2); font-weight: 600; }
.small, small { font-size: 0.82rem; }
.center { text-align: center; }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--danger); font-weight: 700; }
.note { background: var(--card-2); border: 2px dashed var(--line); border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.dev-tag { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 99; background: #d92b2b; color: #fff; font: 700 0.72rem var(--font-pop); padding: 2px 10px; border-radius: 0 0 8px 8px; letter-spacing: 0.06em; }

/* ---------- header and tabs ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 50%; box-shadow: var(--shadow); background: var(--card); }
.brand-name { font: 600 1.3rem var(--font-pop); letter-spacing: 0.01em; }
.brand-name b { color: var(--coral); font-weight: 700; }
.me-btn { border: 0; background: var(--card); border-radius: 999px; min-height: 40px; min-width: 40px; padding: 3px; box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; }
.me-sign { padding: 0 12px; font: 600 0.95rem var(--font-pop); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 2px solid var(--line); box-shadow: 0 -4px 16px rgba(110, 74, 63, 0.06);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; font: 600 0.74rem var(--font-pop); color: var(--ink-2); }
.tabs a .tab-ico { font-size: 1.3rem; filter: grayscale(0.7); opacity: 0.75; transition: transform 0.15s; }
.tabs a.on { color: var(--ink); }
.tabs a.on .tab-ico { filter: none; opacity: 1; transform: translateY(-2px) scale(1.12); }
@media (min-width: 900px) {
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 560px; bottom: 14px; border-radius: 22px; border: 2px solid var(--line); height: var(--tab-h); padding: 0; }
}

.view { max-width: 720px; margin: 0 auto; outline: none; }
.page-title { font-size: 1.6rem; padding: 6px 16px 10px; }
.page-title.flat { padding: 0; }
.sec { font-size: 1.1rem; }
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.block { padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.month { font: 600 0.95rem var(--font-pop); color: var(--ink-2); padding: 14px 16px 6px; }

/* ---------- buttons, chips, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px;
  border: 0; border-radius: 999px; background: var(--card); color: var(--ink); font: 600 0.98rem/1.1 var(--font-pop);
  text-decoration: none; cursor: pointer; box-shadow: 0 3px 0 var(--edge), 0 4px 10px rgba(110, 74, 63, 0.08);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--sun); color: var(--on-sun); box-shadow: 0 3px 0 var(--sun-deep), 0 6px 14px rgba(227, 178, 60, 0.3); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 34px; padding: 6px 14px; font-size: 0.88rem; }
.btn.big { min-height: 56px; font-size: 1.08rem; }
.btn.wide { width: 100%; }
.btn.finish { background: var(--leaf-c); color: #fff; box-shadow: 0 3px 0 #5a9a3d; min-height: 38px; padding: 6px 18px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1 1 auto; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--card-2); }
.icon-btn.small { width: 30px; height: 30px; font-size: 0.85rem; }
.chev { font-size: 1.6rem; line-height: 0.6; display: block; transform: translateY(-4px); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; font: 600 0.88rem var(--font-pop); cursor: pointer; white-space: nowrap; color: var(--ink); }
.chip.on { background: var(--sun); border-color: var(--sun-deep); color: var(--on-sun); }
.chip.emoji { font-size: 1.25rem; padding: 4px 10px; }
.seg { display: inline-flex; background: var(--card-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg.big { display: flex; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; font: 600 0.95rem var(--font-pop); cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.field { width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 11px 13px; font-weight: 700; min-height: 46px; }
.field.big { font: 600 1.15rem var(--font-pop); }
.field:focus { outline: none; border-color: var(--focus); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--ink-2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-2); }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-line > span { font-family: var(--font-pop); font-weight: 600; }
.set-line .field { width: auto; min-width: 150px; min-height: 40px; padding: 7px 34px 7px 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.toggle span { display: flex; flex-direction: column; gap: 2px; }
.toggle small { color: var(--ink-2); font-weight: 600; }
.toggle input { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background 0.15s; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.15s; }
.toggle input:checked { background: var(--leaf-c); }
.toggle input:checked::after { transform: translateX(20px); }
.card { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.tag { display: inline-block; background: var(--card-2); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; color: var(--ink-2); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; background: var(--sun); color: var(--on-sun); font-family: var(--font-pop); font-weight: 700; }

/* ---------- hero (the island) ---------- */
.hero { position: relative; margin: 4px 16px 6px; border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); background: var(--card); }
.hero-art { position: relative; height: 128px; }
.hero-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.i-sky { fill: var(--sky1); } .i-sea { fill: var(--sea); } .i-foam { fill: none; stroke: var(--foam); stroke-width: 2; opacity: 0.8; }
.i-shallow { fill: var(--shallow); } .i-beach { fill: var(--beach); } .i-grass { fill: var(--grass); }
.i-wall { fill: var(--wall); stroke: var(--ink); stroke-width: 2; } .i-roof { fill: var(--roof); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.i-door { fill: var(--door); } .i-bell rect { fill: var(--ink); } .i-trunk { fill: none; stroke: #a9744f; stroke-width: 5; stroke-linecap: round; }
.i-leaf path { fill: var(--leaf); } .i-rock { fill: var(--rock); }
.cloud { position: absolute; width: 70px; opacity: 0.95; animation: drift 38s linear infinite; }
.cloud.c1 { top: 10px; left: -80px; }
.cloud.c2 { top: 34px; left: -80px; width: 48px; animation-duration: 55s; animation-delay: -20s; }
@keyframes drift { to { transform: translateX(calc(100vw + 160px)); } }
@media (prefers-reduced-motion: reduce) { .cloud { animation: none; left: 12% !important; } .cloud.c2 { left: 70% !important; } }
.hero-card { background: var(--card); margin-top: -16px; position: relative; border-radius: 22px 22px 0 0; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.hero-title { font: 600 1.3rem var(--font-pop); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.hero-top small { color: var(--ink-2); display: block; }
.big-num { font: 700 2rem/1 var(--font-pop); }
.big-num span { font-size: 1rem; color: var(--ink-2); font-weight: 600; }
.streak { display: flex; flex-direction: column; align-items: center; background: var(--card-2); border-radius: 16px; padding: 6px 12px; font-size: 1.1rem; line-height: 1.1; }
.streak b { font: 700 1.3rem var(--font-pop); }
.streak small { font-size: 0.7rem; color: var(--ink-2); }
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-dots .dot { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font: 600 0.8rem var(--font-pop); color: var(--ink-2); max-width: 40px; justify-self: center; width: 100%; }
.week-dots .dot.on { background: var(--sun); color: var(--on-sun); font-size: 1rem; }
.goal-bar { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--coral)); border-radius: 99px; transition: width 0.4s; }

/* ---------- routines ---------- */
.routines { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.routine { text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; min-height: 96px; box-shadow: 0 3px 0 var(--edge); }
.routine:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.r-name { font: 600 1rem var(--font-pop); }
.r-list { font-size: 0.82rem; color: var(--ink-2); font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.r-meta { font-size: 0.75rem; color: var(--ink-2); margin-top: auto; }
.r-who { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--ink-2); text-decoration: none; }
.r-who.big { font: 600 1rem var(--font-pop); color: var(--ink); }
.r-detail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.r-detail li { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.r-detail small { color: var(--ink-2); }

/* routine editor */
.ed-ex { background: var(--card-2); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.ed-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-pop); }
.ed-sets { display: flex; flex-direction: column; gap: 6px; }
.ed-set { display: grid; grid-template-columns: 26px 1fr 16px 1fr 30px; align-items: center; gap: 6px; }
.ed-set .num.wide { grid-column: 2 / 5; }
.ed-n { font: 600 0.9rem var(--font-pop); color: var(--ink-2); text-align: center; }
.x { text-align: center; color: var(--ink-2); }

/* ---------- logger ---------- */
.logger { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.lg-top { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 6px; gap: 8px; background: var(--card); border-bottom: 2px solid var(--line); }
.lg-clock { font: 700 1.15rem var(--font-pop); font-variant-numeric: tabular-nums; }
.lg-rest { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 8px 12px; background: var(--sun); color: var(--on-sun); position: relative; }
.lg-rest .rest-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.08); }
.lg-rest .rest-bar i { display: block; height: 100%; background: var(--coral); transition: width 0.5s linear; }
.lg-rest .chip { background: rgba(255, 255, 255, 0.6); border-color: transparent; }
.rest-time { font: 700 1.5rem var(--font-pop); text-align: center; font-variant-numeric: tabular-nums; }
.lg-scroll { flex: 1; overflow-y: auto; padding: 12px 12px calc(28px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; max-width: 720px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.lg-name { border: 0; background: transparent; font: 700 1.45rem var(--font-pop); padding: 2px 4px; border-radius: 10px; }
.lg-name:focus { background: var(--card); outline: none; }
.lg-meta { color: var(--ink-2); font-size: 0.85rem; padding: 0 4px; margin-top: -8px; }
.lg-notes, .ex-note { border: 2px dashed var(--line); background: transparent; border-radius: 12px; padding: 8px 10px; resize: none; font-weight: 600; min-height: 42px; line-height: 1.35; }
.lg-notes:focus, .ex-note:focus { outline: none; border-color: var(--focus); border-style: solid; }
.lg-empty { text-align: center; color: var(--ink-2); padding: 18px 0; }

.ex-card { background: var(--card); border-radius: 18px; padding: 8px 8px 6px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.ex-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 6px; }
.ex-title { border: 0; background: transparent; font: 600 1.05rem var(--font-pop); color: #d0705a; text-align: left; padding: 6px 0; cursor: pointer; }
@media (prefers-color-scheme: dark) { .ex-title { color: #ffb4a3; } }
.ex-rest { font-size: 0.8rem; color: var(--ink-2); padding: 0 6px 2px; }
.ex-note { margin: 2px 4px 6px; }
.grid { display: grid; align-items: center; gap: 6px; padding: 4px 4px; border-radius: 10px; }
.grid.c2 { grid-template-columns: 34px minmax(0, 1fr) 68px 58px 44px; }
.grid.c1 { grid-template-columns: 34px minmax(0, 1fr) 96px 44px; }
.grid.head { font: 600 0.72rem var(--font-pop); color: var(--ink-2); letter-spacing: 0.04em; text-align: center; padding-bottom: 0; }
.grid.head span:nth-child(2) { text-align: left; padding-left: 4px; }
.set { transition: background 0.15s; }
.set.done { background: var(--done); }
.set-n { border: 0; background: var(--card-2); border-radius: 8px; height: 32px; font: 700 0.95rem var(--font-pop); cursor: pointer; }
.set-n.t-w { color: #d08a1f; } .set-n.t-d { color: #8a5fc9; } .set-n.t-f { color: var(--danger); }
.set.done .set-n { background: rgba(255, 255, 255, 0.5); }
.prev { border: 0; background: transparent; color: var(--ink-2); font-weight: 700; font-size: 0.86rem; text-align: left; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; height: 32px; }
.prev:disabled { cursor: default; }
.num { width: 100%; height: 36px; border: 0; background: var(--card-2); border-radius: 9px; text-align: center; font: 700 1rem var(--font-body); padding: 0 4px; font-variant-numeric: tabular-nums; }
.num::placeholder { color: color-mix(in srgb, var(--ink-2) 65%, transparent); }
.num:focus { outline: 2px solid var(--focus); background: var(--card); }
.set.done .num { background: rgba(255, 255, 255, 0.55); color: var(--done-ink); }
@media (prefers-color-scheme: dark) { .set.done .num, .set.done .set-n { background: rgba(0, 0, 0, 0.2); } }
.check { border: 0; height: 34px; border-radius: 10px; background: var(--card-2); color: var(--ink-2); font-size: 1.1rem; font-weight: 900; cursor: pointer; }
.set.done .check { background: var(--leaf-c); color: #fff; }
.add-set { border: 0; background: var(--card-2); border-radius: 10px; margin: 4px 4px 2px; min-height: 36px; font: 600 0.9rem var(--font-pop); cursor: pointer; color: var(--ink); }

.live-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 25; display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 16px; background: var(--ink); color: var(--bg); padding: 12px 16px; font: 600 1rem var(--font-pop); box-shadow: var(--shadow); cursor: pointer; max-width: 700px; margin: 0 auto;
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--leaf-c); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.live-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-time, .live-rest { font-variant-numeric: tabular-nums; }
.live-rest { background: var(--sun); color: var(--on-sun); border-radius: 999px; padding: 2px 10px; }

/* plate calculator */
.bar-pic { display: flex; align-items: center; gap: 3px; height: 110px; padding: 8px 0; overflow-x: auto; }
.bar-end { width: 14px; height: 30px; background: #b9b2aa; border-radius: 3px; flex: none; }
.bar-shaft { flex: 1; min-width: 40px; height: 10px; background: #cfc8bf; border-radius: 4px; }
.plate { width: 24px; border-radius: 5px; display: grid; place-items: center; font: 700 0.62rem var(--font-pop); color: #fff; writing-mode: vertical-rl; flex: none; background: #888; }
.plate.p25, .plate.p45 { background: #d64545; } .plate.p20, .plate.p35 { background: #3d6fd6; } .plate.p15 { background: #e0b12f; }
.plate.p10 { background: #3e9a52; } .plate.p5 { background: #f0f0f0; color: #555; } .plate.p2_5 { background: #444; } .plate.p1_25 { background: #999; }
.plates-text { font: 600 1.05rem var(--font-pop); }

/* ---------- exercise lists ---------- */
.ex-list { display: flex; flex-direction: column; }
.view > .ex-list { padding: 8px 16px; }
.ex-row { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 10px 6px; text-align: left; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; }
.ex-row.on { background: var(--done); border-radius: 12px; }
.ex-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--card-2); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.ex-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ex-txt small { color: var(--ink-2); }
.tick { opacity: 0; color: var(--done-ink); font-weight: 900; }
.ex-row.on .tick { opacity: 1; }
.chev-r { color: var(--ink-2); font-size: 1.4rem; }
.rec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.rec { background: var(--card-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rec span { font-size: 0.78rem; color: var(--ink-2); }
.rec b { font: 700 1.25rem var(--font-pop); }
.rec small { color: var(--ink-2); }
.chart-wrap { display: flex; flex-direction: column; gap: 8px; }
.chart { width: 100%; height: auto; background: var(--card-2); border-radius: 14px; }
.chart .grid { stroke: var(--line); stroke-dasharray: 4 4; padding: 0; }
.chart .line { fill: none; stroke: var(--coral); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--card); stroke: var(--coral); stroke-width: 2.5; }
.chart .axis { fill: var(--ink-2); font: 600 10px var(--font-body); }

/* ---------- history ---------- */
.w-card { display: flex; flex-direction: column; gap: 6px; width: calc(100% - 32px); margin: 0 16px 10px; text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 18px; padding: 12px 14px; cursor: pointer; box-shadow: 0 3px 0 var(--edge); }
.w-head { display: flex; justify-content: space-between; gap: 10px; font: 600 1.05rem var(--font-pop); }
.pr-badge { background: var(--sun); color: var(--on-sun); border-radius: 999px; padding: 1px 9px; font-size: 0.85rem; }
.w-meta { font-size: 0.8rem; color: var(--ink-2); }
.w-ex { display: flex; flex-direction: column; gap: 2px; font-size: 0.88rem; }
.w-ex-row { display: flex; justify-content: space-between; gap: 10px; }
.w-best { color: var(--ink-2); white-space: nowrap; }
.hist-sess { background: var(--card-2); border-radius: 14px; padding: 10px 12px; }
.hist-sess-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-family: var(--font-pop); }
.hist-sess-head small { color: var(--ink-2); font-family: var(--font-body); }
.hist-sets { margin: 6px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.hist-sets li.t-w { color: var(--ink-2); }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card-2); border-radius: 14px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.stat b { font: 700 1.2rem var(--font-pop); }
.stat span { font-size: 0.75rem; color: var(--ink-2); }
.sum-hero { text-align: center; padding: 6px 0; }
.sum-big { font: 700 1.6rem var(--font-pop); }
.sum-name { color: var(--ink-2); }
.pr-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pr-list li { background: var(--card-2); border-radius: 12px; padding: 8px 10px; }
.pr-list small { color: var(--ink-2); }

/* ---------- boards and guilds ---------- */
.board { display: flex; flex-direction: column; gap: 8px; padding: 6px 16px 14px; }
.b-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 16px; padding: 10px 12px; text-decoration: none; box-shadow: var(--shadow); }
.b-row.me { outline: 3px solid var(--sun); }
.medal { width: 32px; text-align: center; font: 700 1rem var(--font-pop); color: var(--ink-2); flex: none; }
.medal.m1, .medal.m2, .medal.m3 { font-size: 1.5rem; }
.b-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.b-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-name small { color: var(--ink-2); }
.b-score { display: flex; flex-direction: column; align-items: flex-end; font: 700 1.35rem/1 var(--font-pop); }
.b-score small { font: 600 0.7rem var(--font-body); color: var(--ink-2); }
.g-emoji { font-size: 1.6rem; width: 40px; text-align: center; flex: none; }
.g-emoji.big { font-size: 2rem; }
.g-emoji.huge { font-size: 3rem; width: auto; }
.guilds { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.g-card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 12px 14px; text-decoration: none; box-shadow: var(--shadow); }
.g-hero { display: flex; gap: 14px; align-items: center; padding: 6px 16px 12px; }
.g-hero small { color: var(--ink-2); }
.join-card, .empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 24px; }
.empty-ico { font-size: 3rem; }
.c-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 16px 16px; text-align: center; }
.c-hero .btn { margin: 0 4px; }

/* ---------- sheets, menus, toast ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(60, 40, 30, 0.35); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.18s; }
.sheet-wrap.open { opacity: 1; }
.sheet-wrap.closing { opacity: 0; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 26px 26px 0 0; display: flex; flex-direction: column;
  transform: translateY(30px); transition: transform 0.2s ease; box-shadow: 0 -8px 30px rgba(60, 40, 30, 0.2);
  padding-bottom: var(--safe-b);
}
.sheet.tall { height: 88vh; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 4px 20px; }
.sheet-head h2 { font-size: 1.25rem; }
.sheet-body { overflow-y: auto; padding: 8px 20px 16px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 10px 20px 14px; display: flex; gap: 10px; border-top: 2px solid var(--line); background: var(--card); }
.sheet-foot > .btn { flex: 1; }
.sheet-foot > .stack { flex: 1; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 26px; max-height: 84vh; }
  .sheet.tall { height: 80vh; }
}
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item { display: flex; align-items: center; gap: 12px; border: 0; background: var(--card); border-radius: 14px; padding: 12px 14px; text-align: left; cursor: pointer; font-weight: 700; }
.menu-item.danger { color: var(--danger); }
.menu-ico { width: 26px; text-align: center; font-family: var(--font-pop); font-weight: 700; }
.me-row { display: flex; align-items: center; gap: 12px; }
.me-row > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.me-name { font: 600 1.2rem var(--font-pop); }
.provider { justify-content: flex-start; padding-left: 22px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 70px); transform: translate(-50%, 10px); z-index: 120; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.logging .toast { bottom: calc(24px + var(--safe-b)); }

/* small phones (iPhone SE 1st gen: 320 px) */
@media (max-width: 360px) {
  .grid.c2 { grid-template-columns: 30px minmax(0, 1fr) 58px 50px 40px; gap: 4px; }
  .brand-name { font-size: 1.1rem; }
  .routines { grid-template-columns: 1fr 1fr; }
}
