:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --fg: #18181b;
  --muted: #5b5b63;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --soft: #f4f4f5;
  --accent: #d92d20;
  --accent-hover: #b42318;
  --accent-soft: #fef3f2;
  --accent-fg: #ffffff;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 4px 16px rgb(16 24 40 / 0.06);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #18181b;
    --fg: #f4f4f5;
    --muted: #a1a1aa;
    --line: #27272a;
    --line-strong: #3f3f46;
    --soft: #222226;
    --accent: #f04438;
    --accent-hover: #f97066;
    --accent-soft: #2b1210;
    --accent-fg: #ffffff;
    --ok: #47cd89;
    --ok-soft: #0c2418;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

[hidden] { display: none !important; }

.top, .layout { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.top { padding-top: 20px; padding-bottom: 16px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.top p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.layout { display: grid; gap: 20px; padding-bottom: 48px; }

.report {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.details { display: none; gap: 14px; }
.report.open .details { display: grid; }

.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }

label, legend { font-size: 14px; font-weight: 600; padding: 0; }
label small { font-weight: 400; color: var(--muted); font-size: 13px; }

input, select, button {
  font: inherit;
  color: inherit;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

input::placeholder { color: #8a8a93; }

input:focus, select:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 12%, transparent); }
button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-head label { white-space: nowrap; }

.prefix { flex: none; font-size: 14px; font-weight: 600; color: var(--muted); }

#target { min-height: 52px; font-size: 20px; font-weight: 600; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

#target.is-valid { border-color: var(--ok); }
#target.is-invalid { border-color: var(--accent); }
#target.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.hint { margin: -4px 0 0; font-size: 14px; font-weight: 600; color: var(--accent-hover); }

.link {
  justify-self: start;
  width: auto;
  min-height: 32px;
  margin: -8px 0 -6px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.link:hover { color: var(--fg); }

.extension { display: grid; grid-template-columns: auto 120px; gap: 10px; align-items: center; justify-content: start; }
#extension { font-weight: 600; font-variant-numeric: tabular-nums; }

.city-fixed { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }

.reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.reason { position: relative; }
.reason input { position: absolute; opacity: 0; pointer-events: none; }

.reason span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.reason input:checked + span { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.reason input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 2px; }

.primary {
  min-height: 48px;
  border: 0;
  background: #d92d20;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary:hover { background: #b42318; }

button:disabled { opacity: 0.6; cursor: default; }

.trap { position: absolute; left: -9999px; width: 1px; height: 1px; }

#notice { padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
#notice.ok { background: var(--ok-soft); color: var(--ok); }
#notice.err { background: var(--accent-soft); color: var(--accent); }

.board { min-width: 0; }

.board-head { margin-bottom: 12px; }


.tabs { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; background: var(--soft); border-radius: 10px; }

.tab {
  width: auto;
  min-height: 32px;
  padding: 4px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.filters select { width: auto; min-height: 36px; padding-top: 4px; padding-bottom: 4px; font-size: 14px; background-color: var(--surface); border-radius: 999px; }
.filters:not(:has(select:not([hidden]))) { display: none; }

ol {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

ol:empty { display: none; }

.item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.item:first-child { border-top: 0; }

.item.fresh { box-shadow: inset 3px 0 0 var(--ok); }

.rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.item:nth-child(-n + 3) .rank { background: var(--accent-soft); color: var(--accent-hover); }
.item:first-child .rank { background: #d92d20; color: #ffffff; }

.info { min-width: 0; }

.crown {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 0 0 -4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }

.number { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.number span { white-space: nowrap; }
.title + .number { color: var(--muted); font-weight: 500; }
.ext::before { content: " · "; }

.meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.side { display: flex; align-items: center; gap: 14px; }

.count { margin: 0; text-align: right; line-height: 1.1; }
.count b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.count span { font-size: 12px; color: var(--muted); }

.me-too {
  width: auto;
  min-height: 36px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.me-too:hover:not(:disabled) { border-color: var(--fg); }
.me-too:disabled { border-color: transparent; background: var(--ok-soft); color: var(--ok); opacity: 1; }

.board footer { margin-top: 14px; text-align: center; color: var(--muted); font-size: 13px; }

#empty {
  margin: 0;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

@media (max-width: 420px) {
  .side { flex-direction: column; align-items: flex-end; gap: 6px; }
  .count { display: flex; align-items: baseline; gap: 4px; }
  .count b { display: inline; font-size: 18px; }
}

@media (min-width: 960px) {
  .top { padding-top: 32px; padding-bottom: 24px; display: flex; align-items: baseline; gap: 14px; }
  .top h1 { font-size: 24px; }
  .layout { grid-template-columns: 360px 1fr; gap: 32px; align-items: start; }
  .report { position: sticky; top: 24px; padding: 20px; gap: 14px; }
  .report .details { display: grid; }
  .item { padding: 14px 20px; }
}
