/* Keep the original dark board, habitat colors and screen order. */
:root {
    color-scheme: dark;
    --fc-text: #f1f3ef;
    --fc-muted: #b4bdb2;
    --fc-line: #41483f;
    --fc-green: #a9d69b;
}
html { scroll-padding-top: 24px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    line-height: 1.55;
    color: var(--fc-text);
    padding: 24px 0 72px;
    min-height: 100svh;
    box-sizing: border-box;
}
#app { width: min(94%, 1120px); padding: 20px; box-sizing: border-box; }
.screen { padding: 24px; border-color: var(--fc-line); margin-bottom: 0; }
h1, h2, h3 { text-shadow: none; word-break: keep-all; overflow-wrap: anywhere; }
h2 { font-size: 23px; }
h3 { font-size: 17px; }
#auth-screen { max-width: 520px; }
#logo-container .character-img { max-width: 190px; min-width: 132px; }
.auth-description { color: var(--fc-muted); font-size: 14px; margin: 0 0 20px; word-break: keep-all; }
#login-form, #nickname-form { box-sizing: border-box; padding: 20px; box-shadow: none; border: 1px solid var(--fc-line); }
#login-form h2 { font-size: 18px; border: 0; margin-bottom: 12px; padding: 0; }
#google-login-container { width: 100%; }
button { font-family: inherit; line-height: 1.35; min-height: 44px; box-shadow: none; transition: background-color .15s, border-color .15s; }
button:hover, button:active { transform: none; box-shadow: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--fc-green); outline-offset: 3px; }
button:disabled { background: #383d38; color: #aeb6ac; }
input[type='text'], input[type='password'] { width: 100%; box-sizing: border-box; margin-left: 0; min-height: 46px; }
.form-label { display: block; text-align: left; color: var(--fc-muted); font-size: 14px; margin: 6px 0; }
.screen-note { color: var(--fc-muted); font-size: 14px; margin: 8px 0 16px; }
#room-list, #player-list, #score-board { box-shadow: none; border-color: var(--fc-line); padding: 16px; }
#room-list h3, #player-list h3 { margin: 0 0 12px; text-align: left; }
#room-list li, #player-list li { gap: 10px; flex-wrap: wrap; min-height: 44px; padding: 10px 12px; overflow-wrap: anywhere; }
.player-name, .room-name { flex: 1; min-width: 100px; }
.player-badges { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--fc-green); }
.player-badges span { padding: 2px 7px; border: 1px solid #53634d; border-radius: 4px; }
.player-action-container { margin: 0; padding: 0; border: 0; }
.host-action-button { min-height: 36px; margin: 0; background: #42302d; color: #ffd0bd; }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.room-actions button { margin: 0; flex: 1 1 auto; }
#leave-room-button, #logout-button, #add-bots-button { background: #343b32; border: 1px solid #5b6854; color: #e1e9dc; box-shadow: none; }
#add-bots-button { margin: 8px 0; font-size: 14px; }
#player-count-info { color: var(--fc-muted) !important; background: #282e26; border-color: #46563e; }
#game-info { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; box-shadow: none; align-items: start; }
#game-info > span { padding: 6px 10px; min-width: 0; background: #292d28; font-size: 14px; overflow-wrap: anywhere; }
#game-info span span { padding: 0; background: transparent; }
#game-info #round-info { align-self: center; }
#game-info #my-role, #game-info #win-tip-span { grid-column: 1 / -1; margin: 0 !important; }
#game-info #win-tip-span { color: #edcf88 !important; font-weight: 500 !important; }
#game-info #timer { color: #d7eccf; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; white-space: nowrap; }
#game-info #timer[data-urgent='true'] { color: #ffd093; outline: 1px solid #ad7742; }
#round-info .hunger { display: inline-flex; align-items: center; gap: 2px; }
.turn-guide { padding: 14px 16px; margin: 0 0 16px; border: 1px solid #5e7651; border-left-width: 3px; border-radius: 8px; background: #283023; }
.turn-guide[data-tone='waiting'] { border-color: #677363; background: #2b3029; }
.turn-guide[data-tone='done'] { border-color: #7baa6b; }
.turn-guide-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--fc-green); font-size: 12px; margin-bottom: 5px; }
#turn-guide-title { display: block; font-size: 16px; word-break: keep-all; }
#turn-guide-detail { margin: 4px 0 0; color: #c2cbbd; font-size: 13px; word-break: keep-all; }
#game-map { min-height: 260px; gap: 10px; }
.region { isolation: isolate; box-shadow: none !important; transform: none !important; border-width: 1px !important; min-height: 112px; }
.region::before { opacity: .22; }
.region-title { font-size: 16px; letter-spacing: 0; }
.region .player-marker { font-size: 13px; line-height: 1.4; padding: 4px 7px; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
.region .self-marker { color: #f2ffe8; background: #202d1ee6; border: 1px solid #b2ce94; }
#game-actions { gap: 8px; padding: 12px; margin: 14px 0; border-color: #55694b; }
#game-actions button { margin: 0; min-height: 44px; flex: 1 1 120px; padding: 10px 12px; background: #383e34; border-color: #66715b; box-shadow: none; font-size: 14px; }
#game-actions button:first-child { background: #426339; border-color: #70935e; }
#game-actions p { margin: 2px 0; color: var(--fc-muted); }
#lobby-chat, #waiting-room-chat, #game-chat { padding: 14px; box-sizing: border-box; border-color: var(--fc-line); }
#lobby-chat h3, #waiting-room-chat h3, #game-chat h3 { margin: 0 0 12px; text-align: left; }
#lobby-chat-messages, #waiting-room-chat-messages, #game-chat-messages { border-color: #3a4136; height: 180px; border-radius: 5px; margin-bottom: 12px; box-sizing: border-box; }
.chat-compose { display: flex; gap: 8px; align-items: stretch; }
.chat-compose input { min-width: 0; flex: 1; margin: 0; }
.chat-compose button { margin: 0; flex: 0 0 auto; }
.message { line-height: 1.5; font-size: 14px; overflow-wrap: anywhere; }
#score-board { max-height: none; overflow-x: auto; }
#winner-info { color: #edcf88; text-shadow: none; font-size: 22px; }
.floating-rules-btn { background: #343d2f; border: 1px solid #819773; box-shadow: 0 2px 8px #0005; }
.floating-rules-btn, .floating-whisper-btn { width: 44px; height: 44px; min-height: 44px; top: 4px; margin: 0; }
.floating-rules-btn { right: 16px; }
.floating-whisper-btn { right: 68px; box-shadow: 0 2px 8px #0005; }
#rules-popup { box-sizing: border-box; width: min(92vw, 800px); max-height: 85svh; padding: 20px; }
#close-rules-popup { position: sticky; bottom: 0; display: block; margin: 16px 0 0 auto; }
@media (max-width: 600px) {
    body { padding-top: 48px; align-items: flex-start; }
    #app { width: calc(100% - 16px); padding: 8px; }
    .screen { padding: 14px 10px; }
    #auth-screen { padding: 24px 16px; }
    #login-form, #nickname-form { padding: 16px; }
    #game-info { padding: 8px; gap: 6px; }
    #game-info > span { padding: 6px 8px; font-size: 13px; }
    .turn-guide { padding: 12px; }
    #game-map { min-height: 224px; gap: 8px; margin-bottom: 12px; }
    .region { min-height: 105px; max-height: 180px; padding: 8px; }
    .region .player-marker { font-size: 12px; }
    #lobby-chat, #waiting-room-chat, #game-chat { padding: 10px; }
    #game-actions button { flex-basis: 100px; }
    #room-list, #player-list, #score-board { padding: 10px; }
    #winner-info { font-size: 20px; }
    #result-screen .score-table th, #result-screen .score-table td { padding: 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
