/* Realmcraft UI theme — follows DESIGN.md §5.1 and mockups/character-select.html:
   dark panels, thin gold metal frames, one decorative title font + one text font. */
:root {
  --gold: #f2c14e; --gold2: #a8771f; --gold3: #5a3c0c;
  --ink: #f5e6c4; --muted: #b9a679; --panel: #120d08;
  --red: #8e1212; --error: #ff7b6b; --ok: #8ee08e;
  --dawn: #2f6fc4; --dawn-text: #7fb4ff; --ash: #b0281d; --ash-text: #ff7b5c;
  --title-font: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;
  --text-font: 'Alegreya Sans', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: var(--text-font); color: var(--ink); user-select: none; }
input { user-select: text; }
.hidden { display: none !important; }
.title { font-family: var(--title-font); font-weight: 700; letter-spacing: .06em; }
.sm { font-size: 13px; color: var(--muted); }
.gold { color: var(--gold); }

/* ---------- 1280×720 stage for menu screens, scaled to fit ---------- */
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { width: 1280px; height: 720px; position: relative; flex: none; transform-origin: center; overflow: clip;
  background: radial-gradient(ellipse at 50% 35%, #3b2a4a 0%, #1d1426 40%, #0a070d 75%); transition: background 1s; }
#stage.tint-dawn { background: radial-gradient(ellipse at 50% 35%, #2a3b5a 0%, #141d2e 40%, #07090f 75%); }
#stage.tint-ash { background: radial-gradient(ellipse at 50% 35%, #4a2420 0%, #26120f 40%, #0d0707 75%); }
.screen { position: absolute; inset: 0; }

/* scene layers */
#scene { position: absolute; inset: 0; pointer-events: none; }
.fog { position: absolute; left: -10%; right: -10%; height: 200px; bottom: 120px; background: radial-gradient(ellipse at center, rgba(170,150,200,.18), transparent 70%); animation: fog 18s ease-in-out infinite alternate; }
@keyframes fog { to { transform: translateX(80px); } }
.platform { position: absolute; left: 390px; top: 520px; width: 420px; height: 120px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #5d5146 0%, #3a3029 55%, #1c1612 100%); box-shadow: 0 18px 40px #000, inset 0 -10px 20px rgba(0,0,0,.6); transition: opacity .6s; }
.runes { position: absolute; left: 430px; top: 538px; width: 340px; height: 84px; border-radius: 50%; border: 2px solid rgba(110,180,255,.35);
  box-shadow: 0 0 18px rgba(110,180,255,.35), inset 0 0 18px rgba(110,180,255,.25); animation: pulse 3s ease-in-out infinite; transition: opacity .6s; }
.runes.ash { border-color: rgba(255,120,60,.4); box-shadow: 0 0 18px rgba(255,110,50,.4), inset 0 0 18px rgba(255,110,50,.3); }
@keyframes pulse { 50% { opacity: .45; } }
.pillar { position: absolute; bottom: 90px; width: 70px; background: linear-gradient(90deg, #1b1714, #4a3f36 40%, #2a231e); border-top: 6px solid #5e5044; }
.torch { position: absolute; width: 16px; height: 40px; background: linear-gradient(#5b3a1d, #2b1a0b); }
.flame { position: absolute; left: -12px; top: -48px; width: 40px; height: 56px; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 75%, #fff6c8 0%, #ffbe3b 30%, #ff5a12 60%, rgba(255,60,0,0) 75%); filter: blur(1px); animation: flick .18s infinite alternate; }
.glow { position: absolute; left: -110px; top: -140px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(255,150,50,.35), transparent 65%); animation: flick 1.3s infinite alternate; }
@keyframes flick { from { transform: scale(1,1) translateY(0); } to { transform: scale(.92,1.08) translateY(-2px); opacity: .9; } }
.ember { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 6px #ff8a00; animation: rise linear forwards; }
@keyframes rise { to { transform: translate(var(--dx), -360px); opacity: 0; } }
#hero { position: absolute; left: 500px; top: 120px; width: 200px; height: 420px; transition: transform .5s, opacity .4s; }
#hero > svg { width: 230px; height: 460px; margin-left: -15px; animation: breathe 4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scaleY(1.012); } }
.aura { position: absolute; left: 470px; top: 150px; width: 260px; height: 420px; border-radius: 50%; filter: blur(30px); opacity: .25; transition: background .6s, opacity .6s; }
.castle { position: absolute; left: 0; right: 0; bottom: 0; transition: opacity .8s; }

/* logo */
.logo { position: absolute; left: 30px; top: 22px; text-align: center; }
.logo .name { font-size: 46px; color: var(--gold); text-shadow: 0 0 18px rgba(242,140,40,.6), 0 3px 0 #5a3c0c, 0 4px 8px #000; }
.logo.center { left: 0; right: 0; top: 60px; }
.logo.center .name { font-size: 76px; }
.logo .sub { letter-spacing: .3em; margin-top: -4px; }

/* ---------- frames & buttons ---------- */
.frame { position: absolute; background: linear-gradient(#1d150d, #0d0905); border: 2px solid var(--gold2);
  box-shadow: 0 0 0 1px #000, 0 0 0 4px #2a1c0a, 0 0 0 5px var(--gold3), 0 10px 30px rgba(0,0,0,.8), inset 0 0 30px rgba(0,0,0,.8); border-radius: 6px; }
.frame::before, .frame::after { content: ""; position: absolute; width: 22px; height: 22px; border: 3px solid var(--gold); top: -7px; left: -7px; border-right: none; border-bottom: none; pointer-events: none; }
.frame::after { left: auto; right: -7px; transform: scaleX(-1); }
.frame.static { position: relative; }
.hdr { text-align: center; padding: 10px 0 8px; border-bottom: 1px solid var(--gold3); background: linear-gradient(#2e2010, #150e06); }
.btn { font-family: var(--title-font); font-weight: 700; font-size: 17px; color: var(--gold); letter-spacing: .03em; cursor: pointer;
  background: linear-gradient(#5e0d0d, #3a0606 50%, #240303); border: 2px solid var(--gold2); border-radius: 5px; padding: 7px 16px;
  box-shadow: inset 0 1px 0 rgba(255,210,130,.35), inset 0 -6px 10px rgba(0,0,0,.5), 0 2px 6px #000; text-shadow: 0 1px 2px #000; }
.btn:hover:not(:disabled) { background: linear-gradient(#8a1717, #560a0a 50%, #340505); color: #ffe9a8;
  box-shadow: inset 0 1px 0 rgba(255,210,130,.5), 0 0 12px rgba(255,170,60,.45), 0 2px 6px #000; }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: default; }
.btn.big { font-size: 26px; padding: 12px 56px; border-width: 3px; }
.btn.rot { width: 40px; height: 40px; border-radius: 50%; padding: 0; font-size: 20px; }
.link { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.link:hover { color: var(--gold); }

/* form fields */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 14px; color: var(--muted); }
.field input, input.name { font-family: var(--text-font); font-size: 17px; color: var(--ink); background: #0b0704; border: 2px solid var(--gold3);
  border-radius: 4px; padding: 7px 10px; outline: none; }
.field input:focus, input.name:focus { border-color: var(--gold2); box-shadow: 0 0 10px rgba(242,193,78,.35); }
input.name { font-family: var(--title-font); font-size: 22px; font-weight: 700; color: var(--gold); text-align: center; width: 260px; border-color: var(--gold2); }
.err { color: var(--error); font-size: 14px; min-height: 18px; text-align: center; margin-top: 4px; }

/* ---------- login ---------- */
#login-box { left: 470px; top: 250px; width: 340px; padding: 0 22px 18px; }
#login-box .hdr { margin: 0 -22px 14px; }
.status-line { position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px; font-size: 11px; opacity: .6; white-space: nowrap; }

/* ---------- realm list ---------- */
#realm-box { left: 290px; top: 150px; width: 700px; height: 420px; }
.realms { width: 100%; border-collapse: collapse; }
.realms th { font-family: var(--title-font); color: var(--gold); text-align: left; font-size: 17px; padding: 8px 14px; border-bottom: 1px solid var(--gold3); }
.realms td { padding: 9px 14px; border-bottom: 1px solid rgba(90,60,12,.4); font-size: 16px; }
.realms tr.row { cursor: pointer; }
.realms tr.row:hover td { background: rgba(255,200,100,.06); }
.realms tr.sel td { background: rgba(242,193,78,.14); }
.realms tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.realms tr.off td { opacity: .45; }
.pop-Ниско { color: var(--ok); } .pop-Средно { color: #f2d14e; } .pop-Високо { color: #ff9b4e; } .pop-Пълен, .pop-Офлайн { color: var(--error); }
.type-pvp { color: var(--ash-text); }

/* ---------- character select (mockup) ---------- */
.list { padding: 8px; max-height: 410px; overflow-y: auto; }
.ch { display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-bottom: 6px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.ch:hover { background: rgba(255,200,100,.06); border-color: #4a3615; }
.ch.sel { background: linear-gradient(90deg, rgba(242,193,78,.22), rgba(242,193,78,.04)); border-color: var(--gold2); box-shadow: inset 0 0 12px rgba(242,193,78,.15); }
.ch.empty { opacity: .35; font-style: italic; cursor: default; }
.ch.empty:hover { background: none; border-color: transparent; }
.crest { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gold2); display: flex; align-items: center; justify-content: center;
  font-family: var(--title-font); font-weight: 700; font-size: 18px; flex: none; color: var(--gold); }
.nm { font-family: var(--title-font); font-weight: 700; font-size: 20px; color: var(--gold); line-height: 1; }

/* ---------- faction choice ---------- */
.banner { position: absolute; top: 112px; width: 360px; height: 560px; cursor: pointer; transition: transform .3s, filter .3s; filter: brightness(.85); }
.banner:hover, .banner.sel { transform: translateY(-8px); filter: brightness(1.1) drop-shadow(0 0 22px var(--glow)); }
.banner svg.cloth { position: absolute; inset: 0; width: 100%; height: 100%; }
.banner .content { position: absolute; left: 40px; right: 40px; top: 30px; text-align: center; }
.banner .fname { font-size: 32px; color: var(--gold); text-shadow: 0 2px 4px #000; }
.banner .motto { font-style: italic; color: var(--ink); margin: 2px 0 10px; text-shadow: 0 1px 2px #000; }
.banner .emblem { width: 120px; height: 120px; margin: 4px auto 6px; }
.banner .desc { font-size: 15px; line-height: 1.4; text-shadow: 0 1px 2px #000; }
.banner .fspells { margin-top: 12px; text-align: left; }

/* ---------- race choice (mockup) ---------- */
.medal { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--gold2); cursor: pointer; position: relative;
  box-shadow: 0 0 0 2px #000, inset 0 0 12px rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; }
.medal:hover { border-color: var(--gold); }
.medal.sel { border-color: #fff2b8; box-shadow: 0 0 0 2px #000, 0 0 16px var(--gold); }
.medal span { width: 30px; height: 30px; border-radius: 50%; }
.rlab { font-size: 13px; text-align: center; color: var(--muted); margin-top: 3px; width: 80px; }
.spell { display: flex; gap: 8px; align-items: center; margin: 7px 0; }
.ico { width: 34px; height: 34px; border: 1px solid var(--gold2); border-radius: 3px; flex: none; box-shadow: inset 0 0 8px #000; display: flex; align-items: center; justify-content: center; }
.ico svg { width: 24px; height: 24px; }

/* ---------- dialogs ---------- */
.modal { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal .frame { position: relative; width: 380px; padding: 0 20px 18px; text-align: center; }
.modal .hdr { margin: 0 -20px 14px; }
.modal .row { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.update-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center; padding: 6px; font-family: var(--title-font); font-weight: 700;
  background: linear-gradient(#5e0d0d, #3a0606); border-bottom: 2px solid var(--gold2); color: var(--gold); }
.update-banner .btn { padding: 2px 12px; font-size: 15px; margin-left: 10px; }

/* ---------- in-game (full window) ---------- */
#game { position: fixed; inset: 0; background: #000; }
#race-faction-emblem svg { width: 100%; height: 100%; display: block; }
