/* Shared surface for the challenge lobby, the timed table and the result. */
.wc {
  --wc-ink: #193c32;
  --wc-muted: #586456;
  --wc-border: #d5cbb4;
  --wc-paper: #fcfaf2;
  --wc-green: #1b493b;
  --wc-gold: #a8884d;
  --wc-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  min-height: min(760px, 80svh);
  color: var(--wc-ink);
  background: linear-gradient(155deg, #faf8ed, #fdfbf4 60%, #f0f1e6);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
.wc-wrap { width: min(100% - clamp(36px, 8vw, 140px), 1240px); margin: auto; padding: 20px 0 clamp(48px, 6vw, 80px); }
.wc-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; color: var(--wc-muted); font-size: .9rem; line-height: 1.55; margin: 0 0 clamp(22px, 3.6vw, 48px); }
.wc a { text-underline-offset: .22em; }
.wc-crumb a { text-decoration: none; }
.wc-crumb a:hover, .wc .wc-link:hover { text-decoration: underline; }
.wc h1, .wc h2, .wc h3, .wc p, .wc dl, .wc dd { margin: 0; }
.wc h1, .wc h2, .wc h3 { font-family: var(--wc-serif); line-height: 1.26; }
.wc button:not(:disabled), .wc summary { cursor: pointer; }
.wc :is(button, a, input, summary):focus-visible { outline: 3px solid #c58326; outline-offset: 3px; }
.wc-welcome-grid, .wc-play-grid, .wc-finish-grid { display: grid; align-items: stretch; gap: clamp(18px, 3.2vw, 42px); }
.wc-welcome-grid { grid-template-columns: 1.3fr 1fr; }
.wc-play-grid { grid-template-columns: minmax(0, 1fr); }
.wc-finish-grid { grid-template-columns: 1.25fr 1fr; }
.wc-welcome-grid > *, .wc-play-grid > *, .wc-finish-grid > * { min-width: 0; }
.wc-felt {
  position: relative; isolation: isolate; overflow: hidden; color: #fff8e9;
  background:
    radial-gradient(ellipse at 12% 0%, #426650 0%, transparent 60%),
    radial-gradient(ellipse at 60% 120%, #285443 0%, transparent 62%),
    linear-gradient(118deg, #244c3d, #153a30);
  border: 1px solid #214337; border-radius: 15px;
  box-shadow: inset 0 0 0 4px #153e32, inset 0 0 0 5px #a69061, 0 4px 12px #112c2312;
}
.wc-felt::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid #d8cb9b45;
  border-radius: 4px; pointer-events: none; z-index: -1;
}
.wc-cover { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 350px; padding: clamp(32px, 4.4vw, 66px); }
.wc-cover h1 { z-index: 1; font-size: clamp(2.25rem, 4.8vw, 4.35rem); color: #fff9e9; font-weight: 750; letter-spacing: .035em; }
.wc-cover :is(p, .wc-caption), .wc-felt .wc-caption { color: #efdaad; }
.wc-caption { color: var(--wc-muted); font-size: .94rem; font-weight: 700; letter-spacing: .06em; }
.wc-cover-rack { width: fit-content; display: flex; gap: 5px; align-items: flex-end; transform: rotate(-4deg); margin: 20px 0 2px auto; padding: 0 4px 6px; border-bottom: 4px solid #c6a66b; box-shadow: 0 3px 0 #574a30, 0 8px 7px -5px #0b261d; }
.wc-cover-rack .wc-tile { width: clamp(38px, 4.4vw, 58px); }
.wc-tile {
  display: inline-flex; position: relative; align-items: center; justify-content: center;
  flex: none; width: 100%; min-width: 0; aspect-ratio: 3 / 4;
  padding: 1px; border: 1px solid #d8d1ba; border-radius: 12% / 10%;
  background: linear-gradient(150deg, #fff 0%, #fffdf3 54%, #eae4cf 100%);
  box-shadow: inset 1px 1px 1px #fff, inset -1px -2px 1px #b9b298, 0 2px 0 #a89e7d, 0 3px 2px #10291e33;
}
.wc-tile img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.wc-start-rules { align-self: center; padding: 10px clamp(0px, 1vw, 16px); }
.wc-start-rules h2, .wc-finish-actions h2 { font-size: clamp(1.5rem, 2.4vw, 2.25rem); }
.wc-rules { margin: .9rem 0 1.1rem !important; border-top: 1px solid var(--wc-border); }
.wc-rules > div { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--wc-border); }
.wc-rules dt { font-weight: 700; }
.wc-rules dd { color: var(--wc-muted); line-height: 1.55; }
.wc-primary, .wc-secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: .62rem 1.15rem; border: 1px solid var(--wc-green); border-radius: 6px;
  color: #fffdf3; background: var(--wc-green); font-family: inherit; font-size: 1rem;
  line-height: 1.35; font-weight: 700; text-decoration: none;
}
.wc .wc-primary:hover:enabled { background: #11392e; }
.wc .wc-primary:disabled { color: #f0f1e8; background: #6d8073; border-color: #6d8073; }
.wc-secondary { background: transparent; color: var(--wc-green); }
.wc-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--wc-ink); font-weight: 650; }
.wc-play-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding-bottom: 18px; }
.wc-run-clock { display: inline-flex; align-items: baseline; gap: .4em; color: var(--wc-ink); font-weight: 650; }
.wc-run-clock strong { font-size: clamp(1.25rem, 2vw, 1.65rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
.wc-hand-panel { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(24px, 3vw, 40px); min-height: 250px; }
.wc-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.wc-panel-head h3, .wc-panel-head h2 { font-size: clamp(1.25rem, 2.1vw, 1.8rem); }
.wc-hand-panel .wc-panel-head > span { color: #ecdcb7; font-size: .94rem; }
.wc-rack { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); align-items: end; gap: clamp(1px, .13vw, 3px); width: 100%; min-width: 0; margin: 2rem auto; padding: 0 2px 6px; border-bottom: 4px solid #bea16b; box-shadow: 0 3px 0 #5a472c, 0 6px 4px -3px #0a261f; }
.wc-answer-panel, .wc-finish-actions { padding: clamp(14px, 2.1vw, 29px); border: 1px solid var(--wc-border); border-top: 3px solid var(--wc-gold); background: #fffdf5; border-radius: 10px; }
.wc-time { color: #8a5a16; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wc-meter { display: block; width: 100%; margin: .6rem 0 1rem; height: 5px; overflow: hidden; border-radius: 2px; background: #e5dfca; }
.wc-meter > i { display: block; height: 100%; width: 100%; background: #af8a45; transform-origin: left center; }
.wc-options { --wc-option-face: 44px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.wc-option { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; min-height: 66px; padding: 8px; border: 1px solid #c7c2aa; border-radius: 6px; color: var(--wc-ink); background: #fffdf5; text-align: start; }
.wc-option[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--wc-green); border-color: var(--wc-green); background: #e9eee2; }
.wc-check { display: inline-grid; place-items: center; flex: none; min-width: 13px; width: 13px; height: 13px; border-radius: 50%; border: 1px solid #a5a68e; color: transparent; font: 800 10px/1 sans-serif; }
.wc-option[aria-pressed="true"] .wc-check { background: var(--wc-green); border-color: var(--wc-green); }
.wc-option[aria-pressed="true"] .wc-check::before { content: "✓"; color: #fff; }
.wc-tiles { display: inline-flex; min-width: 0; gap: 2px; align-items: center; }
.wc-tiles .wc-tile { width: clamp(17px, 2vw, 30px); max-width: 100%; flex: 0 1 auto; min-width: 0; }
/* Keep each answer together, including the space between its tiles. */
.wc-option .wc-tiles {
  display: grid; grid-template-columns: repeat(var(--wc-faces, 1), minmax(0, 1fr));
  width: min(100%, calc(var(--wc-faces, 1) * (var(--wc-option-face) + 2px) - 2px));
  gap: 2px; margin-inline: auto; flex: 0 1 auto;
}
.wc-option .wc-tiles .wc-tile { width: 100%; }
.wc-answer-panel .wc-primary { width: 100%; margin-top: 14px; }
.wc-result-panel { padding: clamp(24px, 3.4vw, 45px); }
.wc-result-panel :is(h2, h3, strong) { color: #fff9e7; }
.wc-result-panel :is(p, small) { color: #f0ecd9; }
.wc-result-panel .wc-link { color: #ffecbc; }
.wc-finish-actions > :is(p, form) { margin-top: .85rem; }
.wc-finish-actions input { width: 100%; min-height: 46px; margin: .35rem 0 .65rem; padding: .6rem .8rem; color: var(--wc-ink); background: #fffdf5; border: 1px solid #b9baa6; border-radius: 5px; }
.wc-leaderboard { margin: clamp(28px, 3vw, 44px) 0 0; border-block: 1px solid var(--wc-border); }
.wc-leaderboard summary { display: flex; align-items: center; justify-content: space-between; min-height: 58px; font: 700 1.2rem/1.4 var(--wc-serif); list-style: none; }
.wc-leaderboard summary::-webkit-details-marker { display: none; }
.wc-leaderboard summary::after { content: ""; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.wc-leaderboard[open] summary::after { transform: rotate(225deg); }
.wc-ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wc-ranking th, .wc-ranking td { padding: .65rem .35rem; text-align: start; border-bottom: 1px solid var(--wc-border); overflow-wrap: anywhere; }
.wc-ranking th:last-child, .wc-ranking td:last-child { text-align: end; }
.wc-ranking .wc-my-row { color: #143f30; background: #e8eddf; font-weight: 700; }
.wc-error:not(:empty) { margin: 1rem 0; padding: .65rem .9rem; color: #75432e; background: #f6ebd9; border-left: 3px solid #ae7841; }
@media (min-width: 761px) and (max-width: 1140px) {
  .wc-result-panel .wc-rack { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px 3px; max-width: 420px; margin: 1rem auto; }
}
@media (max-width: 760px) {
  .wc-wrap { width: min(100% - 32px, 570px); padding: 13px 0 36px; }
  .wc-crumb { margin-bottom: 14px; gap: 4px 7px; font-size: .83rem; }
  .wc-welcome-grid, .wc-play-grid, .wc-finish-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .wc-cover { min-height: 190px; padding: 22px 24px 18px; }
  .wc-cover h1 { margin: .38rem 0 0; font-size: clamp(2.15rem, 8.7vw, 3rem); max-width: 9em; }
  .wc-cover-rack { gap: 3px; margin: 7px 1rem 0 auto; border-bottom-width: 3px; }
  .wc-cover-rack .wc-tile { width: clamp(28px, 8vw, 40px); }
  .wc-start-rules { padding: 4px 0 0; }
  .wc-start-rules .wc-primary { width: 100%; }
  .wc-rules { margin: .6rem 0 1rem !important; }
  .wc-play-head { padding-bottom: 10px; }
  .wc-play-grid { gap: 10px; }
  .wc-hand-panel { padding: 16px 17px 11px; min-height: auto; }
  .wc-rack { grid-template-columns: repeat(8, minmax(0, 1fr)); max-width: 352px; gap: 5px 2px; margin: .65rem auto .4rem; padding-bottom: 3px; border-bottom-width: 3px; }
  .wc-answer-panel { padding: 10px 0 0; background: transparent; border: 0; border-radius: 0; }
  .wc-answer-panel .wc-primary { min-height: 44px; margin-top: 9px; }
  .wc-meter { margin: 5px 0 9px; height: 4px; }
  .wc-options { gap: 7px; }
  .wc-option { min-height: 49px; padding: 5px 7px; }
  .wc-tiles .wc-tile { width: clamp(21px, 6.5vw, 30px); }
  .wc-result-panel { padding: 21px 22px; }
  .wc-finish-actions { padding: 15px; }
}
@media (max-width: 420px), (max-width: 760px) and (max-height: 690px) {
  .wc[data-screen="play"] .wc-crumb { display: none; }
}
@media (max-width: 370px) {
  .wc-wrap { width: calc(100% - 24px); }
  .wc-hand-panel { padding-inline: 14px; }
  .wc-option { padding-inline: 5px; gap: 3px; }
  .wc-tiles { gap: 1px; }
}
.wc-limits { margin: 0 0 1.1rem !important; color: var(--wc-muted); line-height: 1.6; }
.wc button.wc-link {
  justify-content: center; border: 0; background: none; padding: .45rem .7rem;
  text-decoration: underline; text-decoration-color: #a99d7f;
}
.wc button.wc-link:hover { text-decoration-color: currentColor; }
.wc-finish-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.25rem; }
.wc-finish-head h2, .wc h2.wc-game-title { font-size: clamp(1.65rem, 3vw, 2.5rem); }
.wc-finish-head p, .wc-board-note { color: var(--wc-muted); }
.wc-game-title strong, .wc-result-score strong {
  display: inline-block; margin-inline: .02em; font: 750 1.32em/1 var(--wc-serif);
  font-variant-numeric: tabular-nums;
}
.wc .wc-result-score {
  margin-bottom: 1.4rem; padding-bottom: 1rem; border-bottom: 1px solid #c7bd9355;
  color: #fff9e7; font: 700 clamp(1.45rem, 2.5vw, 2rem)/1.35 var(--wc-serif);
}
.wc-result-panel .wc-rack { margin: .8rem 0 1.25rem; }
.wc-review-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; min-height: 30px; margin: .6rem 0; }
.wc-review-row > span { min-width: 4.4em; font-size: .94rem; color: #efdaad; font-weight: 700; }
.wc-explanation { margin-top: .8rem !important; font-size: .95rem; line-height: 1.65; }
.wc-calc-link { display: inline-flex; align-items: center; min-height: 44px; color: #ffebbd; font-weight: 650; }
.wc-finish-actions { align-self: start; }
.wc-finish-actions h3 { font-size: 1.45rem; }
.wc-finish-actions label { display: block; font-weight: 650; }
.wc-finish-actions small, .wc-finish-actions [role="status"] { display: block; color: var(--wc-muted); font-size: .9rem; line-height: 1.52; }
.wc-finish-actions .wc-primary, .wc-finish-actions .wc-secondary { width: 100%; margin-top: .8rem; }
.wc-finish-actions [role="status"]:empty { display: none; }
.wc-finish-actions .wc-link { width: 100%; }
.wc-board-note { font-size: .9rem; line-height: 1.55; margin: .1rem 0 .85rem !important; }
.wc-ranking table { width: 100%; border-collapse: collapse; }
.wc-leaderboard [data-wc-board-message]:not(:empty), .wc-leaderboard [data-wc-my-rank]:not(:empty) { margin: .4rem 0 .8rem; }
.wc-error button { margin-left: .75rem; min-height: 40px; color: var(--wc-ink); background: #fffaf1; border: 1px solid #c5b28b; border-radius: 4px; }
.wc-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
@media (max-width: 760px) {
  .wc-start-rules .wc-link { width: 100%; }
  .wc-limits { font-size: .94rem; margin-bottom: .8rem !important; }
  .wc-finish-head { display: block; margin-bottom: .8rem; }
  .wc-finish-head p { margin-top: .25rem; }
  .wc .wc-result-score { margin-bottom: .9rem; }
}
@media (max-width: 760px) and (max-height: 650px) {
  .wc[data-screen="play"] .wc-wrap { padding-top: 7px; }
  .wc-play .wc-rack { max-width: 294px; }
  .wc-play-grid { gap: 4px; }
  .wc-answer-panel { padding-top: 4px; }
}


.wc-shortcuts { display: none; }

/* One centered play surface lets players move straight down from hand to answer. */
@media (min-width: 761px) {
  .wc[data-screen="play"] .wc-wrap { max-width: 896px; padding-top: 15px; }
  .wc[data-screen="play"] .wc-crumb { margin-bottom: clamp(10px, 2vh, 21px); }
  .wc-play-head { padding: 0 2px 12px; }
  .wc h2.wc-game-title { font-size: clamp(1.65rem, 2.15vw, 2.05rem); }
  .wc-play-grid {
    --play-pad: clamp(18px, 2.7vw, 34px);
    gap: 0; padding: 3px; border: 1px solid #7b805d; border-radius: 13px;
    background: #f5f1df; box-shadow: 0 4px 15px #18382b14;
  }
  .wc-play .wc-hand-panel {
    display: block; min-height: 0; padding: 16px var(--play-pad) 22px;
    border: 0; border-radius: 9px 9px 0 0; box-shadow: none;
  }
  .wc-play .wc-hand-panel::before { inset: 6px 6px 0; border-bottom: 0; border-radius: 5px 5px 0 0; }
  .wc-play .wc-panel-head h3 { font-size: 1.25rem; }
  .wc-play .wc-rack {
    grid-template-columns: repeat(16, minmax(0, 1fr)); max-width: none;
    margin: 12px auto 0; gap: 3px; padding: 0 3px 6px;
  }
  .wc-answer-panel {
    padding: 14px var(--play-pad) 16px; border: 0; border-top: 2px solid #ac955d;
    border-radius: 0 0 9px 9px; background: #fffdf5;
  }
  .wc-meter { margin: 6px 0 12px; height: 4px; }
  .wc-options { --wc-option-face: 56px; counter-reset: wc-option; gap: 8px; }
  .wc-option {
    counter-increment: wc-option; display: grid; grid-template-columns: 20px minmax(0, 1fr);
    align-items: center; justify-items: center; min-height: 52px; padding: 6px; column-gap: 4px;
  }
  .wc-option:hover:enabled { border-color: #738875; }
  .wc-option .wc-tiles { grid-area: 1 / 2; }
  .wc-option .wc-check {
    grid-area: 1 / 1; width: 19px; height: 19px; border-radius: 4px;
    background: #f1eee1; border-color: #c9c4ae; color: #595f52; font: 650 .77rem/1 sans-serif;
  }
  .wc-option .wc-check::before { content: counter(wc-option); }
  .wc-option[aria-pressed="true"] .wc-check { color: #fff; background: var(--wc-green); border-color: var(--wc-green); }
  .wc-options .wc-option[aria-pressed="true"] { border-color: var(--wc-green); }
  .wc-answer-panel .wc-primary { display: flex; width: min(100%, 315px); margin: 12px auto 0; }
  .wc-shortcuts { display: block; text-align: center; margin-top: 6px !important; font-size: .82rem; line-height: 1.4; color: var(--wc-muted); }
}
@media (min-width: 941px) {
  .wc-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wc-options:has(.wc-tile:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wc-option { min-height: 61px; }
}
@media (max-width: 480px) {
  .wc-options:has(.wc-tile:nth-child(4)) { grid-template-columns: minmax(0, 1fr); }
}
