:root {
  --gold: #d8b45a;
  --gold2: #f0d58a;
  --ink: #0b0d0c;
  --panel: rgba(12, 16, 14, 0.92);
  --panel2: rgba(20, 27, 22, 0.95);
  --line: rgba(216, 180, 90, 0.42);
  --muted: #9aa79a;
  --green: #70d879;
  --red: #e05a4f;
  --blue: #5aa9ff;
  --text: #e8e6dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050706; color: var(--text); font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif; }
button { font-family: inherit; }
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; background: #050706; }
#game.cursor-point { cursor: crosshair; }
#game.cursor-unit { cursor: cell; }

#hud { position: absolute; inset: 0; pointer-events: none; user-select: none; }
#hud > * { pointer-events: auto; }

#topbar { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 16px; pointer-events: none; }
#objectiveCard { pointer-events: auto; min-width: 280px; max-width: 440px; padding: 10px 14px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(14,20,16,0.94), rgba(8,11,9,0.9)); border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.kicker { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }
#objective { font-size: 15px; font-weight: 600; color: #f2eddc; }
#subObjective { font-size: 12px; color: var(--muted); margin-top: 3px; }
#resources { display: flex; gap: 8px; align-items: flex-start; pointer-events: auto; }
.res { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; font-weight: 700; font-size: 14px; color: var(--gold2); min-width: 72px; justify-content: center; }
.resIcon { font-size: 15px; color: var(--gold); }
.goldIcon { color: #f2c94c; }
.killIcon { color: #e07a6a; }
.timeIcon { color: #8fc3ff; }
.iconBtn { width: 34px; height: 34px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); color: var(--gold2); font-weight: 800; font-size: 16px; cursor: pointer; }
.iconBtn:hover { background: rgba(216,180,90,0.14); }

#messages { position: absolute; left: 16px; bottom: 198px; width: min(440px, 42vw); display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.msg { font-size: 13px; line-height: 1.28; padding: 7px 10px; border-left: 2px solid var(--gold); background: rgba(7,10,8,0.82); border-radius: 3px; color: #e7e3d5; animation: msgIn 0.2s ease-out; box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
.msg.quest { border-left-color: #74d88a; color: #c9f0cf; }
.msg.warn { border-left-color: #e05a4f; color: #ffd0c9; }
.msg.level { border-left-color: #f0d58a; color: #ffe9a8; }
.msg.gold { border-left-color: #f2c94c; color: #ffe58a; }
.msg.buff { border-left-color: #8fc3ff; color: #cfe7ff; }
.msg.weather { border-left-color: #9aa79a; color: #cbd3c9; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#multiboard { position: absolute; right: 16px; top: 64px; width: 238px; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 9px 11px; box-shadow: 0 10px 28px rgba(0,0,0,0.4); }
.mbTitle { color: var(--gold2); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 5px; margin-bottom: 6px; }
.mbRow { display: flex; justify-content: space-between; font-size: 12px; color: #c9d2c8; padding: 3px 0; }
.mbRow b { color: #fff1be; }

#minimapWrap { position: absolute; right: 16px; bottom: 190px; width: 190px; height: 190px; border: 1px solid var(--line); background: #060806; border-radius: 5px; padding: 0; box-shadow: 0 10px 30px rgba(0,0,0,0.45); overflow: hidden; }
#minimap { width: 190px; height: 190px; display: block; cursor: pointer; }

#bottom { overflow: hidden; position: absolute; left: 0; right: 0; bottom: 0; height: 176px; display: grid; grid-template-columns: 236px minmax(420px, 760px) 1fr; gap: 10px; padding: 10px 14px 12px; background: linear-gradient(180deg, rgba(6,8,7,0.65), rgba(6,8,7,0.96) 28%, #070a08), url("assets/textures/wood.png"); background-blend-mode: multiply; background-size: auto, 220px; border-top: 1px solid rgba(216,180,90,0.48); box-shadow: 0 -12px 34px rgba(0,0,0,0.45); }
#portraitBlock { border: 1px solid var(--line); background: rgba(8,11,9,0.7); border-radius: 5px; padding: 7px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
#portrait { width: 84px; height: 84px; border: 1px solid rgba(216,180,90,0.5); border-radius: 3px; align-self: center; background: #111; }
#heroLine { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; margin-top: 0; }
#heroName { color: #eee5c8; font-weight: 700; }
#heroLevel { color: var(--gold2); font-weight: 800; }
.barRow { display: flex; align-items: center; }
.bar { position: relative; height: 13px; width: 100%; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.14); border-radius: 2px; overflow: hidden; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: linear-gradient(180deg, #4aa85a, #2b6b35); transition: width 0.15s linear; }
.manaBar .fill { background: linear-gradient(180deg, #4c9be8, #255a9a); }
.xpBar { height: 4px; }
.xpBar .fill { background: linear-gradient(180deg, #f0d58a, #b98d37); }
.bar span { position: relative; z-index: 1; display: block; text-align: center; font-size: 9px; line-height: 11px; font-weight: 700; color: #eef4ea; text-shadow: 0 1px 2px #000; }
.xpRow { margin-top: 0; }

#commandBlock { display: flex; flex-direction: column; justify-content: flex-start; gap: 10px; padding: 2px 2px 0; min-height: 0; }
#abilityBar { display: flex; gap: 6px; flex-wrap: wrap; min-height: 68px; align-items: flex-start; }
#inventoryBar { display: flex; gap: 6px; height: 60px; }
.slot { position: relative; width: 60px; height: 60px; border: 1px solid rgba(216,180,90,0.45); background: rgba(4,6,5,0.75); border-radius: 3px; padding: 0; cursor: pointer; overflow: hidden; }
.slot img { width: 100%; height: 100%; display: block; object-fit: cover; }
.slot .fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #e8dcb8; background: radial-gradient(circle at 40% 30%, #3a4a38, #121712); }
.slot:hover { border-color: var(--gold2); box-shadow: 0 0 0 1px rgba(216,180,90,0.35), 0 0 18px rgba(216,180,90,0.18); }
.slot .hotkey { position: absolute; left: 3px; top: 1px; font-size: 10px; font-weight: 800; color: #f7e7ae; text-shadow: 0 1px 2px #000; }
.slot .lvl { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 800; color: #f7e7ae; text-shadow: 0 1px 2px #000; }
.slot .charges { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; }
.slot .cdMask { position: absolute; inset: 0; background: rgba(0,0,0,0.62); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; color: #fff; }
.slot.disabled { filter: grayscale(0.7) brightness(0.65); }
.slot.passive { border-color: rgba(120,160,130,0.45); }
.slot .plus { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 22px; height: 22px; line-height: 20px; text-align: center; border-radius: 50%; background: #1c2a1e; border: 1px solid #8be39a; color: #b9ffc4; font-weight: 900; font-size: 15px; box-shadow: 0 0 12px rgba(110,230,130,0.5); }
.slot .plus:hover { background: #2b4a2f; }
.slot .cost { position: absolute; left: 3px; bottom: 1px; font-size: 10px; font-weight: 700; color: #8fc3ff; text-shadow: 0 1px 2px #000; }

#statsBlock { border-left: 1px solid rgba(216,180,90,0.28); padding-left: 12px; display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 150px; }
.stat { display: flex; justify-content: space-between; font-size: 12px; color: #aeb9ac; border-bottom: 1px dotted rgba(255,255,255,0.08); padding-bottom: 2px; }
.stat b { color: #efe6c9; }
#selectionHint { margin-top: 6px; font-size: 11px; color: #7f8c7e; line-height: 1.35; max-width: 240px; }

#tooltip { position: fixed; z-index: 50; max-width: 310px; padding: 9px 11px; border: 1px solid rgba(216,180,90,0.6); background: rgba(8,12,9,0.97); border-radius: 4px; box-shadow: 0 12px 36px rgba(0,0,0,0.6); font-size: 12px; line-height: 1.35; color: #dedbce; pointer-events: none; }
#tooltip .ttTitle { font-size: 14px; font-weight: 800; color: #f1dfaa; margin-bottom: 3px; }
#tooltip .ttSub { color: #8fa08d; font-size: 11px; margin-bottom: 5px; }
#tooltip .ttGold { color: #f2c94c; font-weight: 700; }
#tooltip .ttBlue { color: #8fc3ff; }
#tooltip .ttGreen { color: #8bdf95; }
#tooltip .ttHint { color: #8b9789; font-size: 11px; margin-top: 5px; }

#modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.58); display: flex; align-items: center; justify-content: center; padding: 24px; }
#modalBox { position: relative; width: min(780px, 94vw); max-height: 82vh; overflow: auto; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(17,23,18,0.98), rgba(8,11,9,0.99)); border-radius: 7px; padding: 20px 22px; box-shadow: 0 24px 80px rgba(0,0,0,0.68); }
#modalBox h2 { margin: 0 0 4px; font-size: 22px; color: var(--gold2); letter-spacing: 0.02em; }
#modalBox h3 { color: #e8d79f; margin: 16px 0 6px; font-size: 15px; }
#modalBox p { color: #bcc6b9; line-height: 1.45; }
.closeBtn { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border: 1px solid var(--line); background: rgba(0,0,0,0.3); color: var(--gold2); border-radius: 4px; font-size: 19px; cursor: pointer; }
.closeBtn:hover { background: rgba(216,180,90,0.12); }
.questRow { border: 1px solid rgba(216,180,90,0.22); border-left: 3px solid var(--gold); background: rgba(255,255,255,0.02); padding: 9px 11px; margin: 7px 0; border-radius: 3px; }
.questRow.done { border-left-color: var(--green); opacity: 0.8; }
.questRow .qTitle { font-weight: 800; color: #f0e3b8; }
.questRow .qStatus { float: right; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.questRow .qDesc { color: #aeb9ac; font-size: 12px; margin-top: 3px; line-height: 1.4; }
.shopGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 8px; }
.shopItem { display: flex; gap: 9px; border: 1px solid rgba(216,180,90,0.24); background: rgba(255,255,255,0.025); border-radius: 4px; padding: 7px; align-items: center; }
.shopItem .icon { width: 46px; height: 46px; flex: 0 0 auto; border: 1px solid rgba(216,180,90,0.35); background: #0a0d0b; border-radius: 2px; overflow: hidden; }
.shopItem .icon img { width: 100%; height: 100%; display: block; }
.shopItem .info { flex: 1; min-width: 0; }
.shopItem .nm { font-weight: 700; color: #eee2bd; font-size: 13px; }
.shopItem .meta { color: #8e9c8c; font-size: 11px; margin-top: 2px; }
.shopItem .buy { border: 1px solid rgba(216,180,90,0.5); background: rgba(216,180,90,0.12); color: #f0d58a; border-radius: 3px; padding: 5px 9px; cursor: pointer; font-size: 12px; font-weight: 700; }
.shopItem .buy:hover { background: rgba(216,180,90,0.24); }
.shopItem .buy:disabled { opacity: 0.35; cursor: default; }
.helpGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; font-size: 13px; color: #b9c3b6; }
.helpGrid b { color: #eedc9f; }

#startScreen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: #050706; }
.startBg { position: absolute; inset: 0; background: url("assets/textures/loading.png") center/cover no-repeat; filter: saturate(0.7) brightness(0.42) blur(1px); transform: scale(1.03); }
.startBg:after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(5,8,6,0.25), rgba(5,8,6,0.94) 70%), linear-gradient(180deg, rgba(5,8,6,0.2), rgba(5,8,6,0.9)); }
.startPanel { position: relative; z-index: 1; width: min(680px, 92vw); padding: 34px 38px 30px; border: 1px solid rgba(216,180,90,0.55); background: linear-gradient(180deg, rgba(10,14,11,0.93), rgba(6,9,7,0.97)); border-radius: 8px; box-shadow: 0 30px 100px rgba(0,0,0,0.75); }
.startKicker { color: var(--gold); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; }
.startPanel h1 { font-size: clamp(38px, 6vw, 64px); margin: 8px 0 10px; letter-spacing: 0.02em; color: #f2e5bd; text-shadow: 0 3px 24px rgba(216,180,90,0.22); }
.startDesc { color: #c4cdc0; line-height: 1.5; font-size: 15px; max-width: 560px; }
.startMeta { color: #8b9789; font-size: 12px; margin: 10px 0 18px; }
.startControls { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 18px; color: #aeb8ab; font-size: 12.5px; border-top: 1px solid rgba(216,180,90,0.24); border-bottom: 1px solid rgba(216,180,90,0.24); padding: 12px 0; margin-bottom: 18px; }
.startControls b { color: #eddca4; }
#startBtn, #restartBtn, #endScreen button { border: 1px solid #b9963d; background: linear-gradient(180deg, #3a2f18, #20190c); color: #f4df9d; padding: 11px 24px; border-radius: 4px; font-size: 15px; font-weight: 800; letter-spacing: 0.04em; cursor: pointer; box-shadow: 0 0 0 1px rgba(216,180,90,0.15), 0 10px 30px rgba(0,0,0,0.35); }
#startBtn:hover, #restartBtn:hover, #endScreen button:hover { background: linear-gradient(180deg, #59471f, #33270f); }
.startFine { color: #7f8b7e; font-size: 11px; margin-top: 12px; }

#endScreen { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(3,5,4,0.82); backdrop-filter: blur(3px); }
.endBox { text-align: center; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(16,22,17,0.98), rgba(7,10,8,0.99)); padding: 34px 42px; border-radius: 7px; max-width: 560px; box-shadow: 0 30px 100px rgba(0,0,0,0.8); }
.endBox h1 { font-size: 44px; margin: 0 0 8px; color: #f0ddac; }
.endBox p { color: #c0c9bd; line-height: 1.5; }
#endStats { margin: 16px 0 20px; color: #9eab9c; font-size: 13px; line-height: 1.6; }
.hidden { display: none !important; }

@media (max-width: 1050px) {
  #bottom { grid-template-columns: 210px 1fr; }
  #statsBlock { display: none; }
  #minimapWrap { width: 150px; height: 150px; bottom: 186px; }
  #minimap { width: 150px; height: 150px; }
}
@media (max-width: 760px) {
  #objectiveCard { max-width: 54vw; }
  #bottom { height: 160px; grid-template-columns: 180px 1fr; }
  #portrait { width: 78px; height: 78px; }
  .slot { width: 48px; height: 48px; }
  #messages { bottom: 176px; width: 50vw; }
  #minimapWrap { display: none; }
}
