:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --card: #fffcf5;
  --ink: #1e2529;
  --muted: #555e60;
  --line: #d8d4ca;
  --red: #a5362c;
  --blue: #215a81;
  font-family: system-ui, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled, select:disabled, input:disabled { opacity: .48; cursor: default; }
button:not(:disabled):hover { filter: brightness(.94); }
:focus-visible { outline: 3px solid #c67a25; outline-offset: 3px; }
.shell { width: min(100% - 64px, 1100px); margin-inline: auto; }
.top { height: 69px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 12px; align-items: center; font-weight: 750; letter-spacing: .1em; }
.brand-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 6px; background: var(--ink); }
.brand-icon::after { content: ""; width: 10px; height: 10px; border: 2px solid #f3b75f; transform: rotate(45deg); }
.quiet { border: 0; background: transparent; padding: 8px 4px; font-size: .9rem; font-weight: 650; min-height: 42px; }
.quiet span, .outline span { margin-inline-end: 3px; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-block: 36px 26px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 5vw, 3.15rem); font-weight: 850; line-height: 1.14; letter-spacing: -.055em; }
.intro p { color: var(--muted); margin-top: 11px; }
.outline, .primary { min-height: 44px; border: 1px solid #bcb9b0; background: var(--card); padding: 8px 16px; border-radius: 8px; white-space: nowrap; font-weight: 700; }
.primary { background: var(--ink); color: white; border-color: var(--ink); }
.board { display: grid; grid-template-columns: 1.22fr 1fr; gap: 16px; }
.clock { background: #202b33; border-radius: 16px; color: #fcf6e8; padding: 23px 25px; display: flex; flex-direction: column; --accent: #f3b75f; }
.clock-header, .team-head, .controls-head, .controls-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-label { color: #c3c9cc; font-size: .875rem; font-weight: 700; letter-spacing: .09em; }
.turn { margin-top: 5px; font-size: 1.2rem; font-weight: 780; }
.clock-icon { display: grid; place-items: center; flex: 0 0 auto; min-width: 44px; height: 44px; border-radius: 8px; border: 1px solid #68767d; background: #2b3942; color: #fcf6e8; }
#sound { padding-inline: 12px; font-size: .875rem; }
#reset-timer { font-size: 1.6rem; }
.clock-display { display: grid; place-items: center; align-content: center; flex: 1; padding: 11px 0 18px; }
.digits { font-size: clamp(4rem, 10vw, 7.1rem); font-weight: 770; line-height: 1; letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
.clock-status { color: #d2d8da; font-size: .875rem; margin-top: 8px; }
.clock[data-urgent="true"] .digits, .clock[data-urgent="true"] .clock-status { color: var(--accent); }
.meter { height: 5px; background: #46535c; border-radius: 8px; overflow: hidden; }
.meter i { display: block; width: 100%; height: 100%; background: var(--accent); }
.duration { display: flex; gap: 6px; margin: 15px 0 12px; flex-wrap: wrap; }
.duration button, .custom { color: #e3e8e9; background: #2b3942; border: 1px solid #68767d; border-radius: 7px; min-height: 38px; padding: 4px 10px; font-size: .875rem; }
.duration button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.custom { display: flex; align-items: center; gap: 4px; }
.custom input { min-width: 0; width: 4ch; appearance: textfield; margin: 0; padding: 1px 2px; background: transparent; border: 0; border-bottom: 1px solid #9ba7ab; color: inherit; text-align: center; }
.custom input::-webkit-inner-spin-button { appearance: none; }
.clock-actions { display: flex; gap: 8px; }
.start { flex: 1; min-height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: #25241e; font-weight: 800; }
.scores { display: grid; gap: 12px; }
.score { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 15px 20px 12px; display: flex; flex-direction: column; justify-content: space-between; }
.red { --team: var(--red); --tint: #f7e8e0; }
.blue { --team: var(--blue); --tint: #e4edf3; }
.score.active { border-color: var(--team); }
.team-head h2 { color: var(--team); font-size: 1.03rem; display: flex; align-items: center; gap: 8px; }
.team-head i { width: 10px; height: 10px; background: currentColor; border-radius: 3px; }
.badge { padding: 3px 8px; border-radius: 5px; background: var(--tint); color: var(--team); font-size: .875rem; font-weight: 750; }
.badge:empty { display: none; }
.team-count { display: flex; align-items: center; gap: 13px; margin-block: 3px 8px; }
.team-count strong { min-width: .64em; font-variant-numeric: tabular-nums; font-size: 3.55rem; line-height: 1; letter-spacing: -.04em; color: var(--team); }
.team-count b { display: block; font-size: .875rem; }
.team-foot { color: var(--muted); font-size: .875rem; margin-top: 8px; }
.team-foot b { color: var(--ink); margin-inline-start: 3px; }
.controls { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 17px 20px 12px; }
.controls h2 { font-size: 1.17rem; }
.controls p { margin-top: 5px; font-size: .9rem; color: var(--muted); }
.controls-foot { border-top: 1px solid var(--line); padding-top: 9px; }
footer { display: flex; justify-content: space-between; gap: 10px; padding-block: 15px 20px; color: var(--muted); font-size: .875rem; }
a { color: inherit; text-underline-offset: 3px; }
dialog { width: min(33rem, 100% - 32px); border: 1px solid var(--line); border-radius: 15px; background: var(--card); color: var(--ink); padding: 24px; }
dialog::backdrop { background: #181d22a8; }
dialog h2 { margin-bottom: 10px; }
dialog p, dialog li { line-height: 1.55; }
dialog ol { padding-inline-start: 1.3rem; }
dialog li + li { margin-top: 8px; }
fieldset { margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
fieldset label { padding-block: 4px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; }
@media (max-width: 700px) {
  .shell { width: calc(100% - 32px); }
  .top { height: 55px; }
  .intro { margin-block: 23px 17px; }
  .board { grid-template-columns: 1fr; gap: 10px; }
  .scores { grid-template-columns: 1fr 1fr; gap: 8px; }
  .score { padding: 12px; }
  .clock { padding: 16px; }
  .clock-display { padding-block: 12px 15px; }
  .controls { margin-top: 10px; padding-inline: 12px; }
}
@media (max-width: 365px) {
  .intro .outline { padding-inline: 8px; }
  .team-count { gap: 7px; }
  .badge { padding-inline: 4px; }
  .duration button, .custom { padding-inline: 6px; }
}
.team-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 12px; }
.team-foot span { overflow-wrap: anywhere; min-width: 0; }
.team-foot span:empty { display: none; }
.team-foot span:last-child { margin-inline-start: auto; white-space: nowrap; }
.captains { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.captains label { display: grid; gap: 5px; font-size: .875rem; font-weight: 700; }
.captains input { min-width: 0; width: 100%; min-height: 42px; border: 1px solid #bcb9b0; border-radius: 7px; background: var(--card); padding: 7px 9px; color: var(--ink); font-weight: 400; }

.card-count { white-space: nowrap; font-size: .875rem; color: var(--muted); font-weight: 700; }
.picture-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-block: 13px 10px; }
.picture { padding: 7px 2px; min-height: 44px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font-variant-numeric: tabular-nums; font-weight: 720; }
.picture:not(:disabled):hover { border-color: #8b8274; }
.picture:is(.red, .blue):disabled { opacity: 1; color: var(--team); background: var(--tint); border-color: var(--team); box-shadow: inset 0 -3px var(--team); }
.picture small { display: inline-block; margin-inline-start: .28em; font-size: .75rem; }
.picture small:empty { display: none; }
