:root {
  --gold: #f3c96a;
  --gold-2: #b8862b;
  --blood: #b91c1c;
  --ink: #080b10;
  --panel: rgba(7, 12, 20, 0.84);
  --panel-strong: rgba(7, 12, 20, 0.96);
  --line: rgba(243, 201, 106, 0.25);
  --text: #f7ead3;
  --muted: #b7a98e;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #02040a; color: var(--text); font-family: Georgia, 'Times New Roman', serif; }
button, input { font: inherit; }
#gameCanvas { display: block; width: 100vw; height: 100vh; outline: none; cursor: crosshair; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 28px; }
.homeScreen { background: radial-gradient(circle at 50% 25%, rgba(214,159,53,0.18), transparent 34%), linear-gradient(135deg, #03070d 0%, #111827 55%, #050609 100%); }
.homeBackdrop { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.66), rgba(0,0,0,.12), rgba(0,0,0,.7)), repeating-linear-gradient(90deg, rgba(243,201,106,.045) 0 1px, transparent 1px 140px); pointer-events: none; }
.glassPanel, .sidePanel { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.08); backdrop-filter: blur(16px); }
.homePanel { position: relative; width: min(860px, 94vw); padding: 44px; border-radius: 30px; text-align: center; }
.realmEyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .22em; font: 700 12px/1.2 system-ui, sans-serif; }
h1 { margin: 10px 0 12px; font-size: clamp(46px, 7vw, 96px); letter-spacing: .07em; line-height: .9; color: #fff6d8; text-shadow: 0 0 28px rgba(243,201,106,.28); }
h2 { margin: 6px 0 8px; font-size: clamp(26px, 3vw, 44px); color: #fff6d8; }
h3 { margin: 12px 0 8px; color: var(--gold); }
.heroText { max-width: 710px; margin: 0 auto 28px; line-height: 1.6; color: #e9d7b7; font-size: 18px; }
.homeButtons { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; margin: 0 auto; }
.compactButtons { grid-template-columns: 1fr; max-width: 420px; }
button { border: 1px solid rgba(243,201,106,.34); border-radius: 16px; padding: 14px 18px; color: var(--text); background: rgba(255,255,255,.06); cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
button:hover, button:focus { transform: translateY(-1px); border-color: rgba(243,201,106,.86); background: rgba(243,201,106,.12); outline: none; }
.primaryBtn { background: linear-gradient(135deg, #9a6218, #e3bb5b 48%, #70400e); color: #140b04; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.secondaryBtn { background: rgba(10,20,34,.76); }
.dangerBtn { background: rgba(124, 18, 18, .8); border-color: rgba(248,113,113,.45); }
.ghostBtn { padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.04); }
.homeFooter, .muted { color: var(--muted); line-height: 1.5; }
.homeFooter { margin-top: 22px; font: 13px/1.5 system-ui, sans-serif; }
.saveStatus { margin: 16px auto 0; width: fit-content; padding: 7px 11px; border-radius: 999px; color: #c8bda8; background: rgba(0,0,0,.28); font: 12px/1.3 system-ui, sans-serif; }
.saveStatus.ready { color: #bbf7d0; border: 1px solid rgba(74,222,128,.25); }
.modalPanel { width: min(760px, 94vw); max-height: 88vh; overflow: auto; padding: 28px; border-radius: 24px; }
.widePanel { width: min(1100px, 96vw); }
.modalHeader, .panelHeader { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.knightGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.knightCard { text-align: left; padding: 14px; border: 1px solid rgba(243,201,106,.18); border-radius: 18px; background: rgba(255,255,255,.055); }
.knightCard.active { border-color: rgba(243,201,106,.92); box-shadow: inset 0 0 0 1px rgba(243,201,106,.35), 0 0 24px rgba(243,201,106,.12); }
.knightSwatch { height: 88px; border-radius: 14px; margin-bottom: 10px; background: linear-gradient(140deg, var(--swatch), #111827); border: 1px solid rgba(255,255,255,.12); position: relative; overflow: hidden; }
.knightSwatch::after { content: 'GLB'; position: absolute; right: 9px; bottom: 8px; color: rgba(255,255,255,.5); font: 700 12px/1 system-ui, sans-serif; }
.knightCard h3 { margin: 0 0 4px; }
.knightCard p { margin: 0 0 10px; color: var(--muted); font-size: 13px; min-height: 38px; }
.settingsGrid { display: grid; gap: 14px; margin: 18px 0; }
.settingsGrid label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); }
.controlsList { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; color: #e9d7b7; }
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; font-family: system-ui, sans-serif; }
.topHud { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.brandMini, .pill { border: 1px solid rgba(243,201,106,.22); background: rgba(5, 8, 14, .72); backdrop-filter: blur(12px); border-radius: 999px; padding: 8px 12px; color: #f9edd1; }
.brandMini { color: var(--gold); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pill span { color: var(--gold); font-weight: 800; }
.bars { position: absolute; left: 16px; bottom: 20px; width: min(360px, calc(100vw - 32px)); display: grid; gap: 8px; }
.barRow { display: grid; grid-template-columns: 56px 1fr 42px; align-items: center; gap: 8px; text-shadow: 0 2px 4px #000; }
.barRow span { color: var(--muted); font-weight: 800; }
.bar { height: 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.55); }
.barFill { height: 100%; width: 100%; transition: width .18s ease; }
.hpFill { background: linear-gradient(90deg, #7f1d1d, #ef4444); }
.staminaFill { background: linear-gradient(90deg, #854d0e, #facc15); }
.hungerFill { background: linear-gradient(90deg, #166534, #86efac); }
.thirstFill { background: linear-gradient(90deg, #075985, #38bdf8); }
.objectiveBox { position: absolute; right: 16px; top: 86px; max-width: 380px; padding: 14px 16px; border: 1px solid rgba(243,201,106,.24); border-radius: 18px; background: rgba(5, 8, 14, .76); box-shadow: 0 18px 45px rgba(0,0,0,.4); }
.objectiveBox h3 { margin: 0 0 6px; font-size: 16px; }
.objectiveBox p { margin: 0; color: #e9d7b7; line-height: 1.4; }
.interactionPrompt { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); padding: 12px 16px; border-radius: 999px; background: rgba(0,0,0,.68); border: 1px solid rgba(243,201,106,.38); color: var(--gold); font-weight: 800; }
.crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,.7); font: 28px/1 system-ui, sans-serif; text-shadow: 0 2px 8px #000; }
.sidePanel { position: fixed; z-index: 30; right: 18px; top: 18px; bottom: 18px; width: min(980px, calc(100vw - 36px)); padding: 20px; border-radius: 24px; overflow: auto; }
.questPanel { width: min(560px, calc(100vw - 36px)); }
.stickyHeader { position: sticky; top: -20px; background: linear-gradient(var(--panel-strong), rgba(7,12,20,.9)); padding: 8px 0 16px; z-index: 1; }
.moneyLine { margin: 6px 0 16px; color: var(--muted); }
.inventoryColumns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.listBox { display: grid; gap: 8px; }
.itemRow, .questRow { border: 1px solid rgba(243,201,106,.16); border-radius: 14px; padding: 12px; background: rgba(255,255,255,.045); }
.itemRow .rowTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.itemRow small, .questRow small { color: var(--muted); }
.itemActions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.itemActions button { padding: 7px 9px; border-radius: 10px; font-size: 12px; }
.questList { display: grid; gap: 12px; }
.questRow.active { border-color: rgba(243,201,106,.55); }
.questRow.complete { border-color: rgba(74,222,128,.5); }
.toast { position: fixed; z-index: 100; left: 50%; top: 28px; transform: translateX(-50%); padding: 14px 18px; border-radius: 999px; background: rgba(5, 8, 14, .88); border: 1px solid rgba(243,201,106,.38); color: #fff6d8; box-shadow: 0 20px 60px rgba(0,0,0,.48); font-family: system-ui, sans-serif; }
.deathPanel { text-align: center; }
.dangerText { color: #fca5a5; }
.damageFlash { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0; background: radial-gradient(circle, transparent 35%, rgba(160,0,0,.72)); transition: opacity .24s ease-out; }
.damageFlash.active { opacity: 1; transition-duration: .03s; }
.tutorialPanel { width: min(650px, 94vw); text-align: center; border-color: rgba(243,201,106,.5); }
.tutorialPanel .heroText { min-height: 92px; margin-top: 20px; }
.tutorialActions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.tutorialDots { display: flex; justify-content: center; gap: 8px; }
.tutorialDots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.22); }
.tutorialDots i.active { background: var(--gold); box-shadow: 0 0 12px rgba(243,201,106,.65); }
.barRow.warning .bar { box-shadow: 0 0 12px rgba(239,68,68,.65); animation: dangerPulse 1s infinite alternate; }
@keyframes dangerPulse { to { filter: brightness(1.5); } }
@media (max-width: 860px) {
  .homeButtons, .inventoryColumns { grid-template-columns: 1fr; }
  .homePanel { padding: 28px; }
  .objectiveBox { left: 16px; right: 16px; top: 118px; max-width: none; }
  .topHud { font-size: 12px; }
}
