:root {
  --font: Helvetica, "Helvetica Neue", Arial, sans-serif;
  --ink: #111111;
  --muted: #6b6f74;
  --line: #e2e2df;
  --paper: #ffffff;
  --panel: rgba(255, 255, 255, 0.96);
  --soft: #f4f4f2;
  --red: #d52b1e;
  --red-dark: #a8241a;
  --green: #1d7a46;
  --gold: #d6a520;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
small { font-size: 0.85em; }
a { color: var(--ink); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }

button, select, input { font: inherit; color: inherit; }
button {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 0;
  line-height: 1.2;
}
button:hover { background: var(--soft); }
button.on { background: var(--ink); color: var(--paper); }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
button.danger { color: var(--red); border-color: var(--red); }
button.danger:hover { background: #fbeceb; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
button svg, .icon svg { width: 14px; height: 14px; fill: currentColor; }
button.wide { width: 100%; margin: 6px 0; }
button.small { padding: 2px 8px; }
select {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 4px 6px;
  border-radius: 0;
  cursor: pointer;
}

.panel { background: var(--panel); box-shadow: var(--shadow); }

.home { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(#5b95cf, #c4d8e8 60%); }
.home-backdrop { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; display: flex; align-items: center; justify-content: flex-end; }
.home-backdrop.ready, .home-backdrop.static { opacity: 1; }
.home-backdrop .hero-figure { width: min(46vw, 620px); margin-right: 6vw; }
.home-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 60%); pointer-events: none; }
.home-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 460px;
  max-width: 100%;
  overflow: auto;
  padding: 44px 40px 40px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}
.home-panel.wide { width: min(1000px, 100%); }
.home-head { display: flex; align-items: center; gap: 16px; padding-bottom: 22px; border-bottom: 2px solid var(--ink); margin-bottom: 26px; }
.mark { width: 44px; height: 44px; background: var(--red); position: relative; flex: none; }
.mark::before, .mark::after { content: ""; position: absolute; background: #fff; }
.mark::before { left: 18px; top: 9px; width: 8px; height: 26px; }
.mark::after { left: 9px; top: 18px; width: 26px; height: 8px; }
.home-title h1 { font-size: 32px; line-height: 1; }
.home-title p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.home-panel .lead { font-size: 16px; line-height: 1.5; margin: 0 0 26px; color: #333; }
.menu { display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 16px 14px;
  font-size: 22px;
  font-weight: 700;
  position: relative;
}
.menu-item::after { content: ""; position: absolute; right: 16px; top: 50%; width: 10px; height: 10px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translateY(-50%) rotate(45deg); opacity: 0.4; }
.menu-item:hover::after { opacity: 1; }
.menu-item small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.menu-item.primary { background: var(--red); color: #fff; border-color: var(--red); }
.menu-item.primary:hover { background: var(--red-dark); }
.view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.view-head h2 { font-size: 24px; }
.back { padding: 6px 12px; }
.back::before { content: ""; display: inline-block; width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 8px; }
.step { margin-bottom: 26px; }
.step h3, .setting h3, .home-view > h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 0 0 10px; }
.home-view > h3 { margin-top: 22px; }
.step h3 span { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; background: var(--ink); color: #fff; font-size: 13px; }
.profile.on, .city-pick.on, .slot-pick.on { outline: 3px solid var(--red); outline-offset: -3px; }
.profile .desc { color: var(--muted); font-size: 12px; }
.profile.on .desc { color: inherit; }
.city-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.city-pick, .slot-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 10px 12px; }
.city-pick b, .slot-pick b { font-size: 15px; }
.city-pick span, .slot-pick span { color: var(--muted); font-size: 12px; }
.slot-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
button.large { font-size: 17px; padding: 14px 28px; }
.slots { display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.slot { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.slot-n { font-size: 26px; font-weight: 700; color: var(--red); }
.slot.empty .slot-n { color: var(--line); }
.slot-body { display: flex; flex-direction: column; gap: 3px; }
.slot-body b { font-size: 16px; }
.slot-body small { font-size: 11px; }
.slot-actions { display: flex; flex-direction: column; gap: 6px; }
.setting { padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting .segment { margin: 0; }
.setting .segment button { padding: 8px 4px; font-size: 12px; }
.steps { padding: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 40px; line-height: 1.5; font-size: 14px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; font-weight: 700; font-size: 20px; color: var(--red); }
.board { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.board li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }

.game { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(#5b95cf, #c4d8e8 55%); }
#stage, .view { position: absolute; inset: 0; width: 100%; height: 100%; }
.view { display: block; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.label {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9), 0 1px 1px rgba(0, 0, 0, 0.8);
}
.label.q { font-size: 14px; letter-spacing: 0.02em; }
.label.own { color: #fff; background: var(--red); padding: 1px 5px; text-shadow: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; z-index: 3; pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
.crosshair::before { left: 6px; top: 0; width: 2px; height: 14px; }
.crosshair::after { top: 6px; left: 0; height: 2px; width: 14px; }

.topbar { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; align-items: center; gap: 16px; padding: 6px 10px; z-index: 5; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.topbar .brand::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--red); margin-right: 7px; }
.stats { display: contents; }
.stat { display: flex; flex-direction: column; line-height: 1.15; min-width: 72px; }
.stat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spacer { flex: 1; }
.speed { display: flex; gap: 4px; }

.search { position: absolute; left: 8px; top: 64px; width: 320px; z-index: 5; padding: 6px; }
.search input { width: 100%; border: 1px solid var(--ink); padding: 7px 8px; outline: none; border-radius: 0; background: #fff; }
.search input:focus { border-color: var(--red); }
#searchResults button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); padding: 6px; }
#searchResults small, .none { color: var(--muted); }
.none { padding: 6px; }

.sidebar { position: absolute; left: 8px; top: 112px; bottom: 244px; width: 320px; z-index: 4; display: flex; flex-direction: column; }
.tabs { display: flex; border-bottom: 1px solid var(--ink); }
.tabs button { flex: 1 1 auto; border: 0; padding: 8px 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tabs .count { display: inline-block; min-width: 15px; padding: 1px 3px; background: var(--red); color: #fff; font-size: 9px; }
.tab-body { flex: 1; overflow: auto; padding: 10px; }
.tab-body h4, .info h4 { font-size: 12px; margin: 6px 0; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; }
.row > span:first-child { color: var(--muted); }
.note { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.item { display: block; width: 100%; text-align: left; padding: 8px; margin-bottom: 6px; border: 1px solid var(--line); background: #fff; }
.item:hover { border-color: var(--ink); background: #fff; }
.item.static { cursor: default; }
.item.line { padding: 2px 8px; margin-bottom: 2px; }
.item.current { border-color: var(--red); }
.item .flag { margin-left: 6px; font-size: 11px; color: var(--red); }
.news { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.4; }
.news .date { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.spark { display: block; width: 100%; height: 50px; margin-top: 8px; background: var(--soft); }
.spark polyline { fill: none; stroke: var(--red); stroke-width: 2; vector-effect: non-scaling-stroke; }
.caption { font-size: 10px; color: var(--muted); margin: 2px 0 6px; }
.meter { height: 4px; background: var(--line); margin: 2px 0 8px; }
.meter i { display: block; height: 100%; background: var(--red); }
.segment { display: flex; gap: 0; margin: 6px 0; }
.segment button { flex: 1; padding: 5px 2px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.segment button + button { border-left: 0; }
.check { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; line-height: 1.4; cursor: pointer; margin-top: 8px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.card { border: 1px solid var(--ink); padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.card span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.card b { font-size: 16px; font-variant-numeric: tabular-nums; }
.card small { color: var(--muted); }
.cards.small .card { padding: 6px; }
.cards.small .card b { font-size: 12px; }

.info { position: absolute; right: 8px; top: 64px; width: 340px; max-height: calc(100% - 372px); overflow: auto; z-index: 5; padding: 14px; }
.info h2 { font-size: 17px; line-height: 1.25; margin-right: 34px; }
.info .sub { color: var(--muted); font-size: 12px; margin: 3px 0 8px; }
.info .close { position: absolute; right: 10px; top: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 2px 6px; font-size: 10px; border: 1px solid var(--ink); text-transform: uppercase; letter-spacing: 0.05em; }
.tag.accent { background: var(--red); border-color: var(--red); color: #fff; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.actions button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.actions button small { opacity: 0.75; }
.actions button.primary { grid-column: 1 / -1; align-items: center; padding: 10px; font-weight: 700; }
.slider { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.slider input { flex: 1; accent-color: var(--red); }

.wiki { margin-top: 12px; border-top: 2px solid var(--ink); padding-top: 10px; }
.kind { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--red); margin-bottom: 8px; }
.wiki-photo { margin: 0; }
.wiki-photo img { display: block; width: 100%; height: 190px; object-fit: cover; background: var(--soft); }
.wiki-photo figcaption { font-size: 10px; margin-top: 4px; }
.wiki-photo figcaption a { color: var(--muted); text-decoration: none; }
.wiki-photo figcaption a:hover { text-decoration: underline; }
.thumbs { display: flex; gap: 6px; margin-top: 6px; }
.thumb { padding: 0; width: 56px; height: 40px; border: 1px solid var(--line); overflow: hidden; }
.thumb.on { border: 2px solid var(--red); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wiki p { line-height: 1.5; margin: 10px 0; }
.wiki-link { font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--red); }

.mini { position: absolute; left: 8px; bottom: 8px; z-index: 4; padding: 4px; }
.mini canvas { display: block; width: 210px; height: 228px; image-rendering: pixelated; cursor: crosshair; }
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; z-index: 4; padding: 6px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tools { position: absolute; right: 8px; bottom: 8px; z-index: 4; display: flex; gap: 4px; padding: 4px; }
.tools button { font-size: 11px; padding: 5px 9px; }
.nav { position: absolute; right: 8px; bottom: 56px; z-index: 4; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; user-select: none; -webkit-user-select: none; }
.nav .pad { display: grid; grid-template-columns: repeat(3, 32px); gap: 3px; }
.nav .pad.two { grid-template-columns: repeat(2, 32px); }
.nav .pad button { width: 32px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }
.compass { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.compass svg { width: 22px; height: 22px; }

.toasts { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); z-index: 9; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 9px 14px; font-size: 13px; max-width: 520px; border-left: 4px solid var(--ink); animation: fade 4.5s forwards; }
.toast.neg { border-left-color: var(--red); }
.toast.pos { border-left-color: var(--green); }
@keyframes fade {
  0% { opacity: 0; transform: translateY(-6px); }
  8% { opacity: 1; transform: none; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.loading { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--paper); }
.loading .brand { font-weight: 700; font-size: 26px; }
.loading .bar { width: 280px; height: 4px; background: var(--line); }
.loading .bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width 0.2s; }
#loadText { color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(17, 17, 17, 0.55); display: flex; align-items: center; justify-content: center; }
.modal-box { max-width: 720px; width: calc(100% - 32px); max-height: calc(100% - 32px); overflow: auto; padding: 28px; background: var(--paper); }
.modal-box h1 { font-size: 28px; margin-bottom: 6px; }
.modal-box h3 { font-size: 14px; margin: 16px 0 6px; }
.modal-box .lead { color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.modal-box ul { padding-left: 18px; line-height: 1.55; }
.buttons { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.profiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.profile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 16px; line-height: 1.4; }
.profile b { font-size: 17px; }
.profile:hover { background: var(--ink); color: #fff; }
.profile:hover .muted { color: #c9c9c6; }
.profile .figure { width: 56px; height: 56px; color: var(--ink); }
.profile:hover .figure { color: #fff; }

.floater {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
.floater.income { color: #9be3b4; }
.floater.event { font-size: 15px; background: var(--red); padding: 2px 7px; text-shadow: none; }

.toast.goal { display: flex; flex-direction: column; gap: 2px; border-left-color: var(--gold); animation-duration: 5s; }
.toast.goal small { color: var(--muted); }
.toast.goal.big { padding: 14px 20px; border-left-width: 6px; }
.toast.goal.big b { font-size: 20px; }

.title-card { display: flex; align-items: center; gap: 12px; margin: 6px 0 8px; }
.title-rank { width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--ink); color: #fff; font-weight: 700; font-size: 18px; }
.title-card b { display: block; font-size: 16px; }
.title-card small { color: var(--muted); }
.goal { padding: 6px 0 8px; border-bottom: 1px solid var(--line); }
.goal small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.goal .reward { color: var(--green); margin-top: 2px; }
.goal.complete b { color: var(--green); }
.goal .meter { margin-bottom: 4px; }

.tag.rival { background: #5b54c7; border-color: #5b54c7; color: #fff; }
.row.you > span { color: var(--red); font-weight: 700; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 16px; line-height: 1.4; }
.choice b { font-size: 16px; }
.choice span { color: var(--muted); }
.choice:hover { background: var(--ink); color: #fff; }
.choice:hover span { color: #c9c9c6; }
.check.option { margin-top: 16px; padding: 12px; border: 1px solid var(--line); font-size: 13px; }
.check.option input { margin-top: 3px; }
.timer { height: 6px; margin: 4px 0 10px; }
.timer i { transition: width 0.25s linear; }
.auction-log { min-height: 92px; font-size: 13px; line-height: 1.6; }
.auction-log div:first-child { font-weight: 700; }

.coach { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.coach-ring { position: absolute; border: 3px solid var(--red); box-shadow: 0 0 0 9999px rgba(17, 17, 17, 0.32); transition: all 0.25s ease; pointer-events: none; }
.coach-box { position: absolute; width: 340px; max-width: calc(100vw - 24px); padding: 18px 20px; background: var(--paper); pointer-events: auto; border-top: 4px solid var(--red); }
.coach-box h3 { font-size: 18px; margin: 4px 0 8px; }
.coach-box p { margin: 0; line-height: 1.5; }
.coach-box .buttons { margin-top: 14px; justify-content: flex-end; }
.coach.centered { background: rgba(17, 17, 17, 0.32); }
.coach.centered .coach-box { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: 420px; }
.panel-toggle { display: none; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; background: var(--paper); border: 1px solid var(--ink); padding: 6px 10px; line-height: 1.2; cursor: pointer; }
a.button:hover { background: var(--soft); }
a.button.primary { background: var(--red); border-color: var(--red); color: #fff; }
a.menu-item { color: inherit; text-decoration: none; }
.home-head .logo { flex: none; }
.warning { padding: 12px 14px; border-left: 4px solid var(--red); background: #fbeceb; line-height: 1.45; margin: 0 0 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.field input { font-size: 16px; padding: 9px 10px; border: 1px solid var(--ink); border-radius: 0; color: var(--ink); max-width: 360px; }
.record { display: block; width: 100%; aspect-ratio: 1200 / 630; border: 1px solid var(--line); margin: 6px 0 4px; background: var(--soft); }
.fatal { position: fixed; inset: 0; z-index: 40; background: rgba(17, 17, 17, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fatal-box { max-width: 480px; padding: 26px; background: var(--paper); border-top: 4px solid var(--red); }
.fatal-box h2 { font-size: 22px; margin-bottom: 10px; }
.fatal-box p { line-height: 1.5; margin: 0; }
.unsupported { max-width: 520px; margin: 80px auto; padding: 0 20px; font: 18px/1.5 Helvetica, Arial, sans-serif; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 900px) {
  .home-panel { padding: 28px 20px calc(28px + env(safe-area-inset-bottom)); width: 100%; }
  .home-panel.wide { width: 100%; }
  .city-picks, .slot-picks { grid-template-columns: 1fr 1fr; }
  .home-backdrop .hero-figure { display: none; }
  .profiles, .choices, .cards { grid-template-columns: 1fr; }
  .modal-box { width: 100%; max-height: 100%; height: 100%; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .modal-box h1 { font-size: 22px; }

  .topbar { left: 0; right: 0; top: 0; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; gap: 6px 10px; flex-wrap: wrap; }
  .topbar .brand, .topbar .spacer, #gameLang { display: none; }
  .topbar select { flex: 1; min-width: 0; height: 36px; }
  .topbar .speed { order: 2; }
  .topbar button.icon { width: 36px; height: 36px; }
  .stats { order: 3; display: flex; gap: 14px; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .topbar .stat { min-width: auto; flex: 0 0 auto; }
  .stat span { font-size: 9px; }
  .stat b { font-size: 12px; }

  .search { left: 8px; right: 8px; width: auto; top: calc(96px + env(safe-area-inset-top)); padding: 4px; }
  .search input { padding: 8px; font-size: 16px; }

  .sidebar {
    display: flex;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    height: 62%;
    transform: translateY(105%);
    transition: transform 0.25s ease;
    z-index: 6;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: none; }
  .tabs { overflow-x: auto; }
  .tabs button { padding: 12px 10px; font-size: 12px; }

  .info { left: 0; right: 0; width: auto; top: auto; bottom: 0; max-height: 58%; padding-bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 7; }
  .wiki-photo img { height: 150px; }

  .hint, .mini, .nav { display: none !important; }
  .tools { right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); }
  .tools button { padding: 9px 10px; }
  #tFly { display: none; }
  .panel-toggle {
    display: block;
    position: absolute;
    left: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 5;
    padding: 10px 16px;
    font-weight: 700;
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    box-shadow: var(--shadow);
  }
  .sidebar.open ~ .panel-toggle { bottom: calc(62% + 8px); z-index: 7; }
  .toasts { top: calc(150px + env(safe-area-inset-top)); width: calc(100% - 24px); }
  .toast { max-width: 100%; }
  .label { font-size: 10px; }
  .label.q { font-size: 12px; }

  .coach-box { left: 12px !important; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); top: auto !important; width: auto; max-width: none; }
  .coach.dock-top .coach-box { top: calc(12px + env(safe-area-inset-top)) !important; bottom: auto; }
  .coach.centered .coach-box { width: auto; left: 12px !important; right: 12px; top: 50% !important; bottom: auto; transform: translateY(-50%); }
}
