/* Comfortable reading, touch targets and small-screen game layouts. */
:root { color-scheme: light; }
body, button, input, select { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid #176f63 !important;
  outline-offset: 3px !important;
}
input, select { font-size: 16px !important; }
.header-nav { gap: 18px; }
.language-control select {
  min-height: 42px; max-width: 145px; padding: 0 28px 0 10px;
  border: 1px solid #dfe7e2; border-radius: 11px; background: #fff;
  color: #35443e; font-size: 14px; font-weight: 650;
}
.text-size-control { display: flex; gap: 5px; }
.text-size-control button {
  min-width: 42px; min-height: 42px; padding: 0 8px; border: 1px solid #dfe7e2;
  border-radius: 11px; color: #355c51; background: #fff; font-size: 15px; font-weight: 750;
}
.welcome-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto; background: rgba(17, 31, 29, .48); backdrop-filter: blur(12px);
}
.welcome-card {
  width: min(100%, 530px); padding: clamp(26px, 6vw, 48px); border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px; background: #fff; box-shadow: 0 30px 90px rgba(14,35,30,.24); text-align: center;
}
.welcome-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 18px; border-radius: 15px; background: #eaf3ec; color: #23766a; font-size: 24px; }
.welcome-overline { margin: 0 0 12px; color: #347465; font-size: 12px; line-height: 1.4; font-weight: 750; letter-spacing: .1em; }
.welcome-card h1 { margin: 0 0 12px; font-size: clamp(34px, 8vw, 46px); line-height: 1.2; letter-spacing: -.045em; }
.welcome-card h1 em { color: #23766a; font-style: normal; }
#welcomeGreeting { display: inline-block; transition: opacity .22s ease, transform .22s ease; }
#welcomeGreeting.greeting-fade { opacity: .15; transform: translateY(5px); }
.welcome-copy { max-width: 380px; margin: 0 auto 22px; color: #52615d; font-size: 16px; line-height: 1.6; }
.welcome-languages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 0 0 16px; }
.welcome-language { min-height: 84px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; position: relative; border: 1px solid #e0e8e2; border-radius: 15px; background: #f8faf8; color: #2f3e39; }
.welcome-language > span { font-size: 24px; line-height: 1; }
.welcome-language b { font-size: 14px; }
.welcome-language i { display: none; position: absolute; top: 7px; right: 8px; color: #267869; font-size: 13px; font-style: normal; }
.welcome-language.is-selected { border-color: #267869; background: #eef7f1; box-shadow: 0 0 0 2px rgba(38,120,105,.12); }
.welcome-language.is-selected i { display: block; }
.welcome-continue { width: 100%; min-height: 50px; font-size: 16px; }
.welcome-footnote { margin: 13px 0 0; color: #697773; font-size: 13px; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Replace tiny decorative labels with readable text in the main controls. */
.section-kicker, .eyebrow { font-size: 12px; }
.field-label { font-size: 14px; }
.small-muted { font-size: 12px; }
.name-field, .join-controls input { min-height: 48px; }
.name-field input, .join-controls input { font-size: 16px; }
.game-option { min-height: 62px; }
.game-option span:nth-child(2) b { font-size: 15px; }
.game-option small { font-size: 13px; line-height: 1.35; }
.button { min-height: 46px; font-size: 14px; }
.safety-consent { font-size: 13px; line-height: 1.5; }
.privacy-note, .hero-proof { font-size: 13px; line-height: 1.5; }
.how-heading p, .step-card p { font-size: 14px; line-height: 1.55; }
.step-card h3 { font-size: 16px; }
.room-heading h2 { font-size: 23px; }
.game-headline h3 { font-size: 16px; }
.game-headline p, .turn-indicator, .player-chip { font-size: 13px; }
.video-card-head h3 { font-size: 18px; }
.video-placeholder, .call-status, .media-main b { font-size: 12px; }
.video-name { font-size: 11px; }
.room-tips b { font-size: 13px; }
.room-tips p, .rules-card p, .chat-line { font-size: 13px; line-height: 1.55; }
.rules-card h3, .chat-title { font-size: 15px; }
.chat-empty { font-size: 13px; }
.chat-form input { min-height: 44px; font-size: 16px; }
.legal-footer, .footer-note { font-size: 12px; line-height: 1.6; }
.game-option, .button, .media-button, .icon-button, .back-button, .send-button, .chess-square, .checkers-square, .tic-cell { -webkit-tap-highlight-color: rgba(38,120,105,.16); }
html[data-text-size="large"] .hero-lede,
html[data-text-size="large"] .field-label,
html[data-text-size="large"] .small-muted,
html[data-text-size="large"] .game-option span:nth-child(2) b,
html[data-text-size="large"] .game-option small,
html[data-text-size="large"] .button,
html[data-text-size="large"] .safety-consent,
html[data-text-size="large"] .privacy-note,
html[data-text-size="large"] .hero-proof,
html[data-text-size="large"] .how-heading p,
html[data-text-size="large"] .step-card h3,
html[data-text-size="large"] .step-card p,
html[data-text-size="large"] .game-headline h3,
html[data-text-size="large"] .game-headline p,
html[data-text-size="large"] .turn-indicator,
html[data-text-size="large"] .player-chip,
html[data-text-size="large"] .video-placeholder,
html[data-text-size="large"] .call-status,
html[data-text-size="large"] .video-name,
html[data-text-size="large"] .room-tips b,
html[data-text-size="large"] .room-tips p,
html[data-text-size="large"] .rules-card h3,
html[data-text-size="large"] .rules-card p,
html[data-text-size="large"] .chat-title,
html[data-text-size="large"] .chat-line,
html[data-text-size="large"] .chat-empty,
html[data-text-size="large"] .chat-form input,
html[data-text-size="large"] .legal-footer,
html[data-text-size="large"] .footer-note { font-size: 1.2em; }

.room-access-controls { display: grid; grid-template-columns: 1fr; gap: 7px; margin: 13px 0 8px; }
.room-access-controls .field-label { margin-bottom: 0; }
.room-access-controls select, .room-access-controls input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #e2e9e4; border-radius: 10px; background: #fbfcfa; color: #34433d; }
.public-rooms { margin: 13px 0 8px; padding-top: 12px; border-top: 1px solid #edf0ee; }
.public-rooms-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.public-rooms-head h3 { margin: 0; color: #34443e; font-size: 14px; }
.public-rooms-head button { min-height: 38px; padding: 0 10px; border: 1px solid #e3e9e5; border-radius: 9px; background: #fff; color: #426b5d; font-size: 13px; font-weight: 650; }
.room-list { max-height: 180px; overflow-y: auto; display: grid; gap: 6px; }
.room-list-empty { margin: 3px 0 0; color: #687773; font-size: 13px; line-height: 1.5; }
.room-list-item { min-height: 61px; display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid #e7ede8; border-radius: 11px; background: #f8faf8; }
.room-list-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.room-list-copy b { color: #31483c; font-size: 14px; }
.room-list-copy span, .room-list-copy small { color: #66746f; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.room-list-join { min-width: 98px; min-height: 42px; border: 0; border-radius: 9px; background: #e8f2eb; color: #276453; font-size: 13px; font-weight: 700; }
.game-icon.durak-icon { color: #a64d46; background: #f7eae6; font-size: 24px; }
.game-icon.tic-icon { color: #547d72; background: #e8f1ed; font-size: 18px; font-weight: 800; letter-spacing: -.08em; }
.durak-board { width: min(100%, 670px); min-height: 390px; padding: clamp(14px, 3vw, 24px); display: flex; flex-direction: column; justify-content: space-between; border: 1px solid #fff; border-radius: 20px; background: radial-gradient(ellipse at center, #dcebe0, #c4d8cb); box-shadow: 0 14px 35px rgba(39,59,50,.11); }
.durak-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; color: #385b4b; font-size: 14px; }
.opponent-cards { display: flex; padding-top: 7px; }
.card-back { width: 26px; height: 36px; margin-left: -8px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 5px; background: #5c8571; color: #e6f1e7; font-size: 12px; }
.durak-deck-info { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; }
.durak-deck-info small { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.playing-card { width: 39px; height: 55px; display: inline-flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 5px; border: 1px solid #e4e8e4; border-radius: 7px; background: #fff; color: #26342f; box-shadow: 0 2px 5px rgba(25,50,40,.12); font-size: 14px; }
.playing-card i { align-self: flex-end; font-size: 18px; line-height: 1; font-style: normal; }
.playing-card.red, .durak-hand-card.red { color: #bf514b; }
.durak-table { min-height: 140px; padding: 13px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 12px; border: 1px dashed rgba(67,111,86,.3); border-radius: 16px; background: rgba(245,250,245,.46); }
.durak-pair { min-width: 76px; display: grid; grid-template-columns: 1fr 18px 1fr; align-items: center; gap: 3px; }
.durak-attack, .durak-defense { display: grid; place-items: center; min-height: 62px; }
.durak-arrow { color: #688577; text-align: center; font-size: 14px; }
.durak-open-target, .durak-cover-target { width: 35px; height: 48px; justify-self: center; display: grid; place-items: center; border: 1px dashed #799984; border-radius: 7px; color: #376e57; background: rgba(255,255,255,.55); font-size: 22px; }
.durak-empty { width: 100%; margin: 0; color: #526f60; text-align: center; font-size: 15px; }
.durak-actions { display: flex; justify-content: center; gap: 9px; }
.durak-actions .button { min-width: min(42%, 190px); }
.durak-hint { margin: 0; color: #4e675a; text-align: center; font-size: 13px; }
.durak-hand { display: flex; justify-content: center; gap: 7px; padding: 4px 0 2px; overflow-x: auto; }
.durak-hand-card { flex: 0 0 auto; width: clamp(43px, 8vw, 58px); height: clamp(66px, 13vw, 82px); padding: 7px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; border: 1px solid #e1e7e2; border-radius: 9px; background: #fff; color: #26342f; box-shadow: 0 3px 8px rgba(25,50,40,.12); font-size: 17px; transition: transform .16s ease, box-shadow .16s ease; }
.durak-hand-card i { align-self: flex-end; font-size: 22px; line-height: 1; font-style: normal; }
.durak-hand-card.selected { transform: translateY(-8px); box-shadow: 0 0 0 3px #e5c66f; }
.durak-hand-card:disabled { opacity: .62; cursor: default; }
.durak-actions button:disabled { opacity: .5; cursor: not-allowed; }
.tic-board { width: min(100%, 390px); aspect-ratio: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: clamp(6px, 1.8vw, 12px); }
.tic-cell { min-width: 60px; min-height: 60px; border: 1px solid #e5ebe7; border-radius: clamp(12px, 3vw, 19px); background: #fff; color: #27776b; box-shadow: 0 7px 20px rgba(40,75,62,.08); font-size: clamp(48px, 13vw, 82px); font-weight: 650; line-height: 1; }
.tic-cell:not(:disabled):hover { background: #eff7f1; border-color: #8cb9a0; }
.tic-cell:disabled { cursor: default; }
.tic-cell.tic-o { color: #bf7a56; }

@media (min-width: 791px) {
  .landing { min-height: 1030px; }
}

@media (max-width: 790px) {
  .header-nav { gap: 8px; }
  .language-control select { max-width: 126px; }
  .text-size-control { gap: 4px; }
  .text-size-control button { min-width: 40px; min-height: 42px; }
  .board-stage { padding-top: 16px; padding-bottom: 16px; }
  .durak-board { min-height: 360px; }
}
@media (max-width: 540px) {
  .site-header { height: 72px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); gap: 7px; }
  .brand { gap: 5px; }
  .brand-mark, .brand-mark svg { width: 29px; height: 29px; }
  .brand-name { font-size: 17px; }
  .header-nav { gap: 5px; }
  .online-pill, .header-nav > a { display: none; }
  .language-control select { width: 112px; min-height: 42px; padding-left: 7px; padding-right: 4px; font-size: 13px !important; }
  .text-size-control button { min-width: 37px; padding: 0 5px; }
  .welcome-card { border-radius: 22px; padding: 28px 19px; }
  .welcome-language { min-height: 78px; font-size: 12px; }
  .durak-board { min-height: 350px; padding: 12px 9px; }
  .durak-top { font-size: 12px; }
  .durak-deck-info { font-size: 12px; }
  .durak-table { min-height: 112px; gap: 5px; padding: 7px; }
  .durak-pair { min-width: 66px; }
  .durak-actions { gap: 6px; }
  .durak-actions .button { min-width: 0; flex: 1; padding: 0 5px; font-size: 12px; }
  .durak-hand { justify-content: flex-start; }
  .durak-hand-card { width: 45px; height: 67px; }
  .tic-board { width: min(100%, 330px); }
  .tic-cell { min-width: 54px; min-height: 54px; }
  .public-rooms { margin-top: 10px; }
  .room-list { max-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Lightweight lobby, conversation and game controls. */
.prominent-consent { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; padding: 13px 14px; border: 1px solid #c58b38; border-radius: 13px; background: #fff5d9; color: #5a3c11; font-size: 14px; font-weight: 700; line-height: 1.45; }
.prominent-consent input { width: 21px; height: 21px; flex: 0 0 auto; margin: 1px 0 0; accent-color: #8a5a0b; }
.device-setup { margin: 13px 0; padding: 14px; border: 1px solid #e0e9e3; border-radius: 15px; background: #f7faf7; }
.device-setup-copy { display: flex; align-items: flex-start; gap: 10px; }
.device-setup-copy h3 { margin: 0 0 4px; color: #31473b; font-size: 15px; }
.device-setup-copy p, .setup-status { margin: 0; color: #65736d; font-size: 13px; line-height: 1.5; }
.setup-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 11px; background: #e4f0e7; color: #27766b; }
.device-setup-actions, .online-entry-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.device-setup-actions .button { flex: 1 1 145px; }
.setup-preview { display: block; width: min(100%, 220px); aspect-ratio: 16/9; margin-top: 10px; border-radius: 10px; background: #172722; object-fit: cover; }
.setup-status { min-height: 1.4em; margin-top: 7px; }
.online-entry-row > .button { flex: 1 1 190px; }
.online-state { color: #697770; font-size: 13px; }
.online-state.is-online { color: #26755d; font-weight: 700; }
.players-panel { margin: 13px 0 18px; padding: 12px; border: 1px solid #e7ede8; border-radius: 14px; background: #fff; }
.player-list { max-height: 230px; overflow-y: auto; display: grid; gap: 8px; }
.player-list-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #edf1ed; border-radius: 12px; background: #f9fbf9; }
.player-card-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.player-card-copy b { color: #30443a; overflow-wrap: anywhere; }
.player-card-copy small { color: #718078; font-size: 12px; }
.player-status { display: flex; align-items: center; gap: 6px; color: #66756d; font-size: 12px; }
.player-status i { width: 8px; height: 8px; border-radius: 50%; background: #b89b59; }
.player-status.available { color: #26755d; }
.player-status.available i { background: #3d9b6e; }
.player-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.player-card-actions .button { min-height: 38px; padding: 0 9px; font-size: 12px; }
.player-card-actions .button:disabled { opacity: .55; cursor: not-allowed; }
.time-control-label { display: block; margin: 8px 0 5px; color: #65736d; font-size: 13px; font-weight: 650; }
.time-control-select { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid #e2e9e4; border-radius: 10px; background: #fbfcfa; color: #34433d; }
.game-control-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 10px 12px; border-bottom: 1px solid #edf1ee; }
.game-control-bar .button, .game-control-bar .icon-button { min-height: 38px; }
.game-switch-control { display: flex; flex: 1 1 250px; gap: 6px; }
.game-switch-control select { min-width: 105px; flex: 1; min-height: 40px; padding: 0 8px; border: 1px solid #dfe7e2; border-radius: 10px; background: #fff; color: #34433d; }
.button-danger { border: 1px solid #efd5d0; background: #fff3f0; color: #9b4238; }
.board-footer .player-chip { min-width: 0; }
.player-chip.active-turn { border-color: #c9a54c; background: #fff8df; box-shadow: 0 0 0 2px rgba(201,165,76,.16); }
.chess-clock { margin-left: auto; color: #34443b; font-variant-numeric: tabular-nums; font-size: 16px; }
.chess-square.light { background: #f0d9b5; }
.chess-square.dark { background: #a87550; }
.chess-square.last-move { background-image: linear-gradient(rgba(243,214,91,.56), rgba(243,214,91,.56)); }
.chess-square.legal::after { background: rgba(22,96,69,.55); }
.conversation-board { width: min(100%, 650px); min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.conversation-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 14px; border-radius: 18px; background: #e5f1e9; color: #26766a; font-size: 27px; }
.conversation-board h3 { margin: 0 0 8px; color: #30483d; font-size: 24px; }
.conversation-board p { max-width: 420px; color: #61716a; line-height: 1.55; }
.conversation-game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(100%, 450px); margin-top: 8px; }
.conversation-game-actions select { min-height: 46px; flex: 1 1 150px; padding: 0 10px; border: 1px solid #dfe7e2; border-radius: 10px; background: #fff; color: #34433d; }
.conversation-stage { min-height: 350px; }
.invite-dialog { width: min(calc(100% - 32px), 440px); padding: 0; border: 0; border-radius: 23px; box-shadow: 0 24px 80px rgba(20,40,31,.28); }
.invite-dialog::backdrop { background: rgba(17,31,29,.48); backdrop-filter: blur(5px); }
.invite-dialog-inner { padding: 26px; text-align: center; }
.invite-dialog-inner h2 { margin: 0 0 10px; color: #30443a; font-size: 22px; }
.invite-dialog-inner p { color: #5e6e66; line-height: 1.5; }
.invite-dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
.invite-dialog-actions .button { flex: 1; }
#boardStage:fullscreen { display: grid; place-items: center; width: 100vw; height: 100vh; padding: 18px; background: #f7f8f5; }
#boardStage:fullscreen .board-zone { width: min(90vmin, 900px); }
#boardStage:fullscreen .chess-board { width: 100%; }
#remoteVideo { background: #1a2a25; }
@media (max-width: 600px) {
  .player-list-item { align-items: flex-start; flex-direction: column; }
  .player-card-actions { width: 100%; }
  .player-card-actions .button { flex: 1; }
  .game-control-bar { gap: 6px; }
  .game-control-bar > .button { flex: 1 1 125px; }
  .game-switch-control { flex-basis: 100%; }
  .conversation-board { min-height: 260px; padding: 20px 10px; }
}
