:root {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --border: #e2e4ee;
  --text: #16172b;
  --text-2: #55586f;
  --muted: #8a8da3;
  --accent: #a9c9ee;
  --accent-ink: #16172b;
  --accent-soft: #e3eefb;
  /* Accent used as text on light surfaces; the light accent itself is too pale to read. */
  --accent-text: #3f6fb5;
  --danger: #c62845;
  --good: #1c8a4c;
  --grid: #e7e8f0;
  --shadow: 0 1px 2px rgba(20, 20, 50, .06), 0 4px 16px rgba(20, 20, 50, .06);
  --radius: 16px;
  --tabbar-h: 60px;
  --tabbar-gap: 12px;
  --tabbar-bg: rgba(255, 255, 255, .86);
  --tab-active-bg: #ebebef;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f1a;
    --surface: #181a2a;
    --surface-2: #22253a;
    --border: #2c2f47;
    --text: #eceefa;
    --text-2: #b0b3cc;
    --muted: #7d819c;
    --accent: #a9c9ee;
    --accent-ink: #0e0f1a;
    --accent-soft: #23324b;
    --accent-text: #a9c9ee;
    --danger: #ff6b86;
    --good: #4ccf87;
    --grid: #262940;
    --shadow: none;
    --tabbar-bg: rgba(24, 26, 42, .86);
    --tab-active-bg: #2f3249;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f1a;
  --surface: #181a2a;
  --surface-2: #22253a;
  --border: #2c2f47;
  --text: #eceefa;
  --text-2: #b0b3cc;
  --muted: #7d819c;
  --accent: #a9c9ee;
  --accent-ink: #0e0f1a;
  --accent-soft: #23324b;
  --accent-text: #a9c9ee;
  --danger: #ff6b86;
  --good: #4ccf87;
  --grid: #262940;
  --shadow: none;
  --tabbar-bg: rgba(24, 26, 42, .86);
  --tab-active-bg: #2f3249;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.01em; }

main { padding: 4px 16px calc(var(--tabbar-h) + var(--tabbar-gap) + var(--safe-b) + 24px); outline: none; }
/* Line icons (see ICONS in app.js): same stroke style as the tab bar, sized by context below. */
.ico {
  width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.ico .fill { fill: currentColor; stroke: none; }
.btn .ico { width: 20px; height: 20px; }
.icon-btn, .start-btn { display: grid; place-items: center; }
.icon-btn .ico { width: 24px; height: 24px; stroke-width: 1.8; }
.start-btn .ico { width: 22px; height: 22px; stroke-width: 1.8; }
.del .ico { width: 20px; height: 20px; }
.ladder .ico { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.seg button .ico { width: 17px; height: 17px; vertical-align: -3px; }
.menu .ico { width: 18px; height: 18px; }
.meta .ico { width: 15px; height: 15px; vertical-align: -2px; }
.empty .big .ico { width: 56px; height: 56px; stroke-width: 1.3; color: var(--accent-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- bottom tab bar ---- */
/* Floating, fully rounded bar with line icons; the active tab's icon is filled. */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 10;
  bottom: calc(var(--safe-b) + var(--tabbar-gap));
  width: min(528px, calc(100% - 32px)); height: var(--tabbar-h);
  display: flex; align-items: center; justify-content: space-around;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 8px 28px rgba(20, 20, 50, .12);
}
.tabbar a {
  flex: 1; height: 100%;
  display: grid; place-items: center;
  color: var(--text); text-decoration: none;
}
/* Gray pill behind the active icon. */
.tabbar a > * { grid-area: 1 / 1; }
.tabbar a::before {
  content: ""; grid-area: 1 / 1; width: 68px; height: 44px; border-radius: 999px;
  background: var(--tab-active-bg); opacity: 0; transform: scale(.8);
  transition: opacity .15s, transform .15s;
}
.tabbar a.active::before { opacity: 1; transform: none; }
.tabbar svg { position: relative; }
.tabbar svg {
  width: 27px; height: 27px; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s;
}
.tabbar a:active svg { transform: scale(.88); }
.tabbar .dot, .tabbar .solid { fill: currentColor; }
.tabbar .knock { fill: none; stroke: var(--tab-active-bg); stroke-width: 1.8; }
.tabbar .knock-dot { fill: var(--tab-active-bg); stroke: none; }
.tabbar .ico-fill { display: none; }
.tabbar a.active .ico-line { display: none; }
.tabbar a.active .ico-fill { display: inline; }

/* ---- recording screen (full screen while a timer runs) ---- */
#focus {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: env(safe-area-inset-top, 0px) 24px env(safe-area-inset-bottom, 0px);
}
body.focus-open { overflow: hidden; }
.focus-emoji {
  width: 120px; height: 120px; border-radius: 36px; display: grid; place-items: center; font-size: 4rem;
  background: color-mix(in srgb, var(--c) 22%, var(--surface));
}
.focus-name { font-size: 1.5rem; margin-top: 20px; }
.focus-time { font-size: 4.5rem; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 40px; }
.focus-time.paused { opacity: .45; animation: pulse 1.6s infinite; }
.focus-actions { display: flex; gap: 48px; }
.focus-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; font-size: .9rem; cursor: pointer;
}
.focus-circle { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; }
.focus-circle .ico { width: 30px; height: 30px; stroke-width: 1.8; }
.focus-btn.break .focus-circle { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.focus-btn.stop .focus-circle { background: var(--c); color: var(--c-ink); }
.focus-btn:active .focus-circle { transform: scale(.94); }

/* ---- generic ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 12px; }
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--accent-text); padding: 0 10px; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }

label.field { display: block; }
.field > .field-label, label.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-text); }
textarea { min-height: 72px; resize: vertical; }
select[name="preset"]:not([hidden]) + input[name="name"] { margin-top: 8px; }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--accent)); }

.tier-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: var(--accent-soft); color: var(--text);
}

/* ---- hobby cards ---- */
.hobby-card { display: block; text-decoration: none; color: inherit; }
.hobby-card.row { display: flex; }
.hobby-emoji {
  width: 52px; height: 52px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.7rem;
  background: color-mix(in srgb, var(--c) 18%, var(--surface));
}
.hobby-card h3 { font-size: 1.05rem; }
.meta { display: flex; justify-content: space-between; margin: 10px 0 6px; font-size: .8rem; color: var(--text-2); }
.start-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--c); color: var(--c-ink, #fff); font-size: 1.1rem;
}
/* Secondary "log time" button next to the timer button: a soft tint of the hobby color. */
.start-btn.soft { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--text); }
.card-actions { display: flex; gap: 8px; flex: none; }
@keyframes pulse { 50% { opacity: .55; } }

.empty { text-align: center; padding: 48px 16px; }
.empty .big { font-size: 3rem; }

/* ---- hobby detail ---- */
.hero { text-align: center; padding: 20px 16px; }
.hero .hobby-emoji { width: 72px; height: 72px; font-size: 2.4rem; margin: 0 auto 10px; border-radius: 20px; }
.hero .hours { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.ladder { list-style: none; margin: 0; padding: 0; }
.ladder li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--border); color: var(--muted); }
.ladder li:last-child { border-bottom: 0; }
.ladder li.done { color: var(--text-2); }
.ladder li.current { color: var(--text); font-weight: 700; }
.session-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.session-row:last-child { border-bottom: 0; }
.session-row .del { border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 8px; }

