* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #10131c; overflow: hidden; font-family: "Trebuchet MS", "Segoe UI", sans-serif; color: #3a2a22; user-select: none; -webkit-user-select: none; }
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden; background: #000; }
#c { position: absolute; inset: 0; width: 1280px; height: 720px; display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
kbd { font: 11px ui-monospace, Menlo, monospace; background: rgba(0,0,0,.18); border-radius: 4px; padding: 0 4px; margin-left: 3px; }

/* screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(#3d9cf0, #c8ecff 70%, #f6e7b4); z-index: 20; }
.logo { display: flex; flex-direction: column; align-items: center; transform: rotate(-3deg); }
.logo .r { font-size: 120px; font-weight: 900; letter-spacing: 2px; color: #ffd84a; -webkit-text-stroke: 5px #3a2a22; paint-order: stroke fill; text-shadow: 0 8px 0 #c9603f, 0 12px 0 #3a2a22; }
.logo .tag { margin-top: 6px; background: #f6ecd2; border: 3px solid #3a2a22; border-radius: 10px; padding: 4px 22px; font-size: 26px; font-weight: bold; box-shadow: 0 4px 0 #3a2a22; }
.sub { font-size: 20px; color: #24405c; margin: 34px 0 6px; font-weight: bold; }
#status { font-size: 16px; color: #24405c; }

.panel { background: #f6ecd2; border: 3px solid #3a2a22; border-radius: 14px; box-shadow: 0 6px 0 rgba(58,42,34,.55); }
.creator { width: 860px; padding: 18px 26px 14px; }
.creator h2 { margin: 0 0 10px; font-size: 26px; }
.cols { display: flex; gap: 22px; }
.preview { width: 240px; height: 280px; border: 3px solid #3a2a22; border-radius: 12px; background: linear-gradient(#8fd0ff, #e9f7ff 65%, #e6d3ab 65%); }
.opts { flex: 1; display: grid; grid-template-columns: 96px 1fr; gap: 7px 10px; align-items: center; font-size: 14px; }
.opts label { font-weight: bold; }
.opts .muted { color: #8a7a66; font-size: 12.5px; line-height: 1.35; }
.sw { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sw button { width: 26px; height: 26px; border-radius: 7px; border: 2px solid #3a2a22; padding: 0; }
.sw button.on { outline: 3px solid #ff7a2e; outline-offset: 1px; }
.sw button.txt { width: auto; padding: 0 10px; background: #fff; font-size: 13px; }
.sw input[type=color] { width: 30px; height: 28px; padding: 0; border: 2px solid #3a2a22; border-radius: 7px; background: none; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.row label { font-weight: bold; }
.row input, #chatin { font: inherit; font-size: 16px; padding: 7px 10px; border: 2px solid #3a2a22; border-radius: 8px; background: #fff; user-select: text; -webkit-user-select: text; }
.primary { background: #ffb02e; border: 3px solid #3a2a22; border-radius: 10px; padding: 8px 20px; font-weight: bold; font-size: 17px; box-shadow: 0 3px 0 #3a2a22; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #3a2a22; }
#cerr { color: #b0352a; min-height: 18px; margin: 8px 0 0; font-weight: bold; }

/* hud */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#mapname { position: absolute; left: 14px; top: 12px; background: rgba(30,36,52,.82); color: #fff; border: 2px solid #fff; border-radius: 10px; padding: 5px 14px; font-weight: bold; font-size: 16px; pointer-events: none; }
#mapname small { display: block; font-weight: normal; font-size: 12px; color: #ffe08a; }
#mm { position: absolute; right: 12px; top: 10px; padding: 5px; background: rgba(30,36,52,.72); border: 2px solid #fff; border-radius: 10px; pointer-events: none; line-height: 0; }
#buffs { position: absolute; right: 232px; top: 12px; display: flex; gap: 6px; pointer-events: none; }
#buffs div { background: rgba(30,36,52,.82); color: #fff; border-radius: 8px; padding: 4px 9px; font-size: 13px; border: 2px solid #9fe07a; }
#chatlog { position: absolute; left: 12px; bottom: 62px; width: 430px; max-height: 118px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 13.5px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
#chatlog p { margin: 1px 0; background: rgba(20,24,36,.42); padding: 1px 7px; border-radius: 6px; align-self: flex-start; }
#chatlog .good { color: #b8ff9a; } #chatlog .bad { color: #ffaa9a; } #chatlog .sys { color: #ffe08a; } #chatlog b { color: #9fd8ff; }
#hud.typing #chatlog { bottom: 96px; }
#chatin { position: absolute; left: 12px; bottom: 62px; width: 430px; font-size: 14px; padding: 5px 9px; }
#bar { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(#4a5470, #2c3348); border-top: 3px solid #1c2030; display: flex; align-items: center; gap: 10px; padding: 0 12px; color: #fff; }
#lvl { background: #ffb02e; color: #3a2a22; border: 2px solid #1c2030; border-radius: 9px; padding: 2px 9px; font-size: 12px; text-align: center; line-height: 1.05; }
#lvl b { display: block; font-size: 20px; }
#who { min-width: 110px; line-height: 1.15; } #who b { display: block; font-size: 15px; } #who i { font-size: 12px; color: #ffe08a; font-style: normal; }
.gauge { position: relative; height: 22px; flex: 1; max-width: 190px; background: #1c2030; border: 2px solid #11141f; border-radius: 7px; overflow: hidden; }
.gauge div { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; transition: width .2s; }
.gauge span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; font-weight: bold; text-shadow: 0 1px 2px #000; }
.gauge.hp div { background: linear-gradient(#ff7a6a, #d9352a); } .gauge.mp div { background: linear-gradient(#6ab8ff, #2a6fd9); } .gauge.exp div { background: linear-gradient(#ffe86a, #e0a820); }
.gauge.exp { max-width: 260px; }
#btns { margin-left: auto; display: flex; gap: 5px; }
#btns button { background: #f6ecd2; border: 2px solid #1c2030; border-radius: 8px; padding: 5px 8px; font-size: 12.5px; font-weight: bold; color: #3a2a22; }
#btns button:hover { background: #fff; }
#toast { position: absolute; left: 50%; top: 86px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#toast div { background: rgba(30,36,52,.86); color: #fff; padding: 5px 14px; border-radius: 9px; font-size: 14px; animation: fade 3.2s forwards; }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* windows */
.win { position: absolute; background: #f6ecd2; border: 3px solid #3a2a22; border-radius: 12px; box-shadow: 0 5px 0 rgba(58,42,34,.5); font-size: 14px; }
.win h3 span { flex: 1; }
.win h3 { margin: 0; padding: 6px 12px; background: #4a5470; color: #fff; border-radius: 8px 8px 0 0; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.win h3 button { background: #d9523f; color: #fff; border: 2px solid #1c2030; border-radius: 6px; width: 24px; height: 22px; line-height: 14px; font-weight: bold; padding: 0; }
.win .body { padding: 10px 12px; }
.win table { width: 100%; border-collapse: collapse; } .win td { padding: 3px 4px; }
.win .plus { background: #ffb02e; border: 2px solid #3a2a22; border-radius: 6px; width: 24px; height: 22px; font-weight: bold; line-height: 14px; padding: 0; }
.win .muted { color: #8a7a66; font-size: 12.5px; }
.btn { background: #ffb02e; border: 2px solid #3a2a22; border-radius: 8px; padding: 4px 12px; font-weight: bold; font-size: 13.5px; box-shadow: 0 2px 0 #3a2a22; }
.btn.alt { background: #fff; } .btn:disabled { opacity: .45; cursor: default; }
#w-stats { left: 20px; top: 70px; width: 270px; }
#w-items { right: 20px; top: 60px; width: 330px; }
#w-skills { left: 310px; top: 70px; width: 330px; }
#w-quests { left: 20px; top: 330px; width: 330px; }
#w-help { left: 400px; top: 150px; width: 480px; }
#w-wmap { left: 190px; top: 18px; width: 900px; }
#w-wmap canvas { display: block; width: 870px; height: 580px; border-radius: 8px; border: 2px solid #3a2a22; }
.grid { display: grid; grid-template-columns: repeat(6, 44px); gap: 5px; margin-top: 8px; }
.slot { width: 44px; height: 44px; background: #e6d8b4; border: 2px solid #b9a67a; border-radius: 8px; position: relative; display: flex; align-items: center; justify-content: center; font-size: 25px; cursor: pointer; }
.slot:hover { border-color: #ff7a2e; background: #fff3d2; }
.slot i { position: absolute; right: 2px; bottom: 0; font-size: 11px; font-style: normal; font-weight: bold; color: #3a2a22; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.slot img { width: 36px; height: 36px; object-fit: contain; }
.equip { display: flex; gap: 8px; align-items: center; } .equip .slot { background: #d8e4f0; border-color: #8aa0b8; }
.equip span { font-size: 11px; text-align: center; display: block; color: #6a5a46; }
.coins { margin-top: 8px; font-weight: bold; }
#tip { position: absolute; z-index: 40; pointer-events: none; background: rgba(30,36,52,.95); color: #fff; border: 2px solid #fff; border-radius: 9px; padding: 7px 10px; font-size: 13px; max-width: 250px; }
#tip b { color: #ffe08a; display: block; font-size: 14px; } #tip .st { color: #9fe07a; } #tip .act { color: #9fd8ff; margin-top: 4px; }

/* dialogs */
#w-dialog { left: 240px; bottom: 76px; width: 800px; }
#w-dialog .body { display: flex; gap: 14px; }
#w-dialog canvas { width: 130px; height: 150px; background: linear-gradient(#bfe6ff, #f6ecd2); border: 2px solid #3a2a22; border-radius: 10px; flex: none; }
#w-dialog .txt { flex: 1; } #w-dialog .txt p { margin: 0 0 10px; font-size: 15px; line-height: 1.4; }
#w-dialog .choices { display: flex; flex-wrap: wrap; gap: 7px; }
#w-shop { left: 330px; top: 60px; width: 620px; } #w-lab { left: 300px; top: 60px; width: 680px; }
.list { max-height: 400px; overflow-y: auto; } .list .it { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px dashed #c9b88a; }
.list .it .ico { font-size: 26px; width: 36px; text-align: center; } .list .it .nm { flex: 1; } .list .it .nm small { display: block; color: #6a5a46; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; } .tabs button { flex: 1; }
.tabs .on { background: #4a5470; color: #fff; }
.need { color: #b0352a; font-weight: bold; } .have { color: #2f7a3a; font-weight: bold; }

#w-question { left: 290px; top: 110px; width: 700px; z-index: 30; }
#w-question .q { font-size: 19px; font-weight: bold; white-space: pre-line; margin: 4px 0 14px; line-height: 1.4; }
#w-question .timer { height: 14px; background: #1c2030; border-radius: 7px; overflow: hidden; border: 2px solid #3a2a22; margin-bottom: 14px; }
#w-question .timer div { height: 100%; background: linear-gradient(90deg, #ff5a3a, #ffd84a, #6ad86a); width: 100%; }
#w-question .ch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#w-question .ch button { background: #fff; border: 3px solid #3a2a22; border-radius: 10px; padding: 12px; font-size: 17px; font-weight: bold; box-shadow: 0 3px 0 #3a2a22; }
#w-question .ch button:hover:not(:disabled) { background: #fff3c2; }
#w-question .ch button.right { background: #b8f0a0; } #w-question .ch button.wrong { background: #ffb0a0; }
#w-question .res { margin-top: 14px; font-size: 15px; line-height: 1.45; } #w-question .res b.ok { color: #2f7a3a; } #w-question .res b.no { color: #b0352a; }
#w-dead { left: 440px; top: 240px; width: 400px; z-index: 30; text-align: center; } #w-dead .body { padding: 18px; font-size: 16px; }

/* menu, settings, bestiary */
#w-menu { left: 490px; top: 200px; width: 300px; z-index: 25; } #w-menu .body { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.btn.big { font-size: 17px; padding: 10px; } .btn.on { background: #4a5470; color: #fff; }
#w-settings { left: 420px; top: 190px; width: 440px; z-index: 25; }
.setrow { display: flex; align-items: center; gap: 12px; margin: 10px 2px; } .setrow label { width: 140px; font-weight: bold; } .setrow input[type=range] { flex: 1; }
.langs { display: flex; gap: 6px; }
#w-dex { left: 190px; top: 40px; width: 900px; }
.dexcols { display: flex; gap: 14px; } .dexlist { display: grid; grid-template-columns: repeat(3, 100px); gap: 8px; }
.dextile { background: #e6d8b4; border: 2px solid #b9a67a; border-radius: 10px; text-align: center; cursor: pointer; padding: 3px 2px 5px; }
.dextile canvas { width: 66px; height: 55px; display: block; margin: 0 auto; } .dextile span { font-size: 11px; font-weight: bold; display: block; line-height: 1.1; min-height: 24px; }
.dextile.on { border-color: #ff7a2e; background: #fff3d2; } .dextile.unk span { color: #8a7a66; }
.dexdetail { flex: 1; min-height: 430px; } .dexdetail canvas { float: right; width: 150px; height: 115px; background: linear-gradient(#cfe9ff, #f6ecd2); border: 2px solid #3a2a22; border-radius: 10px; margin: 0 0 8px 12px; }
.dexdetail h4 { margin: 2px 0 0; font-size: 21px; } .dexdetail h4 small { font-size: 13px; color: #8a5a22; } .dexdetail .sci { margin: 0 0 8px; font-style: italic; color: #6a5a46; }
.dexdetail p { margin: 6px 0; } .dexdetail .info { background: #fff8e2; border-left: 4px solid #ffb02e; padding: 7px 10px; border-radius: 6px; line-height: 1.4; }
.dexstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 6px 0; } .dexstats span { background: #e6d8b4; border-radius: 7px; padding: 4px 8px; } .dexstats b { display: block; font-size: 11px; color: #8a5a22; }
.dexdrops { display: flex; flex-wrap: wrap; gap: 5px; } .dexdrops span { background: #fff; border: 1px solid #b9a67a; border-radius: 7px; padding: 2px 7px; font-size: 13px; } .dexdrops i { color: #8a5a22; font-style: normal; font-weight: bold; }
.clangs { margin-left: auto; display: flex; gap: 5px; } .clangs button { background: #fff; border: 2px solid #3a2a22; border-radius: 7px; padding: 3px 8px; font-size: 12px; font-weight: bold; } .clangs button.on { background: #4a5470; color: #fff; }
#btns kbd { font-size: 10px; }
