:root {
  color-scheme: light;
  --ink: #203b34;
  --muted: #65776d;
  --paper: #fbf8ee;
  --paper-deep: #f2ead6;
  --line: #d9ddcd;
  --green: #386b50;
  --green-dark: #264b3a;
  --gold: #d6a349;
  --terracotta: #b86243;
  --red-soft: #f5dfd5;
  --shadow: 0 22px 60px rgba(35, 65, 52, .14);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  min-width: 320px;
  min-height: 300px;
  color: var(--ink);
  background: linear-gradient(112deg, rgba(250, 247, 235, .64), rgba(246, 239, 220, .42)), url("fundo-jogo.svg") center / cover no-repeat;
  font-family: "DM Sans", sans-serif;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #d8a848; outline-offset: 3px; }
[hidden] { display: none !important; }

.page-shell {
  display: grid;
  width: min(100%, 1500px);
  height: 100vh;
  height: 100dvh;
  min-height: 300px;
  margin: 0 auto;
  padding: clamp(10px, 2vh, 22px) clamp(14px, 3.2vw, 50px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.7vh, 18px);
  overflow: hidden;
}

.site-header, .site-footer, .brand-lockup, .game-brand, .game-room-meta, .game-topbar,
.room-panel-topline, .game-heading, .scoreboard, .score-player, .words-header,
.room-code-card > div, .player-card, .join-controls, .timer {
  display: flex;
  align-items: center;
}

.site-header, .site-footer { justify-content: space-between; }
.site-header { min-height: 38px; }
.brand-lockup { gap: 10px; }
.brand-sun { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--ink); }
.brand-sun svg { width: 21px; stroke: #f3cd7d; stroke-width: 2.5; stroke-linecap: round; }
.brand-words { display: grid; gap: 1px; }
.brand-words strong { font: 700 .78rem "Space Grotesk", sans-serif; letter-spacing: .1em; }
.brand-words small, .header-note, .site-footer { color: var(--muted); font-size: .59rem; font-weight: 700; letter-spacing: .16em; }
.header-note { margin: 0; }

.welcome-layout {
  display: grid;
  min-height: 0;
  align-items: center;
  grid-template-columns: minmax(0, 1.06fr) minmax(350px, .84fr);
  gap: clamp(28px, 6vw, 92px);
}

.intro { max-width: 660px; padding-left: clamp(0px, 2.2vw, 34px); }
.eyebrow { margin: 0 0 13px; color: var(--green); font-size: .68rem; font-weight: 700; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Space Grotesk", sans-serif; }
h1 { margin-bottom: 19px; font-size: clamp(2.8rem, 5vw, 5.15rem); font-weight: 700; letter-spacing: -.075em; line-height: .98; }
h1 span { color: var(--terracotta); }
.game-description { max-width: 510px; margin-bottom: 25px; color: #43594d; font-size: clamp(.96rem, 1.25vw, 1.13rem); line-height: 1.65; }
.hero-steps { display: flex; flex-wrap: wrap; gap: 9px 20px; color: #54695d; font-size: .74rem; font-weight: 600; }
.hero-steps span { display: flex; align-items: center; gap: 7px; }
.hero-steps b { color: var(--terracotta); font: 700 .65rem "Space Grotesk", sans-serif; }

.lobby-card {
  width: min(100%, 500px);
  justify-self: end;
  padding: clamp(24px, 3vw, 38px);
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 25px;
  background: rgba(255, 253, 247, .96);
  box-shadow: var(--shadow);
}

.lobby-card h2 { margin: 0 0 8px; font-size: clamp(1.65rem, 2.4vw, 2.1rem); letter-spacing: -.06em; }
.lobby-text { margin: 0 0 19px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.primary-button, .secondary-button, .copy-button, .text-button, .restart-button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.primary-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  justify-content: space-between;
  align-items: center;
  padding: 0 17px;
  border-radius: 12px;
  color: white;
  background: var(--green);
  font-size: .9rem;
}
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--green-dark); }
.primary-button span { font-size: 1.25rem; }
.primary-button:disabled { cursor: wait; opacity: .58; }
.join-room { margin-top: 21px; }
.divider-label { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; color: #829086; font-size: .61rem; font-weight: 700; letter-spacing: .1em; }
.divider-label::before, .divider-label::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.join-room label { display: block; margin-bottom: 7px; font-size: .75rem; font-weight: 700; }
.join-controls { gap: 9px; }
.join-controls input { width: 100%; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: 700 .9rem "Space Grotesk", sans-serif; letter-spacing: .17em; text-transform: uppercase; }
.join-controls input::placeholder { color: #a1aa9e; }
.secondary-button { min-width: 86px; height: 46px; padding: 0 16px; border: 1px solid #c9d4c8; border-radius: 10px; color: var(--green-dark); background: #eff3eb; }
.secondary-button:hover { background: #e2ebdf; }
.lobby-status { min-height: 1.2em; margin: 13px 0 0; color: var(--terracotta); font-size: .78rem; font-weight: 700; }

.room-panel-topline { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.room-panel-topline .eyebrow { margin: 0; }
.connection-pill { padding: 6px 10px; border-radius: 30px; color: #7b6540; background: #f6edd8; font-size: .65rem; font-weight: 700; white-space: nowrap; }
.connection-pill.ready { color: var(--green-dark); background: #e2eee3; }
.room-panel h2 { margin-bottom: 6px; font-size: clamp(1.45rem, 2.2vw, 1.85rem); }
.room-panel .lobby-text { margin-bottom: 16px; font-size: .82rem; }
.room-code-card { padding: 12px 14px; border: 1px dashed #b6c4ae; border-radius: 13px; background: #f4f5e9; }
.room-code-card > span { color: #718075; font-size: .58rem; font-weight: 700; letter-spacing: .12em; }
.room-code-card > div { justify-content: space-between; gap: 12px; margin-top: 3px; }
.room-code-card strong { color: var(--ink); font: 700 clamp(1.2rem, 2vw, 1.55rem) "Space Grotesk", sans-serif; letter-spacing: .22em; }
.copy-button { padding: 7px 10px; border: 1px solid #c9d4c8; border-radius: 8px; color: var(--green-dark); background: white; font-size: .69rem; }
.copy-button:hover { background: #e9f0e6; }
.player-roster { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0 14px; }
.player-card { min-width: 0; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .72); }
.player-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: var(--green); font: 700 .8rem "Space Grotesk", sans-serif; }
.waiting-player .player-avatar { color: #768577; background: #e8ebdf; }
.player-identity { display: grid; min-width: 0; gap: 2px; }
.player-identity strong { overflow: hidden; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.player-identity small { color: var(--muted); font-size: .61rem; }
.online-dot, .offline-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-left: auto; border-radius: 50%; background: #5eaa70; box-shadow: 0 0 0 3px #e6f2e5; }
.offline-dot { background: #c5cbbf; box-shadow: none; }
.waiting-player.connected { border-color: #a9c6a5; background: #f5f9f1; }
.waiting-player.connected .player-avatar { color: white; background: var(--terracotta); }
.waiting-player.connected .offline-dot { background: #5eaa70; box-shadow: 0 0 0 3px #e6f2e5; }
.room-panel .primary-button { justify-content: center; }
.room-panel .primary-button span { display: none; }
.text-button { display: block; margin: 10px auto 0; padding: 5px 10px; color: var(--muted); background: transparent; font-size: .72rem; }
.text-button:hover { color: var(--terracotta); }

.initial-hidden, .room-active-hidden { display: none !important; }
.challenge-hidden { display: none !important; }
.game-area { display: grid; min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: clamp(8px, 1.4vh, 16px); }
.game-topbar { min-height: 48px; justify-content: space-between; gap: 18px; }
.game-brand { gap: 9px; }
.game-brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: #f5d283; background: var(--ink); font-size: 1rem; }
.game-brand > span:last-child { display: grid; gap: 1px; }
.game-brand small { color: var(--muted); font-size: .54rem; font-weight: 700; letter-spacing: .13em; }
.game-brand strong { font: 700 .9rem "Space Grotesk", sans-serif; }
.game-room-meta { flex-direction: column; align-items: flex-start; gap: 3px; }
.room-meta-label { color: #718075; font-size: .59rem; font-weight: 700; letter-spacing: .13em; }
.room-meta-label b { margin-left: 4px; color: var(--ink); font-family: "Space Grotesk", sans-serif; letter-spacing: .14em; }
.game-connection { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: .68rem; font-weight: 700; }
.game-connection i { width: 7px; height: 7px; border-radius: 50%; background: #5eaa70; }
.game-timer-side { display: flex; align-items: center; gap: 8px; }
.timer { gap: 9px; padding: 8px 13px; border: 1px solid rgba(214, 163, 73, .48); border-radius: 11px; background: rgba(255, 251, 238, .9); }
.timer-label { color: #87754e; font-size: .57rem; font-weight: 700; letter-spacing: .13em; }
.timer strong { min-width: 47px; font: 700 1.12rem "Space Grotesk", sans-serif; }
.match-result { display: grid; gap: 2px; max-width: 220px; padding: 7px 10px; border: 1px solid #c6d8c4; border-radius: 10px; color: var(--green-dark); background: #eef5e9; font-size: .65rem; }
.match-result strong { font-size: .72rem; }
.match-result span { color: var(--muted); }
.match-result[hidden], .evaluation-screen[hidden], .replay-screen[hidden], .game-card[hidden] { display: none !important; }

.game-card { display: grid; min-height: 0; padding: clamp(14px, 2vh, 23px) clamp(14px, 2.4vw, 32px); border: 1px solid rgba(255, 255, 255, .95); border-radius: 23px; background: rgba(255, 253, 247, .94); box-shadow: var(--shadow); grid-template-rows: auto auto minmax(0, 1fr); gap: clamp(7px, 1.1vh, 12px); overflow: hidden; }
.game-heading { min-height: 42px; justify-content: space-between; gap: 16px; }
.game-title-wrap { display: grid; gap: 2px; }
.game-title-wrap h2 { margin: 0; font-size: clamp(1.05rem, 1.8vw, 1.48rem); letter-spacing: -.05em; }
.phase-badge { color: var(--terracotta); font-size: .56rem; font-weight: 700; letter-spacing: .12em; }
.phase-badge strong { display: inline-grid; width: 17px; height: 17px; place-items: center; margin-left: 2px; border-radius: 50%; color: white; background: var(--terracotta); font-size: .62rem; }
.scoreboard { gap: 10px; }
.score-player { min-width: 72px; justify-content: space-between; gap: 10px; padding: 5px 9px; border: 1px solid #d7e0d2; border-radius: 10px; background: #f3f6ee; }
.score-player span { color: #62756a; font-size: .54rem; font-weight: 700; letter-spacing: .08em; }
.score-player strong { color: var(--green-dark); font: 700 1.15rem "Space Grotesk", sans-serif; }
.opponent-score { border-color: #ebd5c9; background: #fbf0e9; }
.opponent-score strong { color: var(--terracotta); }
.versus { color: #9a9d8f; font: 700 .7rem "Space Grotesk", sans-serif; }
.instruction { margin: 0; color: #607167; font-size: .75rem; line-height: 1.4; }
.game-content { display: grid; min-height: 0; align-items: stretch; grid-template-columns: minmax(0, 1.3fr) minmax(250px, .7fr); gap: clamp(12px, 2vw, 26px); }
.board-column { display: grid; min-width: 0; min-height: 0; place-items: center; }
.word-grid { display: grid; width: min(100%, calc(100dvh - 230px), 650px); aspect-ratio: 1; padding: clamp(5px, .8vw, 11px); border: 1px solid #c5d5c1; border-radius: 19px; background: #e5eddc; grid-template-columns: repeat(var(--grid-size), minmax(0, 1fr)); gap: clamp(2px, .38vw, 5px); user-select: none; touch-action: manipulation; }
.letter { display: grid; min-width: 0; min-height: 0; place-items: center; padding: 0; border: 1px solid rgba(47, 92, 65, .09); border-radius: clamp(4px, .6vw, 8px); color: #29473a; background: #fffdf6; font: 700 clamp(.62rem, 1.05vw, 1.05rem) "Space Grotesk", sans-serif; cursor: pointer; transition: color .15s ease, background .15s ease, transform .15s ease; }
.letter:hover:not(:disabled), .letter:focus-visible { z-index: 1; transform: scale(1.07); border-color: #d5a34c; outline: 2px solid #d5a34c; outline-offset: 1px; }
.letter:disabled { cursor: default; }
.letter.selected { color: white; background: #497958; }
.letter.pending { color: white; background: #c49342; }
.letter.found { color: white; background: #4e9360; box-shadow: inset 0 -4px 0 #39744b; }
.letter.opponent-found { color: white; background: #c97650; box-shadow: inset 0 -4px 0 #a85637; }
.letter.focused { outline: 2px solid #e2b553; outline-offset: 1px; }
.letter.wrong { color: white; background: #c9544e; }
.words-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: clamp(12px, 1.6vw, 22px); border: 1px solid var(--line); border-radius: 16px; background: #faf9f2; }
.words-header { justify-content: space-between; gap: 8px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.words-header h3 { margin: 0; font-size: .93rem; letter-spacing: -.03em; }
#status-label { color: var(--muted); font-size: .63rem; white-space: nowrap; }
.word-list { display: grid; align-content: start; gap: 9px; margin: 13px 0; padding: 0; list-style: none; }
.word-list li { color: var(--ink); font-size: .8rem; font-weight: 700; letter-spacing: .06em; }
.word-list button { padding: 0; border: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.word-list li.found { color: var(--green); text-decoration: line-through; text-decoration-thickness: 2px; }
.word-list li.opponent-found { color: var(--terracotta); text-decoration: line-through; text-decoration-thickness: 2px; }
.word-list li.pending { color: #a77a2d; }
.word-list li.focused button { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.round-complete { display: grid; gap: 3px; padding: 9px; border-radius: 9px; color: var(--green-dark); background: #e6f0e2; font-size: .72rem; }
.round-complete span { color: var(--muted); font-size: .64rem; }
.restart-button { width: 100%; min-height: 38px; margin-top: auto; padding: 8px; border: 1px solid #cbd5c7; border-radius: 9px; color: var(--green-dark); background: transparent; font-size: .7rem; }
.restart-button:hover { border-color: var(--green); background: #edf3e9; }
.evaluation-screen, .replay-screen { display: grid; min-height: 0; place-items: center; padding: clamp(20px, 4vw, 54px); border: 1px solid rgba(255, 255, 255, .95); border-radius: 23px; background: rgba(255, 253, 247, .96); box-shadow: var(--shadow); overflow: auto; }
.evaluation-main, .replay-main { width: min(100%, 600px); }
.evaluation-main > .eyebrow { margin-bottom: 8px; }
.evaluation-main .match-result { max-width: none; margin-bottom: 20px; padding: 12px 14px; font-size: .82rem; }
.evaluation-main .match-result strong { font-size: 1.1rem; }
.evaluation-main .match-result span { font-size: .76rem; }
.evaluation-main h2 { margin-bottom: 5px; font-size: clamp(1.65rem, 3.3vw, 2.5rem); letter-spacing: -.06em; }
.evaluation-copy { margin-bottom: 12px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.rating-scale { display: grid; max-width: 540px; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 5px; }
.rating-choice { min-width: 0; height: 44px; border: 1px solid #cbd5c7; border-radius: 10px; color: var(--green-dark); background: #fff; font-weight: 700; cursor: pointer; }
.rating-choice:hover, .rating-choice:focus-visible, .rating-choice.selected { border-color: var(--green); color: white; background: var(--green); }
.rating-choice:disabled { cursor: default; }
.rating-scale-labels { display: flex; max-width: 540px; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: .68rem; }
.rating-submit { justify-content: center; max-width: 280px; }
.rating-status, .rating-summary { min-height: 1.2em; margin: 9px 0 0; color: var(--muted); font-size: .78rem; }
.rating-summary { color: var(--green-dark); font-weight: 700; }
.replay-main .eyebrow { margin-bottom: 9px; }
.replay-result { max-width: none; margin-bottom: 20px; padding: 13px 15px; font-size: .84rem; }
.replay-result strong { font-size: 1.12rem; }
.replay-main h2 { margin-bottom: 7px; font-size: clamp(1.65rem, 3.3vw, 2.4rem); letter-spacing: -.06em; }
.replay-button { justify-content: center; max-width: 360px; margin-top: 15px; }
.replay-button:disabled { cursor: wait; opacity: .6; }
.site-footer { min-height: 15px; }

body.in-game .page-shell { padding-top: 8px; padding-bottom: 8px; grid-template-rows: minmax(0, 1fr); gap: 0; }
body.in-game .site-header, body.in-game .site-footer { display: none; }

@media (max-width: 760px) {
  .page-shell { padding: 9px 13px; grid-template-rows: auto minmax(0, 1fr) auto; gap: 7px; }
  .site-header { min-height: 33px; }
  .brand-sun { width: 29px; height: 29px; }
  .brand-sun svg { width: 18px; }
  .brand-words strong { font-size: .68rem; }
  .brand-words small { font-size: .48rem; }
  .header-note { display: none; }
  .welcome-layout { grid-template-columns: minmax(0, 1fr); align-content: center; gap: clamp(9px, 2vh, 17px); }
  .intro { padding-left: 2px; }
  .intro .eyebrow { margin-bottom: 7px; font-size: .56rem; }
  h1 { margin-bottom: 8px; font-size: clamp(1.72rem, 7vw, 2.65rem); line-height: 1; }
  .game-description { max-width: 520px; margin-bottom: 0; font-size: .76rem; line-height: 1.38; }
  .hero-steps { display: none; }
  .lobby-card { width: 100%; max-width: none; justify-self: stretch; padding: clamp(16px, 4vw, 23px); border-radius: 19px; }
  .lobby-card .eyebrow { margin-bottom: 7px; font-size: .57rem; }
  .lobby-card h2 { font-size: 1.52rem; }
  .lobby-text { margin-bottom: 13px; font-size: .79rem; }
  .primary-button { min-height: 45px; }
  .join-room { margin-top: 14px; }
  .divider-label { margin-bottom: 10px; font-size: .54rem; }
  .join-room label { font-size: .7rem; }
  .join-controls input, .secondary-button { height: 42px; }
  .secondary-button { min-width: 74px; padding: 0 12px; }
  .lobby-status { margin-top: 8px; font-size: .7rem; }
  .room-panel-topline { margin-bottom: 8px; }
  .room-panel h2 { font-size: 1.37rem; }
  .room-panel .lobby-text { margin-bottom: 11px; font-size: .74rem; }
  .room-code-card { padding: 9px 11px; }
  .room-code-card strong { font-size: 1.18rem; }
  .player-roster { gap: 6px; margin: 9px 0 11px; }
  .player-card { gap: 6px; padding: 7px; }
  .player-avatar { width: 26px; height: 26px; }
  .player-identity strong { font-size: .64rem; }
  .player-identity small { font-size: .56rem; }
  .text-button { margin-top: 6px; }
  .site-footer { min-height: 11px; font-size: .48rem; }
  .site-footer span:last-child { display: none; }

  .game-area { grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
  .game-topbar { min-height: 35px; justify-content: space-between; gap: 8px; }
  .game-brand { display: none; }
  .game-room-meta { gap: 2px; }
  .room-meta-label { font-size: .51rem; }
  .game-connection { font-size: .59rem; }
  .game-timer-side { gap: 5px; }
  .timer { gap: 6px; padding: 5px 8px; border-radius: 8px; }
  .timer-label { font-size: .48rem; }
  .timer strong { min-width: 39px; font-size: .95rem; }
  .game-card { padding: 9px; border-radius: 16px; grid-template-rows: auto auto minmax(0, 1fr); gap: 5px; }
  .game-heading { min-height: 31px; gap: 6px; }
  .game-title-wrap h2 { font-size: .98rem; }
  .phase-badge { font-size: .48rem; }
  .phase-badge strong { width: 14px; height: 14px; font-size: .53rem; }
  .scoreboard { gap: 4px; }
  .score-player { min-width: 60px; gap: 5px; padding: 3px 5px; border-radius: 7px; }
  .score-player span { font-size: .43rem; }
  .score-player strong { font-size: .9rem; }
  .versus { font-size: .55rem; }
  .instruction { font-size: .65rem; line-height: 1.25; }
  .game-content { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 4px; }
  .board-column { overflow: hidden; }
  .word-grid { width: min(100%, calc(100vw - 28px), calc(100dvh - 210px)); padding: 5px; border-radius: 12px; gap: 2px; }
  .letter { border-radius: 4px; font-size: clamp(.53rem, 2.7vw, .83rem); }
  .words-panel { display: grid; padding: 6px 8px; border-radius: 10px; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 3px 7px; }
  .words-header { gap: 6px; padding: 0; border: 0; }
  .words-header h3 { font-size: .68rem; }
  #status-label { font-size: .53rem; }
  .word-list { display: flex; min-width: 0; flex-wrap: wrap; align-content: center; gap: 2px 6px; margin: 0; }
  .word-list li { font-size: .55rem; letter-spacing: .03em; }
  .round-complete { grid-column: 1 / -1; padding: 5px 7px; font-size: .61rem; }
  .round-complete span { font-size: .54rem; }
  .restart-button { min-height: 28px; margin: 0; padding: 4px 7px; grid-column: 1 / -1; font-size: .59rem; }
  body.in-game .page-shell { padding: 6px 8px; }
  .evaluation-screen, .replay-screen { padding: clamp(16px, 5vw, 26px); border-radius: 16px; }
  .evaluation-main, .replay-main { width: 100%; }
  .evaluation-main .match-result { position: static; margin-bottom: 12px; padding: 9px 11px; font-size: .72rem; }
  .evaluation-main .match-result strong { font-size: .94rem; }
  .evaluation-main .match-result span { font-size: .68rem; }
  .evaluation-main h2 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
  .evaluation-copy { margin-bottom: 5px; font-size: .76rem; }
  .rating-scale { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .rating-choice { height: 40px; border-radius: 8px; }
  .rating-scale-labels { font-size: .61rem; }
  .rating-submit { max-width: none; min-height: 42px; }
  .rating-status, .rating-summary { margin-top: 6px; font-size: .69rem; }
  .replay-result { margin-bottom: 12px; padding: 9px 11px; font-size: .72rem; }
  .replay-result strong { font-size: .94rem; }
  .replay-main h2 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
  .replay-button { max-width: none; min-height: 42px; }
}

@media (max-width: 380px) {
  .player-roster { grid-template-columns: 1fr; }
  .player-card { padding: 5px 7px; }
  .game-content { grid-template-rows: minmax(0, 1fr) auto; }
  .words-panel { grid-template-columns: minmax(0, 1fr) auto; }
  .words-header { display: grid; align-content: center; }
  .restart-button { grid-column: 2; grid-row: 1 / span 2; min-height: 32px; }
  .word-list { grid-column: 1 / -1; }
}

@media (max-width: 760px) and (max-height: 500px) {
  .page-shell { padding: 5px 10px; gap: 4px; }
  .site-header { min-height: 26px; }
  .brand-sun { width: 24px; height: 24px; }
  .brand-sun svg { width: 15px; }
  .brand-words strong { font-size: .6rem; }
  .brand-words small { font-size: .43rem; }
  .welcome-layout { gap: 5px; }
  .intro .eyebrow, .game-description { display: none; }
  h1 { margin-bottom: 0; font-size: clamp(1.45rem, 6vw, 2rem); }
  .lobby-card { padding: 12px 15px; }
  .lobby-card .eyebrow { margin-bottom: 4px; }
  .lobby-card h2 { margin-bottom: 3px; font-size: 1.25rem; }
  .lobby-text { margin-bottom: 8px; font-size: .7rem; }
  .primary-button { min-height: 38px; }
  .join-room { margin-top: 8px; }
  .divider-label { margin-bottom: 6px; }
  .join-room label { margin-bottom: 4px; }
  .join-controls input, .secondary-button { height: 36px; }
  .player-roster { grid-template-columns: 1fr 1fr; margin: 6px 0; }
  .player-card { padding: 4px; }
  .player-avatar { width: 22px; height: 22px; }
  .room-panel .lobby-text { margin-bottom: 7px; }
  .room-code-card { padding: 6px 9px; }
  .text-button { margin-top: 3px; }
  .site-footer { min-height: 8px; font-size: .42rem; }
  .game-card { padding: 6px; gap: 3px; }
  .game-heading { min-height: 27px; }
  .instruction { font-size: .58rem; }
  .word-grid { width: min(100%, calc(100vw - 20px), calc(100dvh - 175px)); }
  .words-panel { padding: 4px 6px; }
  .word-list { gap: 1px 5px; }
  .round-complete { padding: 3px 5px; }
  .restart-button { min-height: 24px; }
  body.in-game .page-shell { padding: 4px 6px; }
}

@media (max-height: 560px) and (min-width: 761px) {
  .page-shell { padding-top: 7px; padding-bottom: 7px; gap: 5px; }
  .site-header { min-height: 29px; }
  .brand-sun { width: 27px; height: 27px; }
  .brand-sun svg { width: 17px; }
  h1 { margin-bottom: 10px; font-size: clamp(2.3rem, 5vh, 3.5rem); }
  .game-description { margin-bottom: 12px; font-size: .83rem; }
  .lobby-card { padding: 19px 23px; }
  .game-area { gap: 5px; }
  .game-card { padding-top: 8px; padding-bottom: 8px; gap: 4px; }
  .game-heading { min-height: 29px; }
  .word-grid { width: min(100%, calc(100dvh - 180px), 540px); }
  .words-panel { padding: 9px 12px; }
  .word-list { gap: 5px; margin: 7px 0; }
}
