:root { --panel: rgba(30, 40, 35, .82); --accent: #2f7d5b; font-family: system-ui, "Malgun Gothic", sans-serif; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3d4; }
canvas { display: block; touch-action: none; }
[hidden] { display: none !important; }

button, .button, .file-button { font: inherit; font-size: 14px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
input, select { font: inherit; font-size: 16px; min-height: 40px; padding: 0 10px; border: 1px solid #9aa79f; border-radius: 8px; box-sizing: border-box; background: #fff; color: #1d2621; }

.pill { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; padding: 9px 14px; border-radius: 999px; background: var(--panel); color: #fff; font-size: 14px; max-width: calc(100vw - 230px); }
.menu { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 6px; }
.menu button { background: var(--panel); }

#banner { position: fixed; top: max(64px, calc(env(safe-area-inset-top) + 52px)); left: 50%; transform: translateX(-50%); width: min(92vw, 560px); box-sizing: border-box; padding: 12px 16px; border-radius: 14px; background: var(--panel); color: #fff; text-align: center; pointer-events: none; }
#banner.alert { background: rgba(190, 40, 50, .92); } /* 무궁화 꽃: 술래가 보는 중 */
#banner p { margin: 0; }
#banner-title { font-size: 13px; opacity: .85; }
#banner-text { font-size: 18px; font-weight: 700; margin-top: 4px !important; word-break: keep-all; overflow-wrap: anywhere; }
#banner-scores { margin: 8px 0 0; padding: 0; list-style-position: inside; font-size: 14px; max-height: 26vh; overflow: hidden; }

#toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 10px; background: #8c2f2f; color: #fff; font-size: 14px; max-width: 80vw; }

#draw { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); min-width: min(80vw, 320px); padding: 18px 24px; border-radius: 16px; background: rgba(20, 24, 22, .92); color: #fff; text-align: center; }
#draw p { margin: 0; }
#draw-name { font-size: 28px; font-weight: 800; }
#draw-penalty { font-size: 18px; margin-top: 8px !important; color: #ffd166; word-break: keep-all; overflow-wrap: anywhere; }

#chat-log { position: fixed; left: 12px; bottom: 212px; width: min(70vw, 340px); max-height: 150px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 13px; color: #fff; pointer-events: none; }
#chat-log div { flex: none; padding: 2px 8px; margin-top: 2px; border-radius: 6px; background: rgba(30, 40, 35, .6); width: fit-content; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
#chat-log b { color: #ffe27a; font-weight: 600; }

#stick { position: fixed; left: 20px; bottom: 76px; width: 124px; height: 124px; border-radius: 50%; background: rgba(30, 40, 35, .35); touch-action: none; user-select: none; }
#knob { position: absolute; left: 40px; top: 40px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .9); pointer-events: none; }
#emotes { position: fixed; right: 12px; bottom: 76px; display: grid; grid-template-columns: repeat(2, 48px); gap: 8px; }
#emotes button { width: 48px; height: 48px; padding: 0; font-size: 22px; background: var(--panel); border-radius: 50%; }
#chat-form { position: fixed; left: 12px; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 6px; max-width: 560px; margin: 0 auto; }
#chat-input { flex: 1; min-width: 0; }

dialog { width: min(92vw, 460px); max-height: 86vh; box-sizing: border-box; padding: 18px; border: 0; border-radius: 16px; background: #f7faf6; color: #1d2621; overflow: auto; }
dialog::backdrop { background: rgba(10, 20, 15, .45); }
dialog h1, dialog h2 { margin: 0 0 12px; font-size: 20px; }
dialog h3 { margin: 18px 0 8px; font-size: 15px; }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
dialog img { display: block; width: 100%; border-radius: 10px; }
#game-dialog #question-form, #game-dialog #penalty-form, #game-dialog #admin-form { margin-top: 10px; }
#draw-scope { width: 100%; }
#quiz-start, #draw-start { margin-top: 8px; width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
legend { padding: 0; margin-bottom: 4px; font-size: 14px; }
.swatch { position: relative; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; min-height: 0; cursor: pointer; }
.swatch:has(input:checked) { outline: 3px solid #1d2621; outline-offset: 2px; }
.swatch:has(input:focus-visible) { outline: 3px solid #ffd166; outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.close-dialog { background: #68746d; }
.error { display: block; color: #a4262c; font-size: 13px; min-height: 1em; }
.hint-text { margin: 0 0 12px; font-size: 13px; color: #4b5750; }
.items { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.items li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 10px; background: #e9efe8; border-radius: 8px; overflow-wrap: anywhere; }
.items button { flex: none; min-height: 32px; padding: 0 10px; background: #8c2f2f; }
.file-button { width: 100%; flex-direction: row !important; position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#photo-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
#photo-list li { position: relative; }
#photo-list img { aspect-ratio: 1; object-fit: cover; cursor: pointer; }
#photo-list small { display: block; font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
#photo-list button { position: absolute; top: 4px; right: 4px; min-height: 30px; padding: 0 8px; font-size: 12px; background: rgba(140, 47, 47, .92); }
#viewer-owner { margin: 8px 0 0; font-size: 14px; }

@media (max-width: 480px) {
  .pill { font-size: 13px; padding: 8px 12px; }
  .menu button { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

/* 캐릭터 얼굴 아이콘과 미리보기 */
.face { width: 1.5em; height: 1.5em; vertical-align: middle; margin-right: 4px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
#banner-scores li .face { width: 1.6em; height: 1.6em; }
#draw-face { display: block; width: 96px; height: 96px; margin: 0 auto 4px; }
#profile-preview { display: block; margin: 0 auto 8px; width: 160px; height: 160px; border-radius: 16px; background: #e7f0e9; }
#profile-image { width: 100%; margin-top: 8px; }
.look-gender label { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; font-size: 15px; }
