:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1e40af;
  --accent-text: #ffffff;
  --accent-soft: #e0e7ff;
  --good: #047857;
  --good-bg: #d1fae5;
  --wait: #92400e;
  --wait-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --neutral-bg: #f3f4f6;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #131a26;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #243042;
    --accent: #3b82f6;
    --accent-text: #ffffff;
    --accent-soft: #1e2a4a;
    --good: #6ee7b7;
    --good-bg: #0f2e25;
    --wait: #fcd34d;
    --wait-bg: #33270b;
    --bad: #fca5a5;
    --bad-bg: #3a1414;
    --neutral-bg: #1f2937;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

.top {
  margin-bottom: 16px;
}

.title {
  display: flex;
  align-items: center;
  gap: 8px;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

h2 {
  margin: 28px 0 10px;
  font-size: 1.05rem;
}

.top p {
  margin: 2px 0 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

a {
  color: var(--accent);
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--wait-bg);
  color: var(--wait);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.notice[data-tone="good"] {
  background: var(--good-bg);
  color: var(--good);
}

.notice[data-tone="wait"] {
  background: var(--wait-bg);
  color: var(--wait);
}

.notice[data-tone="bad"] {
  background: var(--bad-bg);
  color: var(--bad);
}

button,
.button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 12px 0;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.primary:disabled {
  opacity: 0.5;
}

.primary.secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
}

.link {
  margin-top: 20px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}

.segments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--neutral-bg);
}

.segment {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.segment[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.segment:disabled {
  color: var(--muted);
}

#platform-label {
  margin: 6px 4px 14px;
}

.types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.type {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.type:active:not(:disabled) {
  background: var(--accent-soft);
}

.type:disabled {
  opacity: 0.55;
}

.type.busy {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.recent,
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.meta {
  margin-top: 2px;
}

.detail {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.empty {
  padding: 8px 0;
}

.pill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--neutral-bg);
  font-size: 0.8rem;
  font-weight: 600;
}

.pill.good {
  background: var(--good-bg);
  color: var(--good);
}

.pill.wait {
  background: var(--wait-bg);
  color: var(--wait);
}

.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.steps li {
  margin: 8px 0;
}

.hint {
  margin-top: 28px;
}
