@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #0d141c;
  --panel: rgba(14, 22, 30, .86);
  --line: rgba(226, 232, 240, .14);
  --muted: #8b96a8;
  --text: #e8ecf2;
  --cyan: #67e8d1;
  --cyan-deep: #0f8f85;
  --red: #e45757;
  --gold: #d9b86c;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); }
body { font-family: Inter, system-ui, sans-serif; }
button { color: inherit; font: inherit; }

#game-shell { position: relative; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 38%, #29414a 0%, #111b25 58%, #090e15 100%); }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grain { position: absolute; inset: 0; opacity: .045; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 48%, rgba(1,5,9,.36) 120%); }

.topbar { position: absolute; left: 0; right: 0; top: 0; padding: 22px 28px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 5; transition: opacity .3s; }
.brand-mini { display: flex; align-items: center; gap: 10px; font-family: Cinzel, serif; font-size: 12px; font-weight: 700; letter-spacing: .18em; color: #bac4d0; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid var(--cyan); color: var(--cyan); box-shadow: inset 0 0 12px rgba(103,232,209,.13); }
.brand-mark::first-letter { transform: rotate(-45deg); }
.run-status { position: absolute; left: 50%; transform: translateX(-50%); top: 20px; display: flex; border: 1px solid rgba(226,232,240,.19); background: rgba(12,20,28,.7); backdrop-filter: blur(14px); box-shadow: 0 8px 26px rgba(0,0,0,.2); }
.room-chip, .objective-chip { min-height: 44px; display: flex; align-items: center; padding: 0 18px; }
.room-chip { gap: 10px; border-right: 1px solid var(--line); }
.eyebrow { font-size: 9px; color: var(--muted); letter-spacing: .17em; }
.room-chip strong { font-family: Cinzel, serif; color: var(--gold); font-size: 13px; }
.objective-chip { gap: 9px; color: #bec7d2; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.objective-dot { width: 6px; height: 6px; background: var(--cyan); transform: rotate(45deg); box-shadow: 0 0 10px var(--cyan); }
.icon-button { width: 38px; height: 38px; border: 1px solid rgba(226,232,240,.19); background: rgba(12,20,28,.7); cursor: pointer; font-weight: 800; }
.icon-button:hover { border-color: var(--cyan); color: var(--cyan); }

.player-hud { position: absolute; z-index: 5; left: 28px; bottom: 28px; display: flex; align-items: center; gap: 12px; transition: opacity .3s; }
.portrait { position: relative; width: 62px; height: 62px; display: grid; place-items: center; background: linear-gradient(145deg, #1d2d33, #0c111a); border: 1px solid rgba(103,232,209,.36); clip-path: polygon(20% 0,80% 0,100% 20%,100% 80%,80% 100%,20% 100%,0 80%,0 20%); }
.portrait-rune { font-family: Cinzel; font-size: 28px; color: var(--cyan); text-shadow: 0 0 14px rgba(103,232,209,.6); }
.level { position: absolute; right: -2px; bottom: -2px; border: 1px solid var(--gold); color: var(--gold); background: var(--ink); font-size: 9px; font-weight: 800; padding: 3px 5px; }
.vitals { width: min(270px, 27vw); }
.health-row { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 9px; font-weight: 800; letter-spacing: .13em; color: #adb7c5; }
.bar { height: 9px; padding: 2px; border: 1px solid var(--line); background: rgba(0,0,0,.45); }
.bar i { display: block; width: 100%; height: 100%; transform-origin: left; transition: transform .18s; }
.health-bar i { background: linear-gradient(90deg, #c83f4a, #ef6b62); box-shadow: 0 0 10px rgba(228,87,87,.38); }
.xp-bar { height: 5px; margin-top: 5px; border-color: rgba(103,232,209,.14); }
.xp-bar i { background: var(--cyan); }
.ally-hud { top:80px;bottom:auto; }
.ally-portrait { border-color:rgba(121,184,255,.46);background:linear-gradient(145deg,#26324b,#0c111a); }
.ally-portrait .portrait-rune { color:#79b8ff;text-shadow:0 0 14px rgba(121,184,255,.6); }
.ally-health-bar i { background:linear-gradient(90deg,#386db5,#79b8ff);box-shadow:0 0 10px rgba(121,184,255,.4); }
.ally-controls { display:block;margin-top:6px;color:#6f86a3;font-size:6px;letter-spacing:.08em; }
.loot-hud { position:absolute; z-index:5; left:102px; bottom:105px; display:flex; flex-direction:column; gap:7px; }
.loot-hud > span { color:#718091; font-size:7px; font-weight:800; letter-spacing:.14em; }
.loot-hud > div { display:flex; gap:5px; }
.loot-slot { width:30px; height:30px; display:grid; place-items:center; border:1px solid rgba(217,184,108,.28); background:rgba(14,22,30,.78); color:var(--gold); font:15px Cinzel; box-shadow:0 6px 16px rgba(0,0,0,.22); }

.abilities { position: absolute; z-index: 5; right: 28px; bottom: 28px; display: flex; gap: 7px; transition: opacity .3s; }
.ability { position: relative; width: clamp(108px,9vw,126px); height: 62px; padding: 10px 8px 9px 53px; display: flex; flex-direction: column; justify-content: center; background: rgba(13,21,29,.79); border: 1px solid rgba(226,232,240,.18); backdrop-filter: blur(12px); transition: .2s; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.ability-icon { position: absolute; left: 9px; top: 9px; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(103,232,209,.28); background: rgba(103,232,209,.07); color: var(--cyan); font-size: 25px; }
.ability strong { font-family: Cinzel; font-size: 10px; letter-spacing: .08em; }
.ability small { color: var(--cyan); font-size: 8px; margin-top: 4px; letter-spacing: .14em; }
.ability:not(.ready) { opacity: .55; filter: grayscale(.6); }
.keycap { position: absolute; right: 6px; top: -9px; padding: 3px 5px; background: #151b26; border: 1px solid var(--line); color: #9ca7b6; font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.cast-bar { position:absolute; z-index:7; left:50%; bottom:116px; width:min(340px,48vw); transform:translateX(-50%); text-align:center; transition:opacity .15s; }
.cast-bar > span { display:block; margin-bottom:6px; color:#d7e7e9; font:700 8px Inter; letter-spacing:.17em; text-shadow:0 2px 8px #000; }
.cast-bar > div { height:10px; padding:2px; border:1px solid rgba(103,232,209,.45); background:rgba(5,10,15,.8); }
.cast-bar i { display:block; height:100%; width:100%; transform-origin:left; background:linear-gradient(90deg,var(--cyan-deep),var(--cyan)); box-shadow:0 0 15px rgba(103,232,209,.55); }

.mechanic-alert { position:absolute; z-index:8; left:50%; top:145px; width:min(520px,calc(100vw - 32px)); min-height:70px; transform:translateX(-50%); display:grid; grid-template-columns:48px 1fr 48px; align-items:center; gap:14px; padding:11px 15px; border:1px solid rgba(255,207,93,.55); background:linear-gradient(100deg,rgba(38,29,15,.94),rgba(14,20,29,.94)); box-shadow:0 16px 45px rgba(0,0,0,.38),inset 0 0 32px rgba(255,190,70,.06); transition:opacity .18s,transform .18s; }
.mechanic-alert:not(.hidden) { animation:mechanic-in .22s ease-out; }
.mechanic-glyph { width:42px; height:42px; display:grid; place-items:center; border:1px solid rgba(255,211,109,.7); color:#ffd36d; background:rgba(255,211,109,.08); font:700 23px Cinzel; box-shadow:0 0 20px rgba(255,190,70,.14); }
.mechanic-copy { min-width:0; display:flex; flex-direction:column; gap:3px; }
.mechanic-copy strong { color:#ffe5a4; font:700 11px Cinzel; letter-spacing:.11em; }
.mechanic-copy span { color:#c7bdac; font-size:9px; letter-spacing:.05em; }
.mechanic-progress { height:5px; margin-top:5px; overflow:hidden; border:1px solid rgba(255,211,109,.25); background:rgba(0,0,0,.34); }
.mechanic-progress i { display:block; height:100%; width:100%; transform-origin:left; background:linear-gradient(90deg,#e09334,#ffe08a); box-shadow:0 0 12px rgba(255,211,109,.55); }
.mechanic-alert > b { color:#fff1be; text-align:right; font:600 19px Cinzel; font-variant-numeric:tabular-nums; }
@keyframes mechanic-in { from{opacity:0;transform:translate(-50%,-8px)} to{opacity:1;transform:translate(-50%,0)} }

.boss-hud { position: absolute; z-index: 5; width: min(560px, 64vw); left: 50%; top: 84px; transform: translateX(-50%); transition: .3s; }
.boss-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 8px; font-family: Cinzel; color: #ecd4b0; letter-spacing: .13em; font-size: 12px; }
.boss-title small { color: var(--red); font: 800 8px Inter; }
.boss-bar { height: 11px; padding: 2px; background: rgba(0,0,0,.6); border: 1px solid rgba(228,87,87,.35); }
.boss-bar i { display: block; width: 100%; height: 100%; transform-origin: left; background: linear-gradient(90deg, #7f1e36, #e45757); box-shadow: 0 0 18px rgba(228,87,87,.5); transition: transform .16s; }
.hidden { opacity: 0 !important; pointer-events: none !important; }

.room-banner { position: absolute; z-index: 6; left: 50%; top: 29%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; opacity: 0; pointer-events: none; }
.room-banner.show { animation: banner 2.7s ease both; }
.room-banner span { color: var(--gold); font-size: 9px; letter-spacing: .35em; margin-bottom: 8px; }
.room-banner strong { font-family: Cinzel; font-size: clamp(20px, 3vw, 38px); letter-spacing: .13em; text-shadow: 0 3px 18px #000; }
@keyframes banner { 0% { opacity:0; transform:translate(-50%,-35%); } 18%,70% { opacity:1; transform:translate(-50%,-50%); } 100% { opacity:0; transform:translate(-50%,-65%); } }
.damage-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px rgba(228,45,54,.7); }
.damage-flash.hit { animation: hit .3s ease-out; }
@keyframes hit { 0% { opacity:.8; } 100% { opacity:0; } }

.screen { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .4s; }
.screen.active { opacity: 1; pointer-events: auto; }
#start-screen { background: radial-gradient(circle at 67% 43%, rgba(48,130,126,.15), transparent 38%), linear-gradient(90deg, rgba(9,15,22,.94) 0%, rgba(10,18,25,.79) 42%, rgba(8,14,19,.05) 80%); justify-items: start; }
.start-copy { width: min(620px, calc(100vw - 48px)); margin-left: clamp(26px, 8vw, 130px); }
.overline { display: flex; align-items: center; gap: 12px; color: var(--gold); font-size: 9px; letter-spacing: .24em; font-weight: 700; }
.overline span { display: inline-block; width: 30px; height: 1px; background: var(--gold); }
h1 { margin: 15px 0 18px; font: 700 clamp(52px, 8vw, 108px)/.8 Cinzel, serif; letter-spacing: -.065em; color: #eef1f4; text-shadow: 0 6px 30px #000; }
h1 span { display: block; margin-left: .55em; color: transparent; -webkit-text-stroke: 1px rgba(232,236,242,.6); }
.start-copy > p { max-width: 520px; color: #9da8b7; font: 400 13px/1.75 Inter; }
.primary-button { min-width: 290px; height: 52px; margin-top: 20px; padding: 0 5px 0 20px; display: inline-flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid rgba(103,232,209,.4); background: linear-gradient(90deg, #153b3d, #102a31); font: 700 10px Inter; letter-spacing: .13em; cursor: pointer; box-shadow: 0 12px 35px rgba(0,0,0,.3); }
.primary-button b { width: 40px; height: 40px; display: grid; place-items: center; background: var(--cyan); color: #071110; font-size: 17px; }
.primary-button:hover { border-color: var(--cyan); filter: brightness(1.14); }
.controls-hint { display: flex; gap: 28px; margin-top: 28px; }
.controls-hint span { display: flex; align-items: center; gap: 8px; }
kbd { padding: 6px 8px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: #ccd4dd; font: 700 8px Inter; }
.controls-hint em { color: #697587; font-size: 7px; font-style: normal; letter-spacing: .13em; }
.license-note { position: absolute; right: 26px; bottom: 24px; color: #536070; font-size: 7px; letter-spacing: .16em; }
.legacy-summary { width:min(520px,100%); margin-top:24px; display:grid; grid-template-columns:1fr 1fr auto; align-items:stretch; border:1px solid rgba(217,184,108,.2); background:rgba(14,23,31,.58); backdrop-filter:blur(10px); }
.legacy-summary > div { padding:12px 15px; display:flex; flex-direction:column; gap:4px; border-right:1px solid var(--line); }
.legacy-summary span, .shard-wallet span { color:#7f8b9c; font-size:7px; font-weight:700; letter-spacing:.14em; }
.legacy-summary strong { color:var(--gold); font:600 13px Cinzel; }
.legacy-summary button { padding:0 16px; border:0; background:rgba(217,184,108,.1); color:var(--gold); cursor:pointer; font-size:8px; font-weight:800; letter-spacing:.12em; }
.legacy-summary button:hover { background:rgba(217,184,108,.2); }

.overlay-screen { background: rgba(6,10,15,.66); backdrop-filter: blur(8px); }
.modal, .upgrade-panel { width: min(540px, calc(100vw - 36px)); padding: 42px; text-align: center; background: linear-gradient(145deg, rgba(23,34,45,.98), rgba(11,18,26,.98)); border: 1px solid rgba(226,232,240,.17); box-shadow: 0 35px 90px rgba(0,0,0,.72); }
.modal.compact { width: min(400px, calc(100vw - 36px)); }
.modal-kicker { color: var(--gold); font-size: 8px; font-weight: 700; letter-spacing: .24em; }
.modal h2, .upgrade-panel h2 { margin: 9px 0 8px; font: 600 clamp(27px,4vw,42px) Cinzel; letter-spacing: .08em; }
.modal > p, .upgrade-panel > p { color: var(--muted); font-size: 12px; }
.text-button { display: block; margin: 18px auto 0; border: 0; background: none; color: #707c8d; cursor: pointer; font-size: 9px; letter-spacing: .15em; }
.text-button:hover { color: #fff; }
.training-link { margin:11px 0 0; color:#91a5b8; }
.mode-links { display:flex;flex-wrap:wrap;gap:0 17px;max-width:680px; }
.mode-links .text-button { margin:10px 0 0;padding:9px 11px;border:1px solid rgba(145,165,184,.16);background:rgba(255,255,255,.025); }
.mode-links .text-button:hover { border-color:rgba(103,232,209,.4);background:rgba(103,232,209,.06); }
.training-panel { width:min(900px,calc(100vw - 36px)); padding:38px; text-align:center; background:linear-gradient(145deg,rgba(23,34,45,.99),rgba(11,18,26,.99)); border:1px solid rgba(121,216,255,.25); box-shadow:0 35px 90px rgba(0,0,0,.72); }
.training-panel h2 { margin:9px 0 7px; font:600 clamp(25px,3.5vw,39px) Cinzel; letter-spacing:.07em; }
.training-panel > p { margin:0;color:var(--muted);font-size:11px; }
.training-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:27px; }
.training-boss { min-height:112px; padding:16px; display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-end; text-align:left; border:1px solid rgba(226,232,240,.14); background:radial-gradient(circle at 85% 15%,color-mix(in srgb,var(--boss-color) 28%,transparent),transparent 45%),rgba(255,255,255,.025); cursor:pointer; transition:.2s; }
.training-boss:hover { transform:translateY(-3px);border-color:var(--boss-color);box-shadow:0 14px 28px rgba(0,0,0,.25); }
.training-boss small { color:var(--boss-color);font:800 7px Inter;letter-spacing:.17em; }
.training-boss strong { margin-top:7px;color:#e8edf2;font:600 12px Cinzel;letter-spacing:.06em; }
.training-boss span { margin-top:5px;color:#78889a;font-size:8px; }
.online-link { color:#71dfcf !important; border-color:rgba(103,232,209,.28) !important; }
.online-panel { width:min(720px,calc(100vw - 36px)); padding:38px; text-align:center; background:linear-gradient(145deg,rgba(18,36,43,.99),rgba(9,17,25,.99)); border:1px solid rgba(103,232,209,.3); box-shadow:0 35px 100px rgba(0,0,0,.78),inset 0 0 70px rgba(103,232,209,.035); }
.online-panel h2 { margin:9px 0 7px; font:600 clamp(25px,3.5vw,39px) Cinzel; letter-spacing:.07em; }
.online-panel > p { min-height:18px; margin:0 0 24px; color:#8fa2b1; font-size:10px; letter-spacing:.05em; }
.online-panel > p.connected { color:var(--cyan); }
.online-panel > p.error { color:#ff8989; }
.online-setup { display:grid; grid-template-columns:1fr 1fr; gap:12px; text-align:left; }
.online-setup label { display:flex; flex-direction:column; gap:7px; }
.online-setup label:first-child { grid-column:1 / -1; }
.online-setup label span { color:#7f93a1; font-size:7px; font-weight:800; letter-spacing:.16em; }
.online-setup input,.online-setup select,.join-row input { width:100%; height:43px; padding:0 13px; border:1px solid rgba(226,232,240,.16); outline:0; background:rgba(255,255,255,.035); color:#e7f0f2; font:700 10px Inter; letter-spacing:.08em; }
.online-setup input:focus,.online-setup select:focus,.join-row input:focus { border-color:rgba(103,232,209,.62); box-shadow:0 0 0 3px rgba(103,232,209,.06); }
.online-setup option { background:#101c24; }
.online-action { grid-column:1 / -1; width:100%; margin-top:5px; }
.join-row { grid-column:1 / -1; display:grid; grid-template-columns:1fr 150px; gap:8px; }
.join-row input { text-align:center; text-transform:uppercase; letter-spacing:.28em; }
.join-row button,.online-room-actions button { border:1px solid rgba(103,232,209,.28); background:rgba(103,232,209,.08); color:var(--cyan); cursor:pointer; font:800 8px Inter; letter-spacing:.12em; }
.join-row button:hover,.online-room-actions button:hover { background:rgba(103,232,209,.17); }
.online-room { display:grid; gap:14px; }
.room-code { padding:17px; border:1px solid rgba(217,184,108,.28); background:rgba(217,184,108,.055); }
.room-code span { display:block; color:#8e8268; font-size:7px; letter-spacing:.18em; }
.room-code strong { display:block; margin-top:4px; color:#f0ce7d; font:600 30px Cinzel; letter-spacing:.2em; }
.member-list { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.online-member { min-height:48px; padding:10px 13px; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; border:1px solid rgba(226,232,240,.12); background:rgba(255,255,255,.025); }
.online-member span { display:flex; flex-direction:column; gap:3px; }
.online-member strong { color:#dce7e9; font:600 10px Cinzel; }
.online-member small { color:#718293; font-size:7px; letter-spacing:.12em; }
.online-member b { color:#d18484; font-size:8px; letter-spacing:.12em; }
.online-member.ready b { color:var(--cyan); }
.online-room-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.online-room-actions button { min-height:44px; }
.online-room-actions button:disabled { opacity:.35; cursor:not-allowed; }
.run-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 28px 0 8px; border-block: 1px solid var(--line); }
.run-stats.four { grid-template-columns:repeat(4,1fr); }
.run-stats div { padding: 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.run-stats div + div { border-left: 1px solid var(--line); }
.run-stats span { color: var(--muted); font-size: 7px; letter-spacing: .15em; }
.run-stats strong { color: var(--gold); font: 600 23px Cinzel; }

.upgrade-panel { width: min(920px, calc(100vw - 36px)); }
.upgrade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.upgrade-card { position: relative; min-height: 220px; padding: 23px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.025); cursor: pointer; overflow: hidden; }
.upgrade-card::before { content:""; position:absolute; left:0; top:0; width:100%; height:2px; background:var(--accent, var(--cyan)); transform:scaleX(.25); transform-origin:left; transition:.25s; }
.upgrade-card:hover { background: rgba(255,255,255,.055); border-color: color-mix(in srgb, var(--accent, var(--cyan)) 55%, transparent); transform: translateY(-3px); }
.upgrade-card:hover::before { transform:scaleX(1); }
.upgrade-rune { width: 48px; height: 48px; display:grid; place-items:center; border:1px solid color-mix(in srgb, var(--accent) 45%, transparent); color:var(--accent); font: 24px Cinzel; }
.upgrade-card small { margin-top: 24px; color: var(--accent); font-size: 7px; letter-spacing:.18em; }
.upgrade-card strong { margin: 7px 0; font: 600 15px Cinzel; letter-spacing:.06em; }
.upgrade-card p { margin:0; color:var(--muted); font-size:10px; line-height:1.6; }

.forge-panel { width:min(1020px,calc(100vw - 36px)); max-height:calc(100vh - 40px); overflow:auto; padding:38px; background:linear-gradient(145deg,rgba(26,37,47,.99),rgba(10,17,24,.99)); border:1px solid rgba(217,184,108,.22); box-shadow:0 35px 90px rgba(0,0,0,.72); }
.forge-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:30px; text-align:left; }
.forge-heading h2 { margin:7px 0 5px; font:600 clamp(25px,3.5vw,40px) Cinzel; letter-spacing:.06em; }
.forge-heading p { margin:0; color:var(--muted); font-size:11px; }
.shard-wallet { min-width:130px; padding:13px 18px; text-align:right; border:1px solid rgba(217,184,108,.25); background:rgba(217,184,108,.07); }
.shard-wallet strong { display:block; margin-top:3px; color:var(--gold); font:600 25px Cinzel; }
.forge-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:28px; }
.forge-item { position:relative; min-height:154px; padding:17px; text-align:left; border:1px solid var(--line); background:rgba(255,255,255,.025); }
.forge-item.maxed { border-color:rgba(103,232,209,.32); }
.forge-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.forge-icon { width:35px; height:35px; display:grid; place-items:center; color:var(--gold); border:1px solid rgba(217,184,108,.3); font:19px Cinzel; }
.forge-level { color:#788596; font-size:8px; letter-spacing:.12em; }
.forge-item h3 { margin:13px 0 5px; font:600 12px Cinzel; letter-spacing:.06em; }
.forge-item p { min-height:33px; margin:0 0 13px; color:var(--muted); font-size:9px; line-height:1.5; }
.forge-item button { width:100%; min-height:31px; border:1px solid rgba(217,184,108,.24); background:rgba(217,184,108,.08); color:var(--gold); cursor:pointer; font-size:8px; font-weight:800; letter-spacing:.1em; }
.forge-item button:hover:not(:disabled) { background:var(--gold); color:#131009; }
.forge-item button:disabled { opacity:.42; cursor:not-allowed; }
.forge-close { margin-top:22px; }

.mobile-controls { display: none; }

@media (max-width: 760px) {
  .topbar { padding: 14px; }
  .brand-mini > span:last-child { display:none; }
  .run-status { top: 14px; }
  .objective-chip { display:none; }
  .room-chip { border:0; }
  .player-hud { left:14px; bottom:102px; }
  .ally-hud { top:70px;bottom:auto; }
  .loot-hud { left:14px; bottom:178px; }
  .vitals { width:160px; }
  .abilities { display:none; }
  .boss-hud { top:68px; width:calc(100% - 28px); }
  .mechanic-alert { top:120px;grid-template-columns:38px 1fr 38px;gap:9px;padding:9px; }
  .mechanic-glyph { width:34px;height:34px;font-size:18px; }
  .mechanic-copy span { display:none; }
  .controls-hint { display:none; }
  .start-copy { margin-left:24px; }
  .upgrade-grid { grid-template-columns:1fr; max-height:55vh; overflow-y:auto; }
  .upgrade-card { min-height:135px; padding:16px 16px 16px 80px; }
  .upgrade-rune { position:absolute; left:16px; top:18px; }
  .upgrade-card small { margin-top:0; }
  .legacy-summary { grid-template-columns:1fr 1fr; }
  .legacy-summary button { grid-column:1 / -1; min-height:38px; border-top:1px solid var(--line); }
  .forge-panel { padding:24px 17px; }
  .forge-heading { align-items:flex-start; }
  .forge-grid { grid-template-columns:1fr 1fr; }
  .training-grid { grid-template-columns:1fr 1fr;max-height:58vh;overflow:auto; }
  .online-panel { padding:25px 18px; }
  .member-list { grid-template-columns:1fr; max-height:28vh; overflow:auto; }
  .run-stats.four { grid-template-columns:repeat(2,1fr); }
  .mobile-controls { position:absolute; z-index:7; display:flex; left:14px; right:14px; bottom:14px; justify-content:space-between; pointer-events:none; }
  .dpad { display:grid; width:138px; height:82px; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(2,1fr); }
  .dpad button, .mobile-actions button { pointer-events:auto; border:1px solid rgba(255,255,255,.13); background:rgba(8,11,18,.65); backdrop-filter:blur(8px); color:#aab6c5; touch-action:none; }
  .dpad button:nth-child(1) { grid-column:2; }
  .dpad button:nth-child(2) { grid-column:1; grid-row:2; }
  .dpad button:nth-child(3) { grid-column:2; grid-row:2; }
  .dpad button:nth-child(4) { grid-column:3; grid-row:2; }
  .mobile-actions { display:flex; align-items:end; gap:8px; }
  .mobile-actions button { width:50px; height:50px; border-radius:50%; color:var(--cyan); font-size:19px; }
  .mobile-actions button[data-action="spear"], .mobile-actions button[data-action="nova"] { width:40px; height:40px; font-size:13px; }
  .mobile-actions .attack { width:66px; height:66px; border-color:rgba(103,232,209,.4); }
  .screen.active ~ .mobile-controls { opacity:0; pointer-events:none; }
}

@media (max-height: 650px) {
  .start-copy { transform:scale(.86); transform-origin:left center; }
  .modal, .upgrade-panel { transform:scale(.88); }
}

@media (max-width: 520px) {
  .forge-grid { grid-template-columns:1fr; }
  .forge-heading { flex-direction:column; }
  .shard-wallet { width:100%; text-align:left; }
  .online-setup { grid-template-columns:1fr; }
  .online-setup label:first-child,.online-action,.join-row { grid-column:auto; }
  .join-row { grid-template-columns:1fr 112px; }
}
