:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0; --grid: #e8edf3;
  --accent: #2563eb; --bar: #2563eb; --error: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0f17; --card: #161c27; --text: #e5e7eb; --muted: #94a3b8; --line: #273142; --grid: #222b3a;
    --accent: #3b82f6; --bar: #3b82f6; --error: #f87171; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  padding: calc(env(safe-area-inset-top) + 16px) calc(env(safe-area-inset-right) + 16px) calc(env(safe-area-inset-bottom) + 24px) calc(env(safe-area-inset-left) + 16px);
  max-width: 720px; margin: 0 auto;
}
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head .htext { flex: 1; }
.logo { width: 48px; height: 48px; border-radius: 12px; }
.icon { width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--card); color: var(--text); font-size: 22px; }

.card { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
label { display: block; margin-top: 14px; font-size: 14px; color: var(--muted); }
input {
  display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 0 12px; font-size: 17px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
.btn { width: 100%; min-height: 50px; margin-top: 18px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-family: inherit; font-size: 17px; font-weight: 600; }
.btn:disabled { opacity: .5; }
.link { display: block; margin: 8px auto 0; min-height: 44px; border: 0; background: none; color: var(--muted); font-family: inherit; font-size: 16px; }
.error { color: var(--error); font-size: 14px; margin: 12px 0 0; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: 16px; padding: 12px 14px; }
.tile.hero { grid-column: 1 / -1; }
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.hero .value { font-size: 44px; }
.tile .note { font-size: 13px; color: var(--muted); }

.chart { position: relative; margin-top: 12px; height: 180px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--bar); }
.chart .bar.active { fill: var(--text); }
.chart .hit { fill: transparent; }
.chart .peak { fill: var(--text); font-size: 12px; font-weight: 600; }
.tip {
  position: absolute; top: -6px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--card); font-size: 13px; line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }

.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.link-card { display: flex; align-items: center; justify-content: center; min-height: 52px; margin: 0; padding: 0 12px; color: var(--accent); font-weight: 600; text-decoration: none; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.app-icon { width: 40px; height: 40px; border-radius: 10px; }
.hint {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 4px 4px 4px 14px;
  border-radius: 14px; background: var(--card); font-size: 15px;
}
.hint span { flex: 1; }
.games { list-style: none; margin: 8px 0 0; padding: 0; }
.games li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.games li:last-child { border-bottom: 0; }
.games .gnames { font-weight: 600; margin-top: 2px; }
