  :root {
    --paper: #ECEEE8;
    --paper-2: #E2E6DE;
    --ink: #1F2624;
    --ink-soft: #5B6661;
    --line: #C5CCC3;
    --seal: #A3241B;
    --seal-ink: #FBF4EF;
    --jade: #3F6E5B;
    --focus: #3F6E5B;
    color-scheme: light;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper: #151918;
      --paper-2: #1E2422;
      --ink: #E4E8E1;
      --ink-soft: #9CA8A2;
      --line: #333C39;
      --seal: #C8443A;
      --seal-ink: #FFF6F2;
      --jade: #88B5A1;
      --focus: #88B5A1;
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --paper: #151918;
    --paper-2: #1E2422;
    --ink: #E4E8E1;
    --ink-soft: #9CA8A2;
    --line: #333C39;
    --seal: #C8443A;
    --seal-ink: #FFF6F2;
    --jade: #88B5A1;
    --focus: #88B5A1;
    color-scheme: dark;
  }
  *, *::before, *::after { box-sizing: inherit; }
  html { scroll-padding-top: env(safe-area-inset-top, 0px); }
  html, body { height: 100%; }
  body {
    margin: 0;
    padding: 10px 10px 50px;
    background: #007f82;
    color: var(--ink);
    font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.6;
    display: flex;
    justify-content: center;
  }

  /* Window frame, matching the other windows on the site. */
  .windows-95-window {
    width: 100%;
    min-width: 0;
    max-width: 56rem;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #c0c0c0;
    border: 2px solid #fcfdff;
    box-shadow: 0 0 0 1px #000, 2px 2px 10px rgba(0, 0, 0, 0.3);
    padding: 2px;
  }
  .title-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 3px 3px 3px 6px;
    background: linear-gradient(to right, #000080, #1084d0);
    color: #fff;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.3;
  }
  .window-title { flex-grow: 1; }
  .title-bar .window-button {
    width: 20px;
    height: 18px;
    padding: 0;
    display: grid;
    place-items: center;
    background: #c0c0c0;
    color: #000;
    font-family: "MS Sans Serif", Tahoma, sans-serif;
    font-size: 11px;
    font-weight: bold;
    border-radius: 0;
    border: 2px solid;
    border-color: #fff #000 #000 #fff;
  }
  .title-bar .window-button:hover:not(:disabled) { border-color: #fff #000 #000 #fff; }
  .title-bar .window-button:active { border-color: #000 #fff #fff #000; }
  .window-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--paper);
    border: 2px solid;
    border-color: #808080 #fff #fff #808080;
    margin-top: 2px;
  }
  main {
    max-width: 52rem;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
  }

  .seal {
    display: inline-grid;
    place-items: center;
    background: var(--seal);
    color: var(--seal-ink);
    font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
    font-weight: 700;
    border-radius: 3px;
    line-height: 1;
  }

  header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.75rem;
  }
  .brand { display: flex; align-items: center; gap: 0.85rem; }
  .brand .seal { width: 2.4rem; height: 2.4rem; font-size: 1.5rem; }
  h1 { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
  .round-info { color: var(--ink-soft); font-size: 1rem; }
  .round-info strong { color: var(--ink); font-weight: 600; }

  .stage {
    position: relative;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2.25rem 1.5rem 2rem;
    min-height: 15rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .picked {
    margin: 0;
    padding-right: 6.5rem;
    font-size: clamp(2.4rem, 8vw, 5.25rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    font-variant-numeric: lining-nums;
  }
  .picked.placeholder {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 400;
    font-style: italic;
    color: var(--ink-soft);
  }
  .picked.shuffling { color: var(--ink-soft); }
  .stage-note {
    margin: 0.9rem 0 0;
    color: var(--ink-soft);
    font-size: 1.05rem;
    min-height: 1.6em;
  }
  .stamp {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 5rem;
    height: 5rem;
    font-size: 3.1rem;
    opacity: 0;
    transform: rotate(-6deg) scale(1);
  }
  .stamp.show {
    opacity: 0.92;
    animation: stamp 260ms cubic-bezier(.2,.9,.3,1.2);
  }
  @keyframes stamp {
    from { opacity: 0; transform: rotate(-14deg) scale(1.6); }
    to { opacity: 0.92; transform: rotate(-6deg) scale(1); }
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0 0.5rem;
  }
  button, label.button {
    display: inline-block;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 4px;
    padding: 0.7rem 1.3rem;
    cursor: pointer;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
  }
  button.primary {
    background: var(--ink);
    color: var(--paper);
    padding: 0.85rem 2rem;
    font-size: 1.2rem;
  }
  button:hover:not(:disabled), label.button:hover { border-color: var(--jade); }
  button.primary:hover:not(:disabled) { background: var(--jade); border-color: var(--jade); }
  button:disabled { opacity: 0.4; cursor: not-allowed; }
  button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible,
  input:focus-visible + label.button {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
  button.quiet, label.button.quiet { border-color: var(--line); color: var(--ink-soft); font-weight: 400; }
  button.confirming { border-color: var(--seal); color: var(--seal); }
  .hint { color: var(--ink-soft); font-size: 0.95rem; margin: 0.25rem 0 0; }
  kbd {
    font-family: inherit;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 3px;
    padding: 0 0.35em;
    font-size: 0.9em;
  }

  .setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin-top: 1.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 4px;
  }
  .setup label { font-weight: 600; }
  .setup input {
    font: inherit;
    width: 5.5rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper-2);
    color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .setup .hint { margin: 0; }

  .lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2.5rem;
  }
  @media (max-width: 600px) {
    .lists { grid-template-columns: 1fr; gap: 1.5rem; }
    .picked { padding-right: 0; padding-top: 4.5rem; }
    .stamp { width: 4rem; height: 4rem; font-size: 2.5rem; }
  }
  h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  h2 span { font-weight: 400; color: var(--ink-soft); }
  .chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
  }
  .chips li {
    min-width: 2.4rem;
    text-align: center;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .chips li .num {
    color: var(--ink-soft);
    font-size: 0.8em;
    margin-right: 0.35em;
  }
  ol.chips li { color: var(--ink-soft); }
  ol.chips li.latest { border-color: var(--seal); color: var(--ink); }
  .chips li.empty {
    border: 0;
    padding: 0;
    min-width: 0;
    text-align: left;
    color: var(--ink-soft);
    font-style: italic;
  }

  details {
    margin-top: 2.5rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
  }
  summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; }
  summary .meta { font-weight: 400; color: var(--ink-soft); font-size: 1rem; margin-left: 0.4rem; }
  details p { margin: 0.6rem 0; color: var(--ink-soft); font-size: 1rem; max-width: 40rem; }
  #namesInput {
    display: block;
    width: 100%;
    max-width: 40rem;
    margin-top: 0.9rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1.6;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper-2);
    color: var(--ink);
    resize: vertical;
  }
  #namesInput::placeholder { color: var(--ink-soft); opacity: 0.7; }
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .name-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1rem; }
  .status { color: var(--jade); font-size: 1rem; }

  footer {
    margin-top: 2.5rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    max-width: 40rem;
  }
  @media (prefers-reduced-motion: reduce) {
    .stamp.show { animation: none; }
  }
