:root {
  --red: #b6243d;
  --ink: #2f2527;
  --muted: #705f63;
  --line: #e8dfe1;
  --pale: #faeef1;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f5f3f3;
  color: var(--ink);
  font:
    15px/1.6 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    sans-serif;
}
a {
  color: var(--red);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button.secondary {
  background: white;
  color: var(--red);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cdbdc1;
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
}
label {
  display: block;
  margin: 16px 0 6px;
}
input:focus-visible,
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid #e79aaa;
  outline-offset: 2px;
}
header {
  background: var(--red);
  color: white;
  padding: 24px;
}
header a {
  color: white;
}
h1 {
  font-size: 28px;
  line-height: 1.3;
  margin: 8px 0;
}
h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
p {
  margin: 8px 0;
}
main {
  max-width: 760px;
  margin: auto;
  padding: 24px 20px 100px;
}
.phone {
  background: white;
  max-width: 440px;
  margin: 24px auto;
  min-height: 850px;
  box-shadow: 0 2px 20px #38272c0a;
}
.phone main {
  padding-bottom: 100px;
}
.tabs {
  display: flex;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px max(12px, env(safe-area-inset-bottom));
  gap: 8px;
  z-index: 2;
}
.tabs button {
  flex: 1;
  border: 0;
  background: #fff;
  color: var(--muted);
}
.tabs button.active {
  color: var(--red);
  background: var(--pale);
}
.panel {
  background: white;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0;
}
.muted,
small {
  color: var(--muted);
}
.notice {
  padding: 12px 14px;
  background: var(--pale);
  border-radius: 8px;
  margin: 16px 0;
  font-size: 13px;
}
.speed-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f9;
}
.speed-option input[type="checkbox"] {
  flex: 0 0 22px;
  width: 22px;
  min-height: 22px;
}
.speed-option span small {
  display: block;
  margin-top: 3px;
}
.error {
  color: #a22937;
  white-space: pre-wrap;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions > * {
  flex: 1;
}
.full {
  width: 100%;
}
.result-row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.result-row strong {
  font-size: 22px;
  white-space: nowrap;
}
.result-row small {
  display: block;
}
.stats {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0 20px;
}
.stats > div {
  flex: 1;
}
.stats strong {
  font-size: 32px;
  display: block;
  font-variant-numeric: tabular-nums;
}
.stats small {
  font-size: 12px;
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.badge {
  font-size: 12px;
  background: var(--pale);
  color: var(--red);
  padding: 4px 8px;
  border-radius: 4px;
}
.pagebar {
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.pagebar button {
  border-color: #ffffff80;
}
.admin {
  max-width: 1200px;
}
.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-nav button {
  background: white;
  color: var(--muted);
  border-color: var(--line);
}
.admin-nav button.active {
  background: var(--red);
  color: white;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid .panel {
  margin: 0;
}
.number-card {
  text-align: center;
}
.number-card strong {
  font-size: 28px;
  display: block;
}
.number-card code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px;
  margin-top: 8px;
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.config-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.config-row label {
  margin-top: 6px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
}
.table-wrap {
  overflow: auto;
}
textarea {
  font: 13px/1.5 monospace;
  min-height: 220px;
}
details {
  margin-top: 12px;
}
summary {
  cursor: pointer;
  color: var(--red);
  min-height: 44px;
  display: flex;
  align-items: center;
}
#feedback {
  min-height: 24px;
}
.test-banner {
  font-size: 13px;
  padding: 12px 20px;
  background: #fff4dd;
  color: #654c23;
}
.round-score {
  font-size: 48px;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  .phone {
    margin: 0;
    min-height: 100vh;
    max-width: none;
  }
  .grid,
  .config-grid {
    grid-template-columns: 1fr 1fr;
  }
  .admin {
    padding: 20px 14px;
  }
  header {
    padding: 20px;
  }
  .pagebar {
    align-items: flex-start;
  }
  h1 {
    font-size: 26px;
  }
  .pagebar .actions {
    margin: 0;
  }
  .pagebar small {
    display: none;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .rank-table th,
  .rank-table td {
    padding: 10px 6px;
  }
}
@media (max-width: 360px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .stats {
    gap: 8px;
  }
  .stats strong {
    font-size: 26px;
  }
}
button[type="submit"] {
  margin-top: 16px;
}
.pagebar .actions {
  flex: 0 0 auto;
  margin: 0;
}
.pagebar .actions > * {
  flex: 0 0 auto;
  white-space: nowrap;
}
.pagebar .button {
  border-color: #ffffff80;
}
.grid {
  margin-top: 20px;
  margin-bottom: 32px;
}
.phone .tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 100%);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
a {
  text-underline-offset: 3px;
}
input,
textarea {
  caret-color: var(--red);
}
::selection {
  background: #f1c9d2;
  color: #2f2527;
}
.stats strong,
.rank-table td,
.raw-value {
  font-variant-numeric: tabular-nums;
}
.error:focus {
  outline: 2px solid #e8dfe1;
  outline-offset: 6px;
}
button,
.button {
  transition:
    transform 120ms ease-out,
    background-color 120ms ease-out;
}
button:active:not(:disabled),
.button:active {
  transform: scale(0.98);
}
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled),
  .button:hover {
    background: #982036;
    color: #fff;
  }
  .tabs button:hover:not(:disabled) {
    background: var(--pale);
    color: var(--red);
  }
}
@media (prefers-reduced-motion: reduce) {
  button,
  .button {
    transition: none;
  }
  button:active:not(:disabled),
  .button:active {
    transform: none;
  }
}
@media (max-width: 500px) {
  .pagebar {
    flex-wrap: wrap;
  }
  .pagebar .actions {
    width: 100%;
  }
  .pagebar .actions > * {
    flex: 1;
  }
}
