:root {
  --gr-bg: #07100f;
  --gr-surface: #0d1718;
  --gr-surface-2: #111d1f;
  --gr-ink: #f5f8f6;
  --gr-muted: #8ca0a3;
  --gr-line: #27444a;
  --gr-cyan: #48c3d9;
  --gr-green: #22bc92;
  --gr-yellow: #f0d54b;
  --gr-red: #e34d59;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--gr-bg); }
body.gr-page { min-height: 100vh; margin: 0; color: var(--gr-ink); background: var(--gr-bg); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(72, 195, 217, .55); outline-offset: 3px; }

.gr-topbar { display: flex; align-items: center; gap: 18px; padding: 12px 24px; border-bottom: 1px solid #183034; background: #07100f; }
.gr-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.gr-logo { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: #07100f; background: var(--gr-yellow); font: 850 20px/1 Georgia, serif; }
.gr-brand > span:last-child { display: grid; gap: 2px; }
.gr-brand strong { font-size: 16px; }
.gr-brand small { color: var(--gr-muted); font-size: 11px; }
.gr-nav { display: flex; gap: 8px; margin-left: auto; }
.gr-nav a { padding: 8px 10px; border-radius: 9px; color: #9bb0b3; font-size: 12px; font-weight: 750; text-decoration: none; }
.gr-nav a:hover { color: #dff5f7; background: #0d1c1f; }

.gr-shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.gr-card { border: 1px solid var(--gr-line); border-radius: 14px; background: var(--gr-surface); }
.gr-hero { max-width: 860px; margin: 0 auto 22px; text-align: center; }
.gr-hero h1 { margin: 0; font-size: clamp(34px, 5vw, 62px); line-height: 1.04; letter-spacing: -0.04em; }
.gr-hero p { max-width: 720px; margin: 13px auto 0; color: var(--gr-muted); font-size: 14px; line-height: 1.75; }
.gr-setup-card { max-width: 900px; margin: 0 auto; padding: 22px; }
.gr-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gr-field { display: grid; gap: 7px; color: #b8c8ca; font-size: 12px; font-weight: 800; }
.gr-field input, .gr-field select { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #315159; border-radius: 10px; color: #f5f8f6; background: #081113; outline: none; }
.gr-field input:focus, .gr-field select:focus { border-color: var(--gr-cyan); box-shadow: 0 0 0 3px rgba(72, 195, 217, .12); }
.gr-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.gr-primary, .gr-secondary, .gr-ghost { min-height: 46px; padding: 0 17px; border-radius: 11px; font-weight: 850; }
.gr-primary { border: 0; color: #07100f; background: var(--gr-yellow); }
.gr-secondary { border: 1px solid #2f8194; color: #83dced; background: #0b2025; }
.gr-ghost { border: 1px solid #33545a; color: #c8d6d8; background: #0f1a1c; }
.gr-primary:hover { background: #f5dc63; }
.gr-secondary:hover { border-color: #5cc9df; background: #102a30; }
.gr-ghost:hover { border-color: #5b747a; color: #e5eff0; }
.gr-message { min-height: 20px; margin: 12px 0 0; color: #889c9f; font-size: 12px; }
.gr-settings-card { max-width: 900px; margin: 16px auto 0; overflow: hidden; }
.gr-settings-card summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; cursor: pointer; list-style: none; }
.gr-settings-card summary::-webkit-details-marker { display: none; }
.gr-settings-card summary > span:first-child { display: grid; gap: 3px; }
.gr-settings-card summary b { font-size: 15px; }
.gr-settings-card summary small, .gr-settings-card summary > span:last-child { color: var(--gr-muted); font-size: 11px; }
.gr-settings-card[open] summary { border-bottom: 1px solid #213b40; }
.gr-settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; padding: 18px 20px; }
.gr-word-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 900px; margin: 16px auto 0; padding: 16px 20px; }
.gr-word-status > div { display: grid; gap: 3px; }
.gr-word-status span { color: var(--gr-muted); font-size: 11px; }
.gr-word-status strong { font-size: 15px; }
.gr-word-status a { color: var(--gr-cyan); font-size: 12px; font-weight: 800; text-decoration: none; }

.gr-room-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; margin-bottom: 16px; }
.gr-room-head > div { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.gr-room-head span { color: var(--gr-muted); font-size: 12px; }
.gr-room-head strong { color: var(--gr-yellow); font-size: 28px; letter-spacing: .12em; }
.gr-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.gr-section-head h2 { margin: 0; font-size: 20px; }
.gr-section-head p { margin: 5px 0 0; color: var(--gr-muted); font-size: 12px; }
#grConnectionStatus, #grGameConnection { color: var(--gr-cyan); font-size: 12px; font-weight: 800; }
.gr-lobby > .gr-card:nth-child(2) { padding: 20px; }
.gr-player-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.gr-player-card { min-height: 120px; padding: 15px; border: 1px solid #2a484e; border-radius: 12px; background: #0f1a1c; }
.gr-player-card.is-me { border-color: #4aaec2; box-shadow: inset 0 0 0 1px rgba(72,195,217,.18); }
.gr-player-card h3 { margin: 0; font-size: 16px; }
.gr-player-card p { margin: 7px 0 0; color: var(--gr-muted); font-size: 11px; }
.gr-ready { display: inline-flex; margin-top: 14px; padding: 4px 8px; border-radius: 999px; color: #9fb0b2; background: #172426; font-size: 10px; font-weight: 800; }
.gr-ready.yes { color: #6ee0b7; background: #12372c; }
.gr-lobby-actions { margin-top: 18px; }

.gr-game-bar { display: flex; align-items: center; gap: 18px; padding: 12px 16px; margin-bottom: 14px; }
.gr-timer { display: grid; gap: 3px; min-width: 110px; }
.gr-timer span, .gr-my-stats span, .gr-rank span { color: var(--gr-muted); font-size: 10px; font-weight: 750; }
.gr-timer strong { color: var(--gr-cyan); font-size: 24px; font-variant-numeric: tabular-nums; }
.gr-my-stats { display: flex; gap: 10px; margin-left: auto; }
.gr-my-stats span { padding: 8px 10px; border: 1px solid #29474d; border-radius: 10px; background: #0f1a1c; }
.gr-my-stats b { color: #f5f8f6; font-size: 15px; }
.gr-rank { display: grid; gap: 3px; min-width: 70px; text-align: right; }
.gr-rank strong { color: var(--gr-yellow); font-size: 25px; }
.gr-live-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(270px, .55fr); gap: 14px; }
.gr-question-card, .gr-rank-card { min-height: 680px; padding: 20px; }
.gr-question-card { display: flex; flex-direction: column; }
.gr-timer-track { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: #1a2c30; }
.gr-timer-track span { display: block; width: 100%; height: 100%; background: var(--gr-cyan); transform-origin: left; }
.gr-clue { display: grid; min-height: 190px; align-content: center; margin: 6px 0 14px; font-size: clamp(32px, 4vw, 66px); font-weight: 850; line-height: 1.08; letter-spacing: -0.035em; text-wrap: balance; }
.gr-options { display: grid; flex: 1; min-height: 280px; gap: 12px; padding: 12px; border: 1px solid #213c42; border-radius: 16px; background: #071011; }
.gr-options[data-count="2"], .gr-options[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gr-options[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gr-options[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gr-options[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gr-option { min-height: 112px; padding: 12px; border: 1px solid #46616a; border-radius: 12px; color: #f7faf8; background: #172326; box-shadow: 0 5px 0 #020607; font-size: clamp(22px, 2.4vw, 42px); font-weight: 850; overflow-wrap: anywhere; }
.gr-option:hover:not(:disabled) { border-color: #61c9df; background: #1c2d31; }
.gr-option.is-correct { color: #fff; border-color: #2bc69d; background: #168a69; }
.gr-option.is-wrong { color: #fff; border-color: #f06d77; background: #bd3845; animation: gr-shake 300ms ease-in-out; }
.gr-option.is-dimmed { opacity: .55; }
@keyframes gr-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 50%{transform:translateX(6px)} 75%{transform:translateX(-3px)} }
.gr-feedback { min-height: 25px; margin: 13px 0 0; color: var(--gr-muted); font-size: 14px; font-weight: 800; }
.gr-feedback[data-tone="correct"] { color: #45d5a9; }
.gr-feedback[data-tone="wrong"], .gr-feedback[data-tone="timeout"] { color: #f27a84; }
.gr-rank-list { display: grid; gap: 10px; margin-top: 18px; }
.gr-rank-row { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px; border: 1px solid #28454b; border-radius: 11px; background: #0f1a1c; }
.gr-rank-row.is-me { border-color: #418fa0; }
.gr-rank-row > b { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: #07100f; background: var(--gr-yellow); }
.gr-rank-row strong { display: block; font-size: 14px; }
.gr-rank-row span, .gr-rank-row small { color: var(--gr-muted); font-size: 10px; }
.gr-rank-row div:last-child { grid-column: 2; }
.gr-result-card { max-width: 850px; margin: 40px auto 0; padding: 26px; }
.gr-result-card h2 { margin: 0; font-size: 36px; letter-spacing: -.035em; }
.gr-result-card > p { color: var(--gr-muted); }
.gr-result-list { display: grid; gap: 10px; margin-top: 20px; }
.gr-result-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #29474d; border-radius: 12px; background: #0f1a1c; }
.gr-result-row > b { color: var(--gr-yellow); font-size: 20px; }
.gr-result-row strong { display: block; }
.gr-result-row span { color: var(--gr-muted); font-size: 11px; }

@media (max-width: 1050px) {
  .gr-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gr-live-layout { grid-template-columns: 1fr; }
  .gr-question-card, .gr-rank-card { min-height: 0; }
  .gr-player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .gr-topbar { flex-wrap: wrap; padding: 10px 12px; }
  .gr-nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .gr-nav a { flex: 0 0 auto; }
  .gr-shell { width: calc(100% - 20px); padding-top: 18px; }
  .gr-hero h1 { font-size: 34px; }
  .gr-grid-2, .gr-settings-grid, .gr-player-grid { grid-template-columns: 1fr; }
  .gr-room-head { flex-wrap: wrap; }
  .gr-room-head > div { width: 100%; }
  .gr-game-bar { flex-wrap: wrap; }
  .gr-my-stats { order: 3; width: 100%; margin-left: 0; }
  .gr-my-stats span { flex: 1; }
  .gr-question-card, .gr-rank-card { padding: 15px; }
  .gr-clue { min-height: 150px; font-size: clamp(28px, 9vw, 44px); }
  .gr-options { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .gr-option { min-height: 84px; font-size: 20px; }
  .gr-result-row { grid-template-columns: 36px minmax(0, 1fr); }
  .gr-result-row > span:last-child { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.gr-word-status-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.gr-word-status-actions select {
  min-height: 38px;
  max-width: 330px;
  padding: 0 10px;
  border: 1px solid #315159;
  border-radius: 9px;
  color: #dce7e8;
  background: #081113;
}

.gr-word-status-actions select:focus {
  border-color: var(--gr-cyan);
  outline: none;
}

@media (max-width: 700px) {
  .gr-word-status { align-items: flex-start; flex-direction: column; }
  .gr-word-status-actions { width: 100%; flex-wrap: wrap; }
  .gr-word-status-actions select { max-width: none; flex: 1 1 100%; }
}
