@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');
:root{color-scheme:dark;font-family:'Gowun Batang','Batang','Nanum Myeongjo',serif;color:#f4f2e7}*{box-sizing:border-box}html,body,#app{margin:0;width:100%;height:100%;overflow:hidden}body{background:#202e2b}button{font:inherit;color:inherit;cursor:pointer}button:focus-visible,input:focus-visible{outline:2px solid #e1c789;outline-offset:4px}#world{position:absolute;inset:0;touch-action:none}#world canvas{display:block;width:100%;height:100%}.wash{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(12,22,21,.6),transparent 28%,transparent 67%,rgba(9,20,18,.55)),linear-gradient(90deg,rgba(13,24,21,.35),transparent 45%)}.topbar{position:absolute;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:26px 36px}.brand{display:flex;gap:11px;align-items:center}.brand-icon{display:grid;place-items:center;width:42px;height:42px;border:1px solid #ffffff82;border-radius:50%;font-size:32px;line-height:1}.brand b{display:block;font-size:15px;letter-spacing:.19em}.brand small{display:block;font-size:10px;color:#e5e5d9b8;margin-top:3px}.top-actions{display:flex;gap:10px;align-items:center}.prototype,.pill{border:1px solid #ffffff50;background:#15221fb8;backdrop-filter:blur(12px);border-radius:30px;padding:10px 16px;font-size:11px;letter-spacing:.04em}.pill{font-weight:700;min-width:44px}.title{position:absolute;left:6%;top:19%;text-shadow:0 2px 20px #16211b}.eyebrow{font-size:10px;letter-spacing:.16em;color:#e7cb91;font-weight:700}.title h1{font-size:clamp(28px,3.3vw,48px);letter-spacing:-.05em;margin:13px 0 8px}.title p{font-size:13px;color:#ebece4c9;margin:0}.help{position:absolute;left:50%;bottom:12%;transform:translateX(-50%);display:flex;align-items:center;gap:10px;background:#15231fd4;border:1px solid #ffffff39;border-radius:30px;padding:10px 18px;white-space:nowrap;backdrop-filter:blur(10px)}.help-icon{display:grid;place-items:center;background:#e0c894;color:#253629;border-radius:50%;width:32px;height:32px;font-size:18px}.help b,.help small{display:block}.help b{font-size:12px}.help small{color:#cad2c4;font-size:10px;margin-top:3px}.controls{position:absolute;right:34px;bottom:62px;display:flex;gap:8px}.control{border:1px solid #ffffff59;border-radius:50px;background:#1a2a26d9;min-width:70px;height:52px;padding:7px 14px;display:flex;align-items:center;justify-content:center;gap:8px;backdrop-filter:blur(12px);font-size:11px}.control span:first-child{font-size:18px}.control:hover,.pill:hover{background:#405349}.panel{position:absolute;right:34px;bottom:125px;width:min(340px,calc(100% - 34px));padding:24px;border:1px solid #ffffff49;border-radius:20px;background:#1c302aeF;box-shadow:0 16px 60px #0006;backdrop-filter:blur(20px)}[hidden]{display:none!important}.panel-head{display:flex;justify-content:space-between;align-items:flex-start}.panel h2{font-size:20px;letter-spacing:-.04em;margin:8px 0}.close{border:0;background:#ffffff12;border-radius:50%;width:32px;height:32px;font-size:22px}.sub{font-size:12px;color:#c1ccc2;margin:0 0 22px}.sound-row{display:flex;align-items:center;gap:12px}.sound-icon{display:grid;place-items:center;width:41px;height:41px;border-radius:12px;background:#e8d09821;font-size:22px;color:#e2ca94}.sound-row b,.sound-row small{display:block}.sound-row b{font-size:13px}.sound-row small{font-size:11px;color:#aebdb3;margin-top:4px}.play{margin-left:auto;width:36px;height:36px;border:1px solid #ffffff57;border-radius:50%;background:#e3cb92;color:#26352a}.panel input{width:100%;margin:20px 0 3px;accent-color:#e3cb92}.note{font-size:11px;color:#aebdb3;line-height:1.6;margin-bottom:0}.notice{padding:16px;background:#ffffff0c;border-radius:12px;margin-top:14px;font-size:13px;line-height:1.7}.notice p{color:#c0cdc4;margin:5px 0 0;font-size:12px}footer{position:absolute;bottom:20px;left:36px;right:36px;display:flex;justify-content:space-between;color:#dce6d6b8;font-size:10px;letter-spacing:.03em}footer span:first-child{display:flex;align-items:center;gap:7px}footer i{width:6px;height:6px;background:#a6ca9c;border-radius:50%}.footer-right{letter-spacing:.15em}#error{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:#1b2d27;padding:22px;border-radius:16px;text-align:center}#error p{font-size:12px;color:#c5d1c5}@media(max-width:700px){.topbar{padding:18px}.brand-icon{width:36px;height:36px;font-size:28px}.brand b{font-size:13px}.prototype{font-size:10px;padding:9px}.pill{padding:9px}.title{left:20px;top:17%}.title h1{font-size:28px;margin:9px 0 6px}.title p{font-size:12px}.help{bottom:108px;max-width:95%;padding:8px 14px}.controls{bottom:38px;right:50%;transform:translateX(50%);white-space:nowrap}.control{height:50px;min-width:75px}.panel{right:17px;bottom:99px;padding:20px}footer{bottom:13px;left:18px;right:18px;font-size:9px}.footer-right{display:none}}@media(max-height:520px){.title{top:18%;}.title h1{font-size:24px}.help{bottom:18px;left:24px;transform:none}.controls{bottom:18px;right:18px;transform:none}footer{display:none}.panel{bottom:78px}}
@media(max-width:700px){.help{white-space:normal;width:max-content;max-width:calc(100% - 32px)}.help b{line-height:1.35}}

.avatar-panel{width:min(380px,calc(100% - 34px));max-height:calc(100dvh - 150px);overflow:auto}.avatar-intro{font-size:12px;color:#c3d0c5;margin:2px 0 12px}.avatar-preview{height:205px;position:relative;overflow:hidden;border:1px solid #ffffff24;border-radius:14px;background:radial-gradient(ellipse at 50% 60%,#748879 0%,#354b3f 48%,#1c302a 100%)}.avatar-preview canvas{display:block;width:100%;height:100%}.avatar-preview span{position:absolute;bottom:9px;left:12px;font-size:10px;color:#e2e9dbad;pointer-events:none}.style-heading{font-size:11px;color:#dfd3ae;margin:15px 0 8px;font-weight:700}.avatar-options{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.avatar-option{min-width:0;border:1px solid #ffffff29;border-radius:11px;background:#ffffff0b;padding:8px 3px;display:flex;flex-direction:column;align-items:center;gap:6px;font-size:10px;line-height:1.25}.avatar-option:hover{background:#ffffff19}.avatar-option[aria-pressed="true"]{border-color:#ead19b;background:#ead19b24;box-shadow:inset 0 0 0 1px #ead19b55}.avatar-option i{display:block;width:28px;height:28px;border-radius:50%;background:linear-gradient(var(--top) 0 55%,var(--bottom) 55%);border:2px solid #ffffff75}.avatar-footnote{font-size:10px;color:#bcc9bb;margin:12px 0 0;line-height:1.4}@media(max-width:700px){.controls{gap:5px}.control{min-width:0;padding:7px 11px}.avatar-panel{max-height:calc(100dvh - 120px)}.avatar-preview{height:min(170px,23dvh)}}@media(max-height:600px){.avatar-panel{max-height:calc(100dvh - 90px)}.avatar-preview{height:110px}}

.wish-status{position:absolute;right:36px;top:90px;display:flex;align-items:center;gap:12px;padding:10px 12px 10px 16px;border-radius:24px;border:1px solid #e5d4a260;background:#1b302be8;box-shadow:0 8px 30px #0004;font-size:12px;backdrop-filter:blur(12px)}.wish-status button{border:1px solid #e7d2a0aa;border-radius:20px;background:#e3c990;color:#24382e;padding:7px 12px;font-size:11px;font-weight:700}@media(max-width:700px){.wish-status{right:18px;top:70px;font-size:11px}}

.lightning-flash{position:absolute;inset:0;background:#c5ddff;opacity:0;pointer-events:none;mix-blend-mode:screen}.thunder-row{margin-top:18px}.thunder-toggle{width:auto;min-width:44px;padding:0 7px;font-size:10px}.panel{max-height:calc(100dvh - 140px);overflow:auto}

.interaction-hint{position:absolute;left:50%;bottom:22%;transform:translateX(-50%);max-width:90%;padding:10px 16px;border:1px solid #ffffff45;border-radius:22px;background:#1b302beF;color:#f7efda;font-size:12px;white-space:nowrap;pointer-events:none;box-shadow:0 6px 24px #0005}

.chat-bubbles{position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden}.chat-bubble{position:absolute;left:0;top:0;max-width:min(240px,55vw);padding:8px 12px;border-radius:14px;background:#fff9e8;color:#23362d;box-shadow:0 5px 18px #0005;text-align:center;font-size:12px;line-height:1.45;overflow-wrap:anywhere;white-space:pre-wrap;will-change:transform}.chat-bubble:after{content:'';position:absolute;left:50%;bottom:-6px;width:12px;height:12px;background:#fff9e8;transform:translateX(-50%) rotate(45deg)}.chat-bubble b{display:block;font-size:10px;color:#657765;margin-bottom:2px}.chat-bubble span{position:relative;z-index:1}.chat-bubble.fading{opacity:0;transition:opacity 1s}.topbar,.title,.help,.controls,.panel,.wish-status,.interaction-hint{z-index:2}.chat-status{font-size:11px;color:#d6c89f;line-height:1.5;margin:7px 0 16px}.chat-panel label{display:block;font-size:11px;color:#d6e0d5;margin:12px 0 5px}.chat-panel input{width:100%;min-width:0;margin:0;padding:11px 12px;color:#f6f4ea;background:#0e201b;border:1px solid #ffffff3b;border-radius:10px;font:inherit;font-size:13px}.chat-entry{display:flex;gap:7px}.chat-entry button{border:0;border-radius:10px;background:#e3cb92;color:#26352a;padding:0 14px;font-size:12px;font-weight:700}.chat-caption{font-size:11px;color:#b9c9bb;line-height:1.5;margin:12px 0 0}

.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}.chat-dock{position:absolute;z-index:3;left:34px;bottom:56px;width:min(370px,calc(100% - 68px))}.chat-dock .chat-status{display:block;margin:0 0 5px 12px;color:#e4d4a8;font-size:10px;text-shadow:0 1px 5px #000}.chat-bar{display:flex;align-items:center;gap:8px;min-height:48px;padding:5px 6px 5px 15px;border:1px solid #ffffff59;border-radius:27px;background:#152820e8;backdrop-filter:blur(12px);box-shadow:0 5px 22px #0004}.chat-bar-icon{font-size:16px;color:#e3cb92}.chat-bar input{flex:1;min-width:0;border:0;outline:0;color:#f8f6ec;background:transparent;font:inherit;font-size:13px}.chat-bar input::placeholder{color:#b4c4b8}.chat-bar:focus-within{border-color:#e3cb92}.chat-bar button{border:0;border-radius:22px;padding:9px 14px;color:#26352a;background:#e3cb92;font-size:11px;font-weight:700}.nickname-label{display:block;margin:13px 0 5px;color:#dfd3ae;font-size:11px;font-weight:700}.avatar-panel .nickname-input{margin:0 0 13px;padding:10px 12px;border:1px solid #ffffff38;border-radius:10px;background:#10221c;color:#f8f6ec;font:inherit;font-size:13px}.help{bottom:max(135px,15%)}
@media(max-width:700px){.chat-dock{left:16px;bottom:34px;width:calc(100% - 32px)}.controls{bottom:101px}.help{bottom:165px}.panel{bottom:160px;max-height:calc(100dvh - 180px)}.avatar-panel{max-height:calc(100dvh - 180px)}.avatar-preview{height:min(150px,20dvh)}footer{bottom:10px}}
@media(max-height:520px){.chat-dock{bottom:10px}.controls{bottom:10px}.help{display:none}.panel{bottom:75px}.chat-dock{width:min(350px,48%)} }
.audio-unlock-hint{position:absolute;z-index:3;left:50%;bottom:225px;transform:translateX(-50%);padding:8px 14px;border:1px solid #e7d2a070;border-radius:20px;background:#1b302be8;color:#f8edcd;font-size:11px;white-space:nowrap;pointer-events:none}@media(max-width:700px){.audio-unlock-hint{bottom:240px}}

/* A quiet, centered chat bar and a short-lived introduction. */
.title{transition:opacity 1.1s ease;pointer-events:none}.title.faded{opacity:0}.chat-dock{left:50%;bottom:56px;transform:translateX(-50%);width:min(370px,calc(100% - 400px))}.chat-dock .sr-only{display:block}.controls{right:34px;bottom:62px}footer{justify-content:flex-end}
@media(max-width:700px){.chat-dock{left:50%;bottom:25px;width:calc(100% - 32px)}.controls{right:16px;bottom:88px;transform:none}.panel{bottom:150px}}
@media(max-height:520px){.chat-dock{bottom:10px;width:min(350px,calc(100% - 32px))}.controls{right:12px;bottom:70px;transform:none}.panel{bottom:130px}}

/* A brief, gentle wish message; the finish button remains above the chat. */
.wish-message{position:absolute;z-index:4;left:50%;top:43%;width:100%;padding:0 20px;transform:translate(-50%,-50%);text-align:center;color:#fff8e8;font-family:'Gowun Batang','Batang','Nanum Myeongjo',serif;font-size:clamp(25px,3.5vw,42px);font-weight:400;letter-spacing:.04em;text-shadow:0 2px 8px #000,0 4px 30px #000;pointer-events:none;animation:wish-message-fade 5s ease both}
@keyframes wish-message-fade{0%{opacity:0;transform:translate(-50%,-40%)}18%,65%{opacity:1;transform:translate(-50%,-50%)}100%{opacity:0;transform:translate(-50%,-52%)}}
.wish-status{left:50%;right:auto;top:auto;bottom:119px;transform:translateX(-50%);padding:0;border:0;background:none;box-shadow:none;backdrop-filter:none;z-index:3}.wish-status button{padding:10px 18px;box-shadow:0 5px 18px #0006;font-size:12px}
@media(max-width:700px){.wish-status{left:50%;right:auto;top:auto;bottom:88px}.wish-message{font-size:27px}}
@media(max-height:520px){.wish-status{bottom:70px}}
@media(prefers-reduced-motion:reduce){.wish-message{animation-duration:2s}}
/* Touch-only joystick, positioned above the chat and clear of the right-side controls. */
.mobile-joystick{display:none;position:absolute;z-index:4;left:max(18px,env(safe-area-inset-left));bottom:max(130px,18dvh);width:110px;height:110px;border:1px solid #ffffff70;border-radius:50%;background:#1528203b;box-shadow:inset 0 0 0 1px #ffffff1c,0 5px 18px #0002;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}.joystick-knob{position:absolute;left:50%;top:50%;width:46px;height:46px;border:1px solid #fff9;border-radius:50%;background:#f3f6e842;box-shadow:0 2px 8px #0003;transform:translate(-50%,-50%);pointer-events:none}.mobile-joystick.is-active{background:#1a302d65;border-color:#ffffffa8}.mobile-joystick.is-active .joystick-knob{background:#f6f7e875}body.chat-keyboard-open .mobile-joystick{visibility:hidden;pointer-events:none}@media (hover:none) and (pointer:coarse) and (max-width:1100px){.mobile-joystick{display:block}}@media (hover:none) and (pointer:coarse) and (max-height:520px){.mobile-joystick{width:84px;height:84px;bottom:72px}.joystick-knob{width:36px;height:36px}}
/* Some embedded phone browsers expose a fine or unknown primary pointer. */
@media (any-pointer:coarse) and (max-width:1100px){.mobile-joystick{display:block}}
@media (max-width:1100px){html.touch-phone .mobile-joystick{display:block}}
@media (max-height:520px){html.touch-phone .mobile-joystick{width:84px;height:84px;bottom:72px}html.touch-phone .joystick-knob{width:36px;height:36px}}
.mobile-joystick{border-color:#ffffff62;background:#1428201c;box-shadow:inset 0 0 0 1px #ffffff0c}.joystick-knob{border-color:#ffffff80;background:#f3f6e82b;box-shadow:0 2px 8px #0002}.mobile-joystick.is-active{background:#1a302d32;border-color:#ffffff85}.mobile-joystick.is-active .joystick-knob{background:#f6f7e858}

/* Match the calm typeface used for the wish message throughout the experience. */
button,input,textarea,select{font-family:inherit}

.wish-night{position:absolute;z-index:2;inset:0;opacity:0;pointer-events:none;background:radial-gradient(ellipse at center,#091521e8,#02070bfa);transition:opacity 2s ease}.wish-night.active{opacity:1}.wish-night::before,.wish-night::after{content:"";position:absolute;inset:0;background-repeat:repeat;background-size:210px 170px;background-image:radial-gradient(circle at 15% 32%,#fff 0 1px,transparent 2px),radial-gradient(circle at 65% 70%,#c9e1ff 0 1px,transparent 2px),radial-gradient(circle at 83% 19%,#fce8bb 0 1px,transparent 2px);animation:wish-stars 3.6s ease-in-out infinite alternate}.wish-night::after{background-size:270px 220px;transform:translate(45px,35px);animation-duration:5s;animation-delay:-2s;opacity:.45}@keyframes wish-stars{from{opacity:.18}to{opacity:.8}}@media(prefers-reduced-motion:reduce){.wish-night::before,.wish-night::after{animation:none;opacity:.4}}
.fortune-layer[hidden]{display:none}.fortune-layer{position:fixed;inset:0;z-index:130;display:grid;place-items:center;background:#060a0ceF;opacity:0;transition:opacity 1.35s ease;pointer-events:auto}.fortune-layer.active{opacity:1}.fortune-content{text-align:center;padding:15px}.fortune-numbers{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1.2vw,12px);flex-wrap:nowrap}.fortune-ball{width:clamp(36px,7vw,62px);height:clamp(36px,7vw,62px);display:grid;place-items:center;border-radius:50%;font:700 clamp(15px,2.4vw,25px)/1 Arial,'Noto Sans KR',sans-serif;color:white;opacity:0;animation:fortune-in .7s ease forwards;animation-delay:var(--delay)}.fortune-ball.gold{background:#ffb928}.fortune-ball.blue{background:#2b70e7}.fortune-ball.coral{background:#f2643c}.fortune-ball.gray{background:#8b9090}.fortune-ball.green{background:#15ba54}.fortune-plus{color:#d7ded9;font:400 23px Arial,sans-serif;opacity:0;animation:fortune-in .7s ease forwards;animation-delay:var(--delay)}.fortune-message{margin:32px 0 0;font-family:'Gowun Batang','Batang',serif;color:#fff8e8;font-size:clamp(22px,4vw,35px);opacity:0;animation:fortune-in 1.1s ease 5.3s forwards}.fortune-layer:not(.active) .fortune-content{opacity:0;transition:opacity 1.1s ease}@keyframes fortune-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.fortune-ball,.fortune-plus,.fortune-message{transform:none}}
@media(max-width:380px){.fortune-content{padding:8px}.fortune-numbers{gap:4px}.fortune-ball{width:32px;height:32px;font-size:14px}.fortune-plus{font-size:18px}}
.fortune-layer{pointer-events:none}.fortune-return-message{margin:0;font-family:'Gowun Batang','Batang',serif;color:#fff8e8;font-size:clamp(22px,4vw,35px);opacity:0;animation:fortune-in 1s ease .35s forwards}
/* Independent stars pulse at different times; brighter ones briefly flare. */
.wish-night::before,.wish-night::after{content:none}.wish-star{position:absolute;width:var(--size);height:var(--size);border-radius:50%;background:#fffbe7;box-shadow:0 0 4px 1px #d2eaff,0 0 11px 2px #b8d5ff99;opacity:.08;animation:wish-star-twinkle var(--duration) ease-in-out var(--delay) infinite;animation-play-state:paused;will-change:opacity,transform}.wish-night.active .wish-star{animation-play-state:running}.wish-star-bright{box-shadow:0 0 5px 2px #fff,0 0 18px 5px #b8d6ffc9}.wish-star-bright::before,.wish-star-bright::after{content:"";position:absolute;left:50%;top:50%;width:1px;height:14px;transform:translate(-50%,-50%);background:linear-gradient(transparent,#fff,transparent)}.wish-star-bright::after{transform:translate(-50%,-50%) rotate(90deg)}@keyframes wish-star-twinkle{0%,33%,100%{opacity:.08;transform:scale(.55)}44%{opacity:.35;transform:scale(.8)}50%{opacity:1;transform:scale(1.65)}58%{opacity:.22;transform:scale(.72)}75%{opacity:.14;transform:scale(.6)}}@media(prefers-reduced-motion:reduce){.wish-star{animation:none;opacity:.55;transform:none}}

.fortune-layer.fortune-drawn{background:transparent}.fortune-layer.fortune-drawn::before{content:"";position:absolute;inset:0;background:#060a0cef;animation:fortune-reality 1.5s ease 8s forwards}.fortune-layer.fortune-drawn .fortune-content{position:relative}.fortune-layer.fortune-drawn .fortune-message{animation:fortune-in 1.1s ease 5.3s forwards,fortune-message-out 1.5s ease 8s forwards}@keyframes fortune-reality{to{opacity:0}}@keyframes fortune-message-out{to{opacity:0}}
.room-population{position:absolute;z-index:3;right:34px;bottom:126px;display:flex;align-items:center;gap:7px;padding:7px 11px;border:1px solid #ffffff45;border-radius:20px;background:#152820d9;color:#e6e8da;font-size:11px;pointer-events:none}.room-population:before{content:'';width:7px;height:7px;border-radius:50%;background:#b5a696}.room-population.is-online:before{background:#9ecb94}@media(max-width:700px){.room-population{right:16px;bottom:150px}}@media(max-height:520px){.room-population{right:12px;bottom:130px}}
.top-actions .room-population{position:static;flex:none;white-space:nowrap}
/* iOS Safari zooms into editable fields smaller than 16px. */
@media (pointer:coarse){input:not([type=range]),textarea{font-size:16px!important}}
.chat-dock .emoji-toggle{flex:none;padding:0;width:34px;height:34px;font-size:23px;line-height:1;color:#e7d5aa;background:transparent}.chat-dock .emoji-toggle:hover,.chat-dock .emoji-toggle[aria-expanded=true]{background:#ffffff18}.emoji-picker[hidden]{display:none}.emoji-picker{position:absolute;right:0;bottom:calc(100% + 10px);display:grid;grid-template-columns:repeat(6,1fr);gap:3px;width:min(292px,calc(100vw - 32px));padding:10px;border:1px solid #ffffff43;border-radius:18px;background:#152820f5;box-shadow:0 8px 25px #0006;backdrop-filter:blur(12px)}.emoji-choice{width:42px;height:42px;border:0;border-radius:10px;background:transparent;font-size:25px;cursor:pointer}.emoji-choice:hover,.emoji-choice:focus-visible{background:#ffffff20}.chat-bubble.emoji-bubble span{display:block;font-size:30px;line-height:1.1}.chat-bubble.emoji-bubble{padding:7px 12px 9px}

.chat-history{position:absolute;z-index:3;left:18px;bottom:60px;width:min(265px,25vw);border-radius:12px;background:#10221bbd;border:1px solid #ffffff30;color:#f5f1df;backdrop-filter:blur(8px)}.chat-history-list{height:132px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:9px 10px;font-size:12px;line-height:1.6;overflow-wrap:anywhere;scrollbar-width:thin;scrollbar-color:#d6c49377 transparent}.chat-history-line{margin:0 0 4px}.chat-history-name{color:#ead29b;font-weight:700}.chat-history-message{color:#f8f5e9}@media(max-width:700px){.chat-history{left:12px;bottom:max(260px,33dvh);width:min(215px,57vw)}.chat-history-list{height:96px;padding:7px 9px;font-size:11px}}@media(max-height:520px){.chat-history{left:10px;bottom:165px;width:min(210px,30vw)}.chat-history-list{height:76px}}

/* Keep the recent chat unobtrusive on phones while preserving readable text and touch scrolling. */
@media(max-width:700px){.chat-history{background:rgba(10,22,18,.12);border-color:transparent;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none}.chat-history-list{height:auto;max-height:96px;padding:3px 5px;text-shadow:0 1px 3px #000,0 1px 6px #000}.chat-history-line{margin-bottom:2px}}
@media(max-width:700px) and (max-height:520px){.chat-history-list{max-height:76px}}

/* A soft, see-through speech bubble keeps crowded views readable. */
.chat-bubble,.chat-bubble:after{background:rgba(255,249,232,.76)}@media(max-width:700px){.chat-bubble{max-width:min(180px,48vw);padding:6px 9px;font-size:11px;box-shadow:0 2px 8px #0004}}

/* Subtle mobile controls reveal more of the scene; focused controls stay readable. */
@media(max-width:700px){.controls .control,.top-actions .pill,.room-population,.chat-bar{background:rgba(16,32,27,.42);border-color:rgba(255,255,255,.26);backdrop-filter:none;-webkit-backdrop-filter:none;text-shadow:0 1px 4px #000}.chat-bar input{color:#fff;text-shadow:0 1px 4px #000}.chat-bar input::placeholder{color:#e0e7d8}.chat-bar:focus-within{background:rgba(16,32,27,.90);border-color:#e3cb92}.controls .control[aria-expanded=true],.controls .control:active{background:rgba(16,32,27,.88)}}

/* A compact, translucent match chat shared by players and spectators. */
.game-chat{position:absolute;z-index:30;left:12px;bottom:92px;width:min(290px,calc(100vw - 24px));color:#fff8e8;font:14px 'Gowun Batang',serif;pointer-events:auto;text-shadow:0 1px 3px #000}
.game-chat-log{height:78px;overflow-y:auto;overflow-wrap:anywhere;background:rgba(13,27,21,.55);border-radius:9px 9px 0 0;padding:6px 9px;scrollbar-width:thin}.game-chat-log:empty{height:18px}.game-chat-log strong{color:#f1d69e}.game-chat-form{display:flex;background:rgba(16,35,27,.85);border:1px solid #cbb17b88;border-radius:0 0 9px 9px;overflow:hidden}.game-chat-form input{min-width:0;flex:1;background:transparent;color:#fff;border:0;padding:8px;font:inherit}.game-chat-form button{border:0;background:#e9d095;color:#26362c;padding:0 12px;font:inherit}.game-chat-form input:focus{outline:2px solid #e9d095;outline-offset:-2px}@media(max-width:650px){.game-chat{left:8px;bottom:155px;width:min(235px,62vw);font-size:12px}.game-chat-log{height:54px;background:rgba(13,27,21,.38)}.game-chat-log:empty{height:10px}.game-chat-form input{padding:7px}}

.yut-player-emote,.yut-spectator-emote{font-size:42px}.janggi-emote{font-size:96px}.yut-emote-tray,.janggi-emotes{max-height:min(45vh,270px);overflow-y:auto}

/* Keep the world visible through conversation UI; text stays fully opaque. */
.chat-history{background:rgba(10,22,18,.10);border-color:transparent;backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none}
.chat-history-list{height:auto;max-height:132px;text-shadow:0 1px 3px #000,0 1px 6px #000}
.chat-bubble,.chat-bubble:after{background:rgba(12,28,22,.38)}
.chat-bubble{color:#fffdf4;text-shadow:0 1px 3px #000,0 1px 6px #000;box-shadow:none}
.chat-bubble b{color:#f5dfad}
.game-chat-log{background:rgba(10,22,18,.16);text-shadow:0 1px 3px #000,0 1px 6px #000}
.game-chat-form{background:rgba(16,35,27,.48)}
@media(max-width:700px){
  .chat-history{background:transparent}
  .chat-history-list{max-height:96px}
  .chat-bubble,.chat-bubble:after{background:rgba(12,28,22,.28)}
  .controls .control,.top-actions .pill,.room-population,.chat-bar{background:rgba(16,32,27,.28);border-color:rgba(255,255,255,.18)}
  .chat-bar:focus-within{background:rgba(16,32,27,.88)}
  .game-chat-log{background:rgba(10,22,18,.10)}
  .game-chat-form{background:rgba(16,35,27,.38)}
}
@media(max-width:700px) and (max-height:520px){.chat-history-list{max-height:76px}}

/* On touch screens, match chat stays collapsed until requested so it never masks the board. */
.game-chat-toggle{display:none}
@media (max-width:650px), (pointer:coarse) and (max-height:600px){
 .game-chat{left:max(8px,env(safe-area-inset-left));bottom:max(12px,env(safe-area-inset-bottom));width:auto;max-width:calc(100vw - 16px);pointer-events:none}
 .game-chat-toggle{display:block;min-width:56px;min-height:42px;border:1px solid #e4d3a677;border-radius:22px;padding:6px 12px;background:#18372ed9;color:#fff2d4;font:14px 'Gowun Batang',serif;pointer-events:auto;touch-action:manipulation}
 .game-chat-panel{display:none;position:absolute;bottom:48px;left:0;width:min(240px,75vw);pointer-events:auto}.game-chat-open .game-chat-panel{display:block}
 .game-chat-log{height:64px;max-height:20vh;background:rgba(13,27,21,.76)}.game-chat-form{background:rgba(16,35,27,.92)}
}

@media(min-width:651px){.game-chat{width:auto;bottom:20px}.game-chat-toggle{display:block;min-height:38px;border:1px solid #e4d3a677;border-radius:20px;padding:5px 13px;background:#18372ed9;color:#fff2d4;font:14px Gowun Batang,serif}.game-chat-panel{display:none;position:absolute;bottom:44px;left:0;width:210px}.game-chat-open .game-chat-panel{display:block}.game-chat-log{height:55px}.game-chat-form input{padding:6px}}

.chat-bubble .bubble-translation{display:block;margin-top:4px;padding-top:4px;border-top:1px solid #8887;font-size:.9em}
/* On touch devices the translucent history must not block taps or camera
   drags. It becomes scrollable while the chat input is focused. */
@media (pointer:coarse){.chat-history{pointer-events:none}body.chat-keyboard-open .chat-history{pointer-events:auto}}
