/* Quiet, tactile finishing touches. Load after game-polish.css. */
.room-layout :is(button, [role="button"], input, select, textarea):focus-visible,
.external-bar button:focus-visible { outline: 3px solid #bc623e; outline-offset: 4px; }
.room-layout .btn, .external-bar .btn { min-height: 44px; white-space: normal; line-height: 1.35; }
.room-layout .btn { transition: background-color .16s, border-color .16s, box-shadow .16s, transform .16s; }
.room-layout .btn:not(.line):not(.soft):not(.danger) { box-shadow: 0 2px 0 #18251c1c, inset 0 1px 0 #ffffff18; }
.room-layout .btn:active:not(:disabled) { transform: translateY(1px); }
.room-layout .btn:disabled { opacity: .58; }
.room-layout .game-stage :is(p, h2, h3, strong), .room-layout .album-title { overflow-wrap: anywhere; }
.room-layout .game-stage .row > *, .external-bar .row > * { min-width: 0; }
.room-layout .game-stage .row { flex-wrap: wrap; }
.room-layout .game-stage .fine { line-height: 1.65; }
.room-layout .game-stage .progress { height: 8px; background: #e5e8da; }
.room-layout .game-stage .progress span { border-radius: inherit; background: linear-gradient(90deg, #cc6546, #dfa269); }
.room-layout .big-state { padding-block: clamp(32px, 5vw, 62px); }
.room-layout .big-state .progress { max-width: 350px; margin: 24px auto; }

/* The lobby is a small invitation, not a settings screen. */
.room-layout[data-room-status="lobby"] .game-stage > .panel { background: linear-gradient(155deg, #fffdf5, #f5f3e9); border-color: #d9dfce; }
.room-layout[data-room-status="lobby"] .lobby-cover { max-height: 235px; box-shadow: 0 7px 22px #34402b12; border: 1px solid #ffffff9c; }
.room-layout[data-room-status="lobby"] .game-stage h2 { font-size: clamp(29px, 3vw, 40px); }
.room-layout[data-room-status="lobby"] .game-stage > .panel > .muted { max-width: 58ch; line-height: 1.7; }
.room-layout .lobby-options { padding: 18px; background: #e9eddf; border: 1px solid #dfe5d4; border-radius: 16px; }
.room-layout .lobby-options input { min-height: 46px; background: #fffdf6; font-variant-numeric: tabular-nums; }
.room-layout .lobby-options label { color: #42513e; font-size: 12px; }
.room-layout[data-room-status="lobby"] .room-code { padding: 8px 10px; background: #eef0e6; border-radius: 9px; }

/* Stille Post: paper, ink and a generous drawing desk. */
.room-layout[data-room-game="draw"] .game-stage > .panel { background: #faf8ef; border-color: #dcdccc; }
.room-layout[data-room-game="draw"] .task-heading { padding-bottom: 18px; border-bottom: 1px solid #e1e4d7; }
.room-layout[data-room-game="draw"] .task-heading .eyebrow { color: #ad5536; }
.room-layout[data-room-game="draw"] .prompt { position: relative; padding: 24px 26px; border: 1px solid #e6d5a6; border-left: 4px solid #ca8650; border-radius: 5px 15px 15px 5px; background: #f4e9c7; color: #4b412c; box-shadow: 0 4px 0 #e9dfc440; font-size: clamp(21px, 2.2vw, 28px); }
.room-layout[data-room-game="draw"] .draw-tools { gap: 8px; padding: 12px; background: #e8ecdf; border: 1px solid #d9dfcd; border-radius: 16px; margin-block: 20px 16px; }
.room-layout[data-room-game="draw"] .swatch { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid transparent; border-radius: 12px; outline: none; background: radial-gradient(circle, var(--color) 0 11px, #aeb6a7 11px 12px, transparent 13px); transition: background-color .15s, box-shadow .15s; }
.room-layout[data-room-game="draw"] .swatch.active { background-color: #fffdf4; border-color: #344e3a; box-shadow: 0 0 0 1px #344e3a, 0 3px 7px #2e402916; }
.room-layout[data-room-game="draw"] .swatch:focus-visible { outline: 3px solid #bc623e; outline-offset: 3px; }
.room-layout[data-room-game="draw"] .draw-tools input[type="range"] { width: 108px; min-width: 80px; height: 44px; flex: 1 1 100px; max-width: 180px; accent-color: #3f5a40; cursor: pointer; }
.room-layout[data-room-game="draw"] .draw-tools .btn { background: #f8f9f0; border-color: #cdd6c2; }
.room-layout[data-room-game="draw"] .canvas-wrap { border: 8px solid #fff; outline: 1px solid #d8ddcf; border-radius: 8px; box-shadow: 0 6px 0 #e6e5d6, 0 14px 25px #3445280f; }
.room-layout[data-room-game="draw"] .drawing-preview { display: block; border: 7px solid white; outline: 1px solid #dde1d3; border-radius: 8px; box-shadow: 0 4px 12px #293e2510; }
.room-layout[data-room-game="draw"] #draw-text-form { margin-top: 24px; }
.room-layout[data-room-game="draw"] #draw-text-form label { color: #48583e; letter-spacing: .02em; margin-bottom: 10px; }
.room-layout[data-room-game="draw"] #drawing-text { min-height: 164px; padding: 15px 20px; border-color: #d8ddcc; border-radius: 8px; background: repeating-linear-gradient(#fffdf6 0 31px, #e7ebde 31px 32px); color: #293b2e; font-family: Georgia, serif; font-size: 20px; line-height: 32px; resize: vertical; box-shadow: 0 4px 0 #e8e8da; }
.room-layout[data-room-game="draw"] #drawing-text::placeholder { color: #78816b; }
.room-layout[data-room-game="draw"] .album-controls { padding: 12px; border: 1px solid #d9dfcc; border-radius: 14px; background: #e9eddf; gap: 10px; margin-block: 24px; }
.room-layout[data-room-game="draw"] .album-controls > .btn { flex: 0 0 44px; padding: 8px; background: #fffdf5; }
.room-layout[data-room-game="draw"] .album-title { flex: 1; text-align: center; line-height: 1.6; color: #46523f; font-size: 13px; }
.room-layout[data-room-game="draw"] .album-title .avatar { vertical-align: middle; margin-right: 5px; }
.room-layout[data-room-game="draw"] .album-pages { position: relative; gap: 24px; padding-left: 25px; }
.room-layout[data-room-game="draw"] .album-pages::before { content: ""; position: absolute; left: 7px; top: 27px; bottom: 28px; width: 2px; background: #d6dfc8; }
.room-layout[data-room-game="draw"] .album-page { position: relative; padding: 20px; background: #fffdf7; border-color: #dde0d1; border-radius: 13px; box-shadow: 0 3px 0 #e8e8dc, 0 10px 18px #34442808; }
.room-layout[data-room-game="draw"] .album-page::before { content: ""; position: absolute; left: -26px; top: 23px; width: 16px; height: 16px; background: #9eaf87; border: 4px solid #faf8ef; border-radius: 50%; }
.room-layout[data-room-game="draw"] .album-page:nth-child(even)::before { background: #c47c53; }
.room-layout[data-room-game="draw"] .album-page > .row { padding-bottom: 13px; border-bottom: 1px solid #ececdf; gap: 8px; color: #52604b; }
.room-layout[data-room-game="draw"] .album-page > .row small { margin-left: auto; font-size: 10px; letter-spacing: .06em; }
.room-layout[data-room-game="draw"] .album-page > p { line-height: 1.5; color: #344530; }
.room-layout[data-room-game="draw"] .album-page .drawing-preview { max-height: 340px; object-fit: contain; outline: none; box-shadow: none; border-width: 0; }

/* Werwolf: the same village in daylight and after dark. */
.room-layout[data-room-game="werewolf"] .role-panel { position: relative; overflow: hidden; padding: clamp(22px, 3vw, 32px); min-height: 210px; border: 1px solid #4b6452; border-radius: 20px; background-color: #233b33; background-image: linear-gradient(90deg, #172c28f5 0%, #233b30de 48%, #263e3755 100%), url('/assets/werewolf.webp'); background-size: cover; background-position: center 48%; box-shadow: 0 5px 0 #d4dacb, 0 16px 28px #223e2812; }
.room-layout[data-room-game="werewolf"] .role-panel h2 { font-size: clamp(32px, 3.4vw, 44px); color: #fff5dd; margin-block: 13px; }
.room-layout[data-room-game="werewolf"] .role-panel p { max-width: 52ch; line-height: 1.7; color: #e1e7d7; }
.room-layout[data-room-game="werewolf"] .role-panel .eyebrow { color: #f1c57e; font-size: 10px; letter-spacing: .18em; }
.room-layout[data-room-game="werewolf"] .game-stage > .panel { border-color: #d5ddc7; background: linear-gradient(145deg, #fffdf3, #f2f1e1); }
.room-layout[data-room-game="werewolf"] .big-state { padding-block: 34px; }
.room-layout[data-room-game="werewolf"] .target-grid { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.room-layout[data-room-game="werewolf"] .target { min-width: 0; min-height: 134px; padding: 17px 12px; border: 1px solid #d4ddc9; border-radius: 16px; background: #fffef7; color: #31482f; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; box-shadow: 0 4px 0 #e0e6d5, 0 8px 15px #2a442410; transition: transform .16s, border-color .16s, background-color .16s; }
.room-layout[data-room-game="werewolf"] .target img { width: 56px; height: 56px; margin-bottom: 12px; border-radius: 18px; outline: 3px solid #edf1e4; outline-offset: 3px; }
.room-layout[data-room-game="werewolf"] .target small { display: block; margin-top: 7px; color: #66765b; font-size: 11px; font-weight: 400; }
.room-layout[data-room-game="werewolf"] .target.selected { border-color: #b65a37; background: #fff0d9; outline: 2px solid #cb80574d; outline-offset: 2px; box-shadow: 0 4px 0 #ead1ae; }
.room-layout[data-room-game="werewolf"] .target:disabled { opacity: .55; box-shadow: none; filter: saturate(.6); }
.room-layout[data-room-game="werewolf"] .event-list { margin: 25px 0 0; padding: 0 0 0 18px; border-left: 2px solid #dbe2cd; color: #63735a; }
.room-layout[data-room-game="werewolf"] .event-list li { position: relative; padding: 11px 0; line-height: 1.55; font-size: 12px; border-bottom-color: #e4e7d9; }
.room-layout[data-room-game="werewolf"] .event-list li::before { content: ""; width: 6px; height: 6px; position: absolute; left: -22px; top: 18px; background: #9aaf7c; border-radius: 50%; }
.room-layout[data-room-game="werewolf"] .event-list li:last-child { border-bottom: 0; }
.room-layout[data-room-game="werewolf"] .vision { border: 1px solid #d4dccc; background: #eaf0df; color: #3d593a; line-height: 1.6; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .role-panel { border-color: #425665; background-image: linear-gradient(90deg, #162535f5, #213244d9 48%, #142c3c55), url('/assets/werewolf.webp'); box-shadow: 0 5px 0 #cdd4d1, 0 16px 28px #172b3517; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .game-stage > .panel { background: radial-gradient(ellipse at top right, #30484d, #202f36 72%); border-color: #3b5155; color: #f3efdf; box-shadow: 0 8px 22px #192c3218; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .game-stage > .panel :is(.muted, .fine, .task-heading p) { color: #c0cfc9; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .game-stage > .panel .eyebrow { color: #e2bc7b; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .target { background: #33474b; color: #f4efdf; border-color: #52696a; box-shadow: 0 4px 0 #152c32, 0 8px 16px #12242b30; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .target img { outline-color: #566a67; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .target small { color: #c2d0c5; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .target.selected { background: #4d5749; border-color: #e2bc7b; outline-color: #e2bc7b55; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .game-stage > .panel .btn.line { color: #f2e8d0; border-color: #697b75; background: #263a40; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .event-list { border-color: #4b635e; color: #bbccc1; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .event-list li { border-bottom-color: #40524f; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .event-list li::before { background: #bea477; }
.room-layout[data-room-game="werewolf"][data-phase="night"] .vision { background: #3a4d49; border-color: #63766a; color: #e3edd5; }

/* Schwarzer Humor: dark prompts, bright paper, unmistakable selection. */
.room-layout[data-room-game="cah"] .question-card { padding: clamp(22px, 3vw, 32px); background: linear-gradient(145deg, #242e28, #141c19); border-color: #15231b; border-radius: 18px; box-shadow: 0 5px 0 #bec7b2, 0 16px 24px #1c2b2415; }
.room-layout[data-room-game="cah"] .question-card p { color: #fffcf0; font-size: clamp(23px, 2.6vw, 33px); line-height: 1.4; letter-spacing: -.025em; }
.room-layout[data-room-game="cah"] .question-card .eyebrow { color: #edb994; font-size: 10px; line-height: 1.7; }
.room-layout[data-room-game="cah"] .question-card small { color: #cdd5c8; line-height: 1.5; }
.room-layout[data-room-game="cah"] .answer-hand { gap: 14px; }
.room-layout[data-room-game="cah"] .answer-card { color: #26382b; background: linear-gradient(145deg, #ffffff, #faf9f0); border-color: #d0d8c8; border-radius: 12px; box-shadow: 0 4px 0 #dde2d3, 0 9px 18px #21362b0d; line-height: 1.5; }
.room-layout[data-room-game="cah"] .answer-card[role="button"] { cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.room-layout[data-room-game="cah"] .answer-card small { color: #65735c; letter-spacing: .03em; }
.room-layout[data-room-game="cah"] .answer-card.selected { border: 1px solid #b45633; outline: 2px solid #c66d4566; outline-offset: 2px; background: #fff2d9; box-shadow: 0 5px 0 #e2c59e, 0 10px 20px #9a572015; }
.room-layout[data-room-game="cah"] .answer-card .order { min-width: 24px; height: 24px; display: grid; place-items: center; background: #a84c2d; box-shadow: 0 2px 5px #70462b20; }
.room-layout[data-room-game="cah"] .answer-card.joker { background: linear-gradient(145deg, #f9eed4, #f4e3c5); border-color: #c8a575; }
.room-layout[data-room-game="cah"] .answer-card textarea { min-height: 106px; color: #35432f; background: #fffdf5; border-color: #d8c39d; line-height: 1.55; }
.room-layout[data-room-game="cah"] .answer-set { background: transparent; padding: 9px; border-color: #dbe2cf; }
.room-layout[data-room-game="cah"] .answer-set > .answer-card { box-shadow: 0 3px 0 #e0e5d6; }
.room-layout[data-room-game="cah"] .answer-set.winner { border-color: #7a9a5b; background: #e0ecd0; box-shadow: 0 0 0 3px #a7bd8a30; }
.room-layout[data-room-game="cah"] .vote-button { min-height: 44px; color: #476037; font-weight: 600; }
.room-layout[data-room-game="cah"] .vote-button.accepted { opacity: 1; background: #dcebd0; }
.room-layout[data-room-game="cah"] .proposal-row { align-items: center; flex-wrap: wrap; gap: 12px; background: #f1f2e7; border: 1px solid #e1e6d7; }
.room-layout[data-room-game="cah"] .proposal-row > div { flex: 1 1 180px; min-width: 0; }
.room-layout[data-room-game="cah"] .leaderboard { display: flex; flex-wrap: wrap; max-width: none; margin-block: 22px 0; gap: 8px; }
.room-layout[data-room-game="cah"] .leaderboard > .row { flex: 0 1 auto; padding: 9px 12px; background: #edf1e3; border: 1px solid #dce5cf; border-radius: 13px; min-width: 0; gap: 10px; font-size: 12px; }
.room-layout[data-room-game="cah"] .leaderboard > .row > .row { padding: 0; background: transparent; border: 0; gap: 7px; justify-content: flex-start; }
.room-layout[data-room-game="cah"] .leaderboard > .row > strong { font-size: 11px; color: #5a6d47; }
.room-layout[data-room-game="cah"] .leaderboard > .row:first-child { background: #ede6cf; border-color: #d9ca9a; }

/* Keep third-party games untouched; refine their surrounding frame only. */
.external-bar { padding: 17px 20px; border: 1px solid #d8dfcc; border-radius: 16px; background: linear-gradient(130deg, #fdfbf0, #e9eedf); box-shadow: 0 3px 14px #2c402709; gap: 16px; flex-wrap: wrap; }
.external-bar > .row { flex: 1 1 240px; min-width: 0; }
.external-bar strong { color: #344a31; overflow-wrap: anywhere; }
.external-bar p { max-width: 70ch; line-height: 1.6; overflow-wrap: anywhere; }
.external-frame { display: block; max-width: 100%; height: calc(100dvh - 350px); min-height: 420px; scroll-margin-top: 110px; border: 1px solid #ced7c3; border-radius: 16px; box-shadow: 0 10px 28px #263d2410; background: #fffdf6; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .room-layout[data-room-game="draw"] .swatch:hover { background-color: #fffdf4; }
  .room-layout[data-room-game="werewolf"] button.target:hover:not(:disabled) { transform: translateY(-3px); border-color: #9cab88; }
  .room-layout[data-room-game="cah"] .answer-card[role="button"]:hover { transform: translateY(-4px); box-shadow: 0 5px 0 #dde2d3, 0 14px 20px #21362b14; }
}
@media (max-width: 600px) {
  .room-layout .lobby-options { padding: 14px; gap: 12px; }
  .room-layout[data-room-status="lobby"] .lobby-cover { max-height: 155px; margin-bottom: 18px; }
  .room-layout[data-room-game="draw"] .draw-tools { padding: 8px; gap: 6px; }
  .room-layout[data-room-game="draw"] .canvas-wrap { border-width: 5px; }
  .room-layout[data-room-game="draw"] .album-page { padding: 14px; }
  .room-layout[data-room-game="draw"] .album-page > p { font-size: 20px; }
  .room-layout[data-room-game="werewolf"] .target-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .room-layout[data-room-game="werewolf"] .role-panel { min-height: 210px; background-position: 60% center; }
  .room-layout[data-room-game="cah"] .answer-hand { gap: 12px; }
  .room-layout[data-room-game="cah"] .answer-hand .joker { grid-column: 1 / -1; }
  .room-layout[data-room-game="cah"] .answer-hand .answer-card { min-height: 140px; }
  .room-layout[data-room-game="cah"] .question-card .row { gap: 12px; }
  .external-bar { padding: 14px; }
  .external-frame { border-radius: 12px; }
}
@media (max-width: 480px) {
  .main:has(.hero) .topbar { margin-bottom: 17px; }
  .hero { gap: 17px; padding-bottom: 17px; }
  .hero h1 { font-size: clamp(29px, 7.7vw, 36px); margin-block: 9px 12px; }
  .hero p { font-size: 13px; line-height: 1.6; }
  .join-box { padding: 12px 14px; }
  .join-box h3 { font-size: 14px; }
  .join-box small { font-size: 11px; }
  .join-box .row { margin-top: 8px; }
  .join-box :is(input, button), .filters .filter { min-height: 44px; }
  .filters { margin-block: 5px 15px; gap: 5px; }
  .filters .filter { padding-inline: 12px; }
  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .game-tile > a { display: grid; grid-template-columns: 110px minmax(0, 1fr); min-height: 160px; }
  .game-tile .game-cover { height: 100%; aspect-ratio: auto; }
  .game-tile .game-cover img { display: block; }
  .game-tile .game-cover .chip { left: 6px; right: 6px; top: 7px; font-size: 9px; white-space: normal; text-align: center; }
  .game-tile .game-info { padding: 14px 12px; min-width: 0; }
  .game-tile .game-info h3 { font-size: 17px; overflow-wrap: anywhere; }
  .game-tile .game-info p { min-height: 0; margin-block: 7px 10px; font-size: 13px; line-height: 1.55; }
  .game-tile .game-info .row { font-size: 11px; flex-wrap: wrap; align-items: center; }
  .game-tile .game-info .go { width: 28px; height: 28px; font-size: 18px; flex: none; }
}
@media (max-width: 390px) {
  .room-layout .lobby-options { grid-template-columns: 1fr; }
  .room-layout[data-room-status="lobby"] .game-stage .row > .row { flex: 1 1 100%; }
  .room-layout[data-room-status="lobby"] .game-stage .row > .row > .btn { flex: 1 1 100%; }
  .room-layout[data-room-game="draw"] .prompt { padding: 18px; }
  .room-layout[data-room-game="draw"] #drawing-text { padding-inline: 14px; font-size: 18px; }
  .room-layout[data-room-game="draw"] .album-controls { padding: 9px; gap: 6px; }
  .room-layout[data-room-game="draw"] .album-title { font-size: 11px; }
  .room-layout[data-room-game="draw"] .album-pages { padding-left: 20px; }
  .room-layout[data-room-game="draw"] .album-pages::before { left: 4px; }
  .room-layout[data-room-game="draw"] .album-page::before { left: -24px; }
  .room-layout[data-room-game="werewolf"] .role-panel { padding: 22px 19px; }
  .room-layout[data-room-game="werewolf"] .target { padding-inline: 8px; font-size: 12px; }
  .room-layout[data-room-game="cah"] .answer-hand { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .room-layout[data-room-game="cah"] .answer-hand .answer-card { min-height: 130px; padding: 13px 11px; }
  .room-layout[data-room-game="cah"] .answer-card textarea { min-height: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .room-layout .btn, .room-layout[data-room-game="draw"] .swatch,
  .room-layout[data-room-game="werewolf"] .target,
  .room-layout[data-room-game="cah"] .answer-card[role="button"] { transition: none; }
  .room-layout .btn:active:not(:disabled) { transform: none; }
}