/* ---- stats ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.tiles:has(> .tile:nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
.quick-add { display: flex; gap: 8px; }
.quick-add .btn { flex: 1; padding: 0; min-height: 40px; }
.tile { text-align: center; padding: 14px 8px; }
.tile .v { font-size: 1.5rem; font-weight: 800; }
.tile .l { font-size: .75rem; color: var(--muted); font-weight: 600; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 0; border-radius: 9px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.period-nav { display: flex; align-items: center; margin: 10px -6px 4px; }
.period-nav .icon-plain { margin: 0; border: 0; background: none; cursor: pointer; }
.period-nav .icon-plain:disabled { opacity: .25; cursor: default; }
.period-nav .line-ico { width: 22px; height: 22px; }
.period-label { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.25; }
.period-label span { font-size: .75rem; color: var(--muted); min-height: 1em; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
/* Small pill-shaped hobby filter. */
.pill-select { position: relative; display: inline-flex; min-width: 0; max-width: 70%; }
.pill-select select {
  appearance: none; -webkit-appearance: none; width: auto; max-width: 100%; min-height: 30px;
  padding: 4px 28px 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill-select .line-ico { position: absolute; right: 9px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); pointer-events: none; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .bar { pointer-events: none; }
/* A thin surface-colored outline separates stacked hobby segments. */
.chart .seg { stroke: var(--surface); stroke-width: 1.5; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .bar.hl { opacity: .75; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; font-size: .78rem; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i, .tip-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.tip-row b { margin-left: auto; padding-left: 12px; }
.chart-tip {
  position: fixed; z-index: 30; pointer-events: none;
  background: var(--text); color: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: .8rem;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}

/* ---- profile ---- */
.icon-plain { width: 44px; height: 44px; display: grid; place-items: center; margin-right: -8px; color: var(--text); border-radius: 50%; }
.icon-plain:active { background: var(--surface-2); }
.line-ico { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; background: var(--accent-soft); margin: 0 auto 10px; }
.profile-head { display: flex; align-items: center; gap: 20px; margin: 8px 0 16px; }
.profile-head .avatar { flex: none; margin: 0; }
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-tag { color: var(--text-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats { display: flex; gap: 20px; margin-top: 10px; }
.profile-stats > * { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.profile-stats .top { flex: 1; }
.profile-stats b { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats span { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge { text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.badge .be { font-size: 1.8rem; }
.badge .be .ico { width: 30px; height: 30px; stroke-width: 1.5; }
.badge .bn { font-size: .78rem; font-weight: 700; margin-top: 4px; }
.badge .bd { font-size: .68rem; color: var(--muted); }
/* Earned badges sit on the brand blue; locked ones stay plain and faded. */
.badge.earned { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.badge.earned .bd { color: var(--accent-ink); opacity: .75; }
.badge.locked .be { filter: grayscale(1); opacity: .35; }
.badge.locked .bn { color: var(--muted); }
.menu { padding: 0; }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 16px; border: 0; background: none; border-bottom: 1px solid var(--border); cursor: pointer; text-align: left; }
.menu button:last-child { border-bottom: 0; }
.menu button.danger { color: var(--danger); }

/* ---- new hobby: category + preset steps ---- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cat-grid button, .preset-grid button {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 14px; cursor: pointer; color: var(--text);
}
.cat-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 2px 10px; font-size: .75rem; font-weight: 600; }
.cat-grid .ce { line-height: 0; }
.cat-grid .ce .ico { width: 28px; height: 28px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset-grid button { display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; font-weight: 600; min-height: 56px; }
.preset-grid .ce { font-size: 1.5rem; }
.preset-grid .ce .ico { width: 24px; height: 24px; vertical-align: middle; }
.preset-grid small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); }
.cat-grid button:active, .preset-grid button:active { transform: scale(.97); }
.modal-head .back { padding: 0 10px 0 0; min-height: 36px; color: var(--text); }
.modal-head .back .ico { width: 22px; height: 22px; }
.modal-head .grow { flex: 1; }
.cat-pill .ico { width: 14px; height: 14px; vertical-align: -2px; }
.cat-pill { display: inline-block; margin-bottom: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); }

/* ---- friends & ranking ---- */
.friends-pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .85rem; text-decoration: none;
}
.friends-pill .ico { width: 18px; height: 18px; }
.friends-pill .dot { position: absolute; top: 0; right: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
/* "Me ▾" switcher at the top of Statistics. */
.who-switch { display: flex; justify-content: center; margin: 0 0 14px; }
.who-pill {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 14px 6px 6px; border-radius: 999px; cursor: pointer;
  border: 0; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: .95rem;
}
.who-pill .who-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 1.05rem; }
.who-pill .line-ico { width: 16px; height: 16px; }
.who-list .person-row { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.who-list .person-row:last-child { border-bottom: 0; }
.who-list { padding: 0; }
.picked { color: var(--accent-text); display: grid; }
.picked .ico { width: 22px; height: 22px; stroke-width: 2; }
.at-input { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding-left: 12px; }
.at-input:focus-within { border-color: var(--accent-text); }
.at-input > span { color: var(--muted); font-weight: 700; }
.at-input input { border: 0; background: transparent; padding-left: 4px; }
.people { padding: 4px 16px; }
.people > p { margin: 12px 0; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.person-row:last-child { border-bottom: 0; }
.person-row.me { background: var(--accent-soft); margin: 0 -10px; padding: 10px; border-radius: 12px; border-bottom-color: transparent; }
.mini-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--accent-soft); }
.person-row.me .mini-avatar { background: var(--surface); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b, .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: .8rem; color: var(--text-2); }
.who .you-tag { margin-left: 6px; color: var(--accent-ink); overflow: visible; padding: 1px 8px; border-radius: 999px; font-size: .68rem; background: var(--accent); color: var(--accent-ink); vertical-align: 2px; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: .85rem; }
.icon-round { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-round .ico { width: 18px; height: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .85rem;
}
.chip .ico { width: 17px; height: 17px; }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.rank { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface-2); color: var(--text-2); }
/* Podium colors for the top three. */
.rank.r1 { background: #f5c542; color: #3b2f00; }
.rank.r2 { background: #cfd6df; color: #2b3440; }
.rank.r3 { background: #e0a36b; color: #3a2210; }
.person-row .amount { flex: none; }

/* ---- pickers ---- */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 10px; background: var(--surface-2); font-size: 1.3rem; cursor: pointer; padding: 0; }
.emoji-grid button.on { border-color: var(--accent-text); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); outline: 2px solid transparent; cursor: pointer; }
.swatches button.on { outline-color: var(--text); }

/* ---- modal ---- */
dialog {
  width: min(560px, 100%); max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(8, 8, 20, .5); }
dialog[open] { animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.modal-body { padding: 20px 16px calc(20px + var(--safe-b)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 1.2rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ---- auth ---- */
.auth { padding-top: 8vh; }
.auth .logo { display: block; width: 88px; height: 88px; margin: 0 auto; border-radius: 22px; box-shadow: var(--shadow); }
.auth h2 { text-align: center; font-size: 1.9rem; margin: 8px 0 4px; }
.auth p.tag { text-align: center; color: var(--text-2); margin: 0 0 28px; }

#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); transform: translate(-50%, -120%);
  z-index: 60; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: .9rem; transition: transform .25s, visibility .25s; max-width: calc(100% - 32px); visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; }

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