:root {
  --bg: #0d141c;
  --panel: rgba(20, 24, 32, 0.96);
  --panel2: #1b222d;
  --line: rgba(214, 170, 90, 0.35);
  --gold: #e0b354;
  --gold2: #ffd987;
  --text: #ece4d4;
  --muted: #a49c8c;
  --good: #7ee38a;
  --bad: #ff7b6b;
  --radius: 12px;
  --head: 'Cinzel', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, 'Segoe UI', system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; justify-content: center; }
.warn { color: var(--bad); }
.good { color: var(--good); }
.bad { color: var(--bad); }
h1, h2, h3 { font-family: var(--head); letter-spacing: 0.5px; margin: 0 0 8px; }
h3 { font-size: 16px; color: var(--gold2); }

#island { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
body:not(.playing) #hud, body:not(.playing) #dock, body:not(.playing) #questTracker { display: none; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: linear-gradient(to bottom, rgba(8, 12, 18, 0.92), rgba(8, 12, 18, 0.55) 70%, transparent);
  z-index: 10; pointer-events: none;
}
#hud > * { pointer-events: auto; }
#hudKeeper { display: flex; align-items: center; gap: 8px; cursor: pointer; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: 30px; padding: 3px 14px 3px 3px; }
#keeperPic { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #6a4a30, #2a1a10); border: 2px solid var(--gold); }
.kinfo { min-width: 120px; }
.kinfo b { font-family: var(--head); }
#keeperLvl { color: var(--gold2); font-weight: 700; font-size: 12px; }
.kxp { height: 5px; background: rgba(255, 255, 255, 0.12); border-radius: 3px; margin-top: 4px; overflow: hidden; }
#keeperXp { height: 100%; background: linear-gradient(90deg, #b88a30, #ffd987); width: 0; transition: width 0.3s; }
#res { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: center; }
.chip { display: flex; align-items: center; gap: 5px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 4px 11px 4px 7px; min-width: 92px; }
.chip b { font-size: 16px; }
.chip span { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip small { color: var(--good); font-size: 10px; margin-left: auto; padding-left: 4px; }
.hud-btns { display: flex; gap: 6px; }
.hbtn { background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); border-radius: 20px; padding: 7px 12px; font-size: 15px; }
.hbtn span { font-size: 13px; font-weight: 600; }
.hbtn:hover { background: rgba(224, 179, 84, 0.2); }

#questTracker { position: fixed; top: 72px; left: 12px; z-index: 9; max-width: 270px; background: rgba(8, 12, 18, 0.7); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; pointer-events: none; }
#questTracker:empty { display: none; }
.qt-title { font-family: var(--head); color: var(--gold2); font-size: 13px; margin-bottom: 4px; }
.qt-item { font-size: 12.5px; margin: 3px 0; }
.qt-item small { display: block; color: var(--muted); font-size: 11px; margin-left: 12px; }

/* ---------- Dock ---------- */
#dock { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 10; background: rgba(8, 12, 18, 0.8); border: 1px solid var(--line); border-radius: 20px; padding: 6px 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.dock-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 72px; padding: 6px 4px; background: transparent; border: 1px solid transparent; border-radius: 14px; transition: 0.15s; }
.dock-btn:hover { background: rgba(224, 179, 84, 0.15); border-color: var(--line); transform: translateY(-2px); }
.dock-btn .ic { font-size: 24px; line-height: 1.1; }
.dock-btn .lb { font-size: 11px; font-weight: 600; color: var(--muted); }
.badge { position: absolute; top: 2px; right: 8px; background: #e4442f; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 8px rgba(255, 80, 50, 0.8); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }

#modeBar { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 11; background: rgba(20, 30, 20, 0.92); border: 1px solid #7ee38a; border-radius: 14px; padding: 8px 10px 8px 16px; display: flex; gap: 12px; align-items: center; }

/* ---------- Buttons ---------- */
.btn { background: linear-gradient(#323b4a, #252c38); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 10px; padding: 8px 14px; font-weight: 600; transition: 0.12s; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:hover:not(:disabled) { border-color: var(--gold); filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(#e7b95a, #b0802a); color: #1d1406; border-color: #ffd987; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(255, 123, 107, 0.4); }
.btn.big { padding: 11px 22px; font-size: 15px; }
.btn.full { width: 100%; }
.btn small { font-weight: 400; font-size: 11.5px; opacity: 0.9; }
.link { background: none; border: none; color: var(--gold2); text-decoration: underline; font-size: 12px; padding: 0 4px; }
.cost { white-space: nowrap; font-weight: 600; }
.cost.short { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.end { justify-content: flex-end; }
.row.spread { justify-content: space-between; margin-top: 0; }

/* ---------- Panel ---------- */
#panelWrap { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; padding: 70px 16px 96px; backdrop-filter: blur(2px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 70px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05); width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; animation: pop 0.18s ease-out; }
.panel.wide { width: min(1120px, 100%); height: 100%; }
.panel.mid { width: min(760px, 100%); }
.panel.narrow { width: min(420px, 100%); }
.panel.battle { width: min(1200px, 100%); height: 100%; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(rgba(224, 179, 84, 0.12), transparent); }
.panel-head h2 { margin: 0; font-size: 20px; color: var(--gold2); }
#panelClose { background: none; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; width: 32px; height: 32px; font-size: 15px; }
#panelBody { padding: 14px 18px 18px; overflow: auto; flex: 1; }
.panel.battle #panelBody { padding: 0; overflow: hidden; }

/* ---------- Confirm / toasts ---------- */
#confirm { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; }
.confirm-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; width: min(420px, 92vw); }
.confirm-box input.full { width: 100%; padding: 8px 10px; background: #0f141b; color: var(--text); border: 1px solid var(--line); border-radius: 8px; }
#toasts { position: fixed; top: 70px; right: 14px; z-index: 50; display: flex; flex-direction: column; gap: 6px; width: min(360px, 90vw); pointer-events: none; }
.toast { background: rgba(18, 22, 30, 0.96); border: 1px solid rgba(255, 255, 255, 0.15); border-left: 4px solid #6aa8ff; border-radius: 10px; padding: 9px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); animation: slide 0.25s ease-out; transition: opacity 0.5s, transform 0.5s; }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.quest { border-left-color: var(--gold); background: rgba(40, 32, 14, 0.96); }
.toast.out { opacity: 0; transform: translateX(30px); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- Bars & tags ---------- */
.bar { position: relative; height: 16px; background: rgba(255, 255, 255, 0.08); border-radius: 8px; overflow: hidden; flex: 1; min-width: 60px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: #6aa8ff; border-radius: 8px; transition: width 0.4s; }
.bar span { position: relative; display: block; height: 100%; font-size: 11px; font-weight: 600; padding-left: 7px; line-height: 16px; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.hunger .fill { background: linear-gradient(90deg, #c2562c, #f0a045); }
.bar.happy .fill { background: linear-gradient(90deg, #c23c8a, #ff8ac8); }
.bar.energy .fill { background: linear-gradient(90deg, #2c8ac2, #6ad8ff); }
.bar.xp .fill { background: linear-gradient(90deg, #8a6a20, #ffd987); }
.bar.growth .fill { background: linear-gradient(90deg, #3a9a3a, #a0f070); }
.bar.st .fill { background: linear-gradient(90deg, #6a5acd, #b08aff); }
.bar.hp .fill { background: linear-gradient(90deg, #2a9a3a, #8af07a); }
.bar.stam .fill { background: linear-gradient(90deg, #2c6ac2, #6ad8ff); }
.bar.fury .fill { background: linear-gradient(90deg, #c22c2c, #ffb040); }
.rarity { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; color: var(--rc); border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 14%, transparent); }
.rarity.sm { font-size: 10px; padding: 0 6px; }
.tag, .el { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); margin: 2px 2px 2px 0; }
.tag.glow { background: rgba(200, 140, 255, 0.2); color: #e2c8ff; }
.el-fire { background: rgba(255, 100, 40, 0.2); } .el-ice { background: rgba(150, 220, 255, 0.2); } .el-storm { background: rgba(170, 130, 255, 0.22); }
.el-earth { background: rgba(200, 150, 80, 0.22); } .el-water { background: rgba(60, 220, 210, 0.2); } .el-shadow { background: rgba(160, 60, 220, 0.25); }
.el-light { background: rgba(255, 230, 120, 0.22); } .el-nature { background: rgba(130, 230, 80, 0.2); }
.sex { font-weight: 800; }
.sex.m { color: #6ab8ff; } .sex.f { color: #ff8ac8; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.07); }
.kv > span:first-child { color: var(--muted); white-space: nowrap; }
.xpbar { flex: 1; display: flex; max-width: 70%; }
.fsec { font-family: var(--head); color: var(--gold2); font-size: 13px; margin: 12px 0 6px; }
.fsec small { font-family: Inter, sans-serif; color: var(--muted); font-size: 11px; }

/* ---------- Dragon cards ---------- */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.dgrid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.dcard { background: linear-gradient(#222a36, #1a2029); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 8px; cursor: pointer; transition: 0.15s; }
.dcard:hover { border-color: var(--gold); transform: translateY(-2px); }
.dcard.selected { border-color: var(--gold2); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(224, 179, 84, 0.4); }
.dcard.disabled { opacity: 0.5; }
.dcard canvas, .opp canvas { width: 100%; height: 130px; display: block; background: radial-gradient(ellipse at 50% 85%, rgba(255, 255, 255, 0.08), transparent 70%); border-radius: 8px; }
.dc-name { font-weight: 700; margin-top: 4px; }
.dc-sub { color: var(--muted); font-size: 12px; }
.dc-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.dc-busy { font-size: 11.5px; color: #8ad0ff; margin-top: 4px; }
.mini-bars { display: flex; gap: 4px; margin-top: 6px; }
.mini-bars .bar { height: 12px; }
.mini-bars .bar span { line-height: 12px; font-size: 10px; }

/* ---------- Dragon detail ---------- */
.ddetail { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; height: 100%; }
.dview { position: relative; border-radius: 12px; overflow: hidden; min-height: 360px; border: 1px solid rgba(255, 255, 255, 0.1); }
.dcanvas { width: 100%; height: 100%; display: block; min-height: 360px; }
.dview-btns { position: absolute; bottom: 10px; left: 10px; display: flex; gap: 6px; }
.dhead { display: flex; justify-content: space-between; align-items: flex-start; }
.species { font-family: var(--head); font-size: 19px; color: var(--gold2); }
.species.big { font-size: 24px; }
.power { font-family: var(--head); font-size: 20px; color: #ffd987; background: rgba(0, 0, 0, 0.35); border-radius: 10px; padding: 4px 10px; }
.needs, .stats { display: grid; gap: 5px; margin: 10px 0; }
.need, .stat { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; }
.need > span:first-child, .stat > span:first-child { font-size: 12.5px; color: var(--muted); }
.need > span:last-child { display: flex; }
.busy { color: #8ad0ff; min-height: 18px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.genes { margin-top: 10px; background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 6px 10px; }
.genes summary { cursor: pointer; color: var(--gold2); font-weight: 600; }

/* ---------- Build menu ---------- */
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.bcard { position: relative; background: linear-gradient(#222a36, #1a2029); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 10px; cursor: pointer; transition: 0.15s; }
.bcard:hover { border-color: var(--gold); transform: translateY(-2px); }
.bcard.locked { opacity: 0.55; }
.bcard.expand { background: linear-gradient(#3a3018, #1f1a10); border-color: var(--line); }
.bicon { width: 100%; height: 110px; display: block; }
.bicon.big { font-size: 64px; text-align: center; line-height: 110px; }
.bname { font-weight: 700; font-family: var(--head); font-size: 14px; color: var(--gold2); }
.bdesc { font-size: 12px; color: var(--muted); min-height: 32px; }
.bcost { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.bcount { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--muted); }
.block { font-size: 12px; color: var(--bad); margin-top: 4px; font-weight: 600; }
.binfo .bpic { width: 100%; height: 170px; display: block; }
.binfo .lvl { text-align: center; font-family: var(--head); color: var(--gold2); font-size: 16px; }
.upbox { margin-top: 12px; background: rgba(0, 0, 0, 0.25); padding: 8px 10px; border-radius: 10px; }
.upbox .btn { margin-top: 8px; }

/* ---------- Hatchery ---------- */
.egg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 10px 0; }
.eggcard { background: linear-gradient(#2a2420, #1b1714); border: 1px solid rgba(255, 180, 90, 0.25); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.eggcard.empty { border-style: dashed; justify-content: center; min-height: 240px; opacity: 0.7; }
.emptyslot { font-family: var(--head); color: var(--muted); font-size: 16px; }
.eggcv { width: 100%; height: 150px; display: block; }
.eggcv.big { width: 160px; height: 170px; }
.ename { font-weight: 700; }
.eprog { width: 100%; display: flex; }
.etime { font-variant-numeric: tabular-nums; color: var(--gold2); font-weight: 700; }
.reveal { display: flex; flex-direction: column; gap: 8px; }
.revcv { width: 100%; height: 330px; display: block; border-radius: 12px; background: radial-gradient(ellipse at 50% 80%, #3a2a20, #120e0c); }
label.txt { display: flex; flex-direction: column; gap: 4px; }
label.txt span { font-size: 12px; color: var(--muted); }
label.txt input { padding: 9px 11px; background: #0f141b; color: var(--text); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
label.txt.center input { text-align: center; max-width: 300px; margin: 0 auto; }

/* ---------- Breeding ---------- */
.breed-grid { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 14px; }
.bcol { display: flex; flex-direction: column; gap: 8px; }
.bcol .dcard canvas { height: 100px; }
.bmid { background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 12px; align-self: start; position: sticky; top: 0; }
.pairmini { display: flex; align-items: center; justify-content: center; }
.pairmini canvas { width: 150px; height: 100px; }
.heart { font-size: 30px; animation: pulse 1.2s infinite; }
.breed-progress .pair { display: flex; align-items: center; justify-content: center; gap: 16px; }
.breed-progress .dcard { width: 240px; cursor: default; }
.breed-progress .bar { margin: 10px auto; max-width: 520px; }
.empty-state { text-align: center; padding: 30px 20px; }
.big-ic { font-size: 64px; }

/* ---------- Training ---------- */
.train-grid { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.tlist { display: flex; flex-direction: column; gap: 6px; }
.trow-d { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.08); cursor: pointer; background: #1d242f; }
.trow-d.on { border-color: var(--gold); background: #2a2a24; }
.trow-d canvas { width: 80px; height: 52px; }
.trow-d small { display: block; color: var(--muted); }
.tdragon { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: center; }
.tdragon canvas { width: 220px; height: 140px; }
.trainings { display: grid; gap: 6px; margin: 10px 0; }
.trow { display: grid; grid-template-columns: 2fr 1fr 44px 80px; gap: 10px; align-items: center; background: rgba(0, 0, 0, 0.22); border-radius: 10px; padding: 8px 10px; }
.tname small { display: block; color: var(--muted); font-size: 11.5px; }
.tname .thelp { color: #c9c2b0; line-height: 1.35; margin-top: 3px; }
.tstatname { font-size: 11px; color: var(--muted); }
.pick { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: #1a1408; background: var(--gold); border-radius: 8px; padding: 0 6px; vertical-align: 1px; }
.tip { font-size: 12.5px; color: #d8cfb8; background: rgba(224, 179, 84, 0.1); border: 1px solid rgba(224, 179, 84, 0.25); border-radius: 8px; padding: 6px 10px; }
.tgain { color: var(--good); font-weight: 700; text-align: center; }
.empower { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(150, 90, 255, 0.18), rgba(0, 0, 0, 0.2)); border: 1px solid rgba(180, 130, 255, 0.35); border-radius: 12px; padding: 10px 12px; }

/* ---------- Explore ---------- */
.exp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
label.sel { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.sel.inline { flex-direction: row; align-items: center; gap: 8px; }
select { background: #0f141b; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.exp-active { display: grid; gap: 6px; margin-bottom: 12px; }
.exp-row { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.exp-row small { color: var(--muted); }
.exp-bar { flex: 1; display: flex; }
.exp-time { font-variant-numeric: tabular-nums; color: var(--gold2); min-width: 50px; text-align: right; }
.exp-row .btn { margin-left: auto; }
.regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.region { position: relative; border-radius: 14px; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.12); overflow: hidden; display: flex; flex-direction: column; gap: 4px; min-height: 200px; }
.region.locked { filter: grayscale(0.7) brightness(0.7); }
.rg-ic { position: absolute; right: 10px; top: 6px; font-size: 42px; opacity: 0.85; }
.rg-name { font-family: var(--head); font-size: 16px; color: #fff; text-shadow: 0 2px 4px #000; }
.rg-desc { font-size: 12px; color: #ddd; flex: 1; }
.rg-meta { display: flex; gap: 10px; font-size: 12px; }
.rg-loot { font-size: 12px; color: #ccc; }
.region .btn { margin-top: 6px; }
.rg-nature { background: linear-gradient(160deg, #2e5a2a, #142414); } .rg-earth { background: linear-gradient(160deg, #6a4224, #241a10); }
.rg-fire { background: linear-gradient(160deg, #8a2a14, #2a0e08); } .rg-water { background: linear-gradient(160deg, #14506a, #0a1c28); }
.rg-ice { background: linear-gradient(160deg, #5a8aa8, #1a2a3a); } .rg-storm { background: linear-gradient(160deg, #3a2a7a, #120e2a); }
.rg-shadow { background: linear-gradient(160deg, #3a1a4a, #0e0812); } .rg-light { background: linear-gradient(160deg, #a8883a, #3a2a10); }
.story { font-style: italic; font-size: 15px; color: #e8dcc0; border-left: 3px solid var(--gold); padding-left: 12px; }
.loot { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; justify-content: center; }
.lootchip { background: rgba(224, 179, 84, 0.15); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-weight: 700; font-size: 15px; }
.found-egg { display: flex; align-items: center; gap: 12px; background: rgba(255, 150, 60, 0.1); border-radius: 12px; padding: 8px; }
.wild { margin-top: 12px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 12px; border: 1px solid rgba(255, 100, 80, 0.3); }
.wildcv { width: 100%; height: 240px; display: block; }

/* ---------- Arena / battle ---------- */
.tiers { display: grid; gap: 12px; margin-top: 14px; }
.tier { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.tier.locked { opacity: 0.55; }
.tier-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tier-head b { font-family: var(--head); color: var(--gold2); font-size: 15px; }
.tier-head span { font-size: 12px; color: var(--muted); }
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.opp { background: #1d242f; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.opp canvas { height: 110px; }
.opp .btn { margin-top: 6px; }
.battle { position: relative; width: 100%; height: 100%; }
.bcv { width: 100%; height: 100%; display: block; }
.bhud { position: absolute; top: 12px; width: min(360px, 40%); background: rgba(0, 0, 0, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.bhud.left { left: 12px; } .bhud.right { right: 12px; }
.bn { font-family: var(--head); font-weight: 800; }
.bn small { font-family: Inter, sans-serif; color: var(--muted); font-weight: 400; }
.bhud .hp { display: flex; margin: 4px 0; }
.bhud .hp .bar { height: 18px; }
.bhud .hp .bar span { line-height: 18px; }
.sub2 { display: flex; gap: 6px; }
.sub2 > span { flex: 1; display: flex; }
.sub2 .bar { height: 16px; }
.sub2 .bar span { line-height: 16px; font-size: 11px; }
.blog { position: absolute; left: 50%; transform: translateX(-50%); top: 92px; white-space: pre-line; line-height: 1.45; font-size: 14px; background: rgba(0, 0, 0, 0.6); border-radius: 10px; padding: 6px 14px; max-width: 70%; text-align: center; font-weight: 600; }
.blog:empty { display: none; }
.bmoves { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 96%; }
.mvbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1 1 0; min-width: 84px; max-width: 150px; text-align: center; line-height: 1.2; padding: 7px 8px; background: linear-gradient(#3a3226, #221c14); border: 1px solid var(--gold); border-radius: 12px; font-weight: 700; }
.mvbtn span { font-size: 20px; }
.mvbtn.ghost { flex: 0 0 auto; min-width: 70px; font-size: 12px; }
.mvbtn small { font-weight: 400; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.mvbtn small.good { color: var(--good); } .mvbtn small.bad { color: var(--bad); }
.mvbtn.fury { background: linear-gradient(#7a2a14, #3a1008); border-color: #ff9a40; }
.mvbtn.ghost { background: rgba(0, 0, 0, 0.5); border-color: rgba(255, 255, 255, 0.2); }
.mvbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.mvbtn:hover:not(:disabled) { filter: brightness(1.25); }
.bresult { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.65); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.bresult h2 { font-size: 44px; color: var(--gold2); }

/* ---------- Forge ---------- */
.forge { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.forge-view { display: flex; flex-direction: column; gap: 8px; }
.forge-canvas { width: 100%; height: 400px; display: block; border-radius: 12px; background: radial-gradient(ellipse at 50% 90%, #3a3a46, #12151c 75%); border: 1px solid rgba(255, 255, 255, 0.1); }
.forge-species { text-align: center; font-family: var(--head); font-size: 18px; color: var(--gold2); }
.forge-controls { max-height: 560px; overflow: auto; padding-right: 6px; }
.frow { display: flex; gap: 10px; align-items: flex-end; }
.frow label.txt { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: none; padding: 8px 12px; border-right: 1px solid rgba(255, 255, 255, 0.08); }
.seg button:last-child { border-right: none; }
.seg button.on { background: linear-gradient(#e7b95a, #b0802a); color: #1d1406; font-weight: 700; }
.seg.wrap { flex-wrap: wrap; }
.seg.big button { padding: 10px 22px; font-size: 15px; }
.elrow { display: flex; gap: 5px; flex-wrap: wrap; }
.elbtn { width: 42px; height: 42px; font-size: 20px; border-radius: 10px; background: #1d242f; border: 1px solid rgba(255, 255, 255, 0.12); }
.elbtn.on { border-color: var(--gold2); box-shadow: 0 0 0 2px var(--gold); background: #3a3220; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
label.rng { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
input[type=range] { width: 100%; accent-color: var(--gold); }
label.rng.hue input { -webkit-appearance: none; appearance: none; height: 10px; border-radius: 5px; background: linear-gradient(90deg, red, #ff0, lime, cyan, blue, #f0f, red); }
label.rng.shade input { -webkit-appearance: none; appearance: none; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #111, #888, #eee); }
label.rng input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #333; }
label.chk { display: flex; gap: 6px; align-items: center; font-size: 13px; }

/* ---------- Intro ---------- */
#intro { position: fixed; inset: 0; z-index: 30; overflow: auto; background: radial-gradient(ellipse at 50% 0%, #3a2414, #0d0a08 70%); padding: 24px 16px; }
.intro-box { max-width: 980px; margin: 0 auto; background: rgba(18, 16, 14, 0.85); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7); }
.intro-box.wide { max-width: 1180px; }
.intro-hero { text-align: center; margin-bottom: 10px; }
.intro-hero h1 { font-size: 52px; font-weight: 800; background: linear-gradient(#ffe7a8, #c9852c); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0; text-shadow: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.8)); }
.intro-hero p { color: var(--muted); font-style: italic; margin: 2px 0 10px; }
.intro-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; }
.keeper-preview { border-radius: 16px; background: radial-gradient(circle at 50% 40%, #4a3424, #1a120c); border: 1px solid var(--line); min-height: 420px; }
.keeper-preview canvas { width: 100%; height: 100%; min-height: 420px; display: block; }
.keeper-form { display: flex; flex-direction: column; gap: 6px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); }
.swatch.on { border-color: var(--gold2); box-shadow: 0 0 0 3px var(--gold); }

/* ---------- Quests / help / keeper ---------- */
.qlist { display: grid; gap: 6px; }
.q { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); }
.q.done { opacity: 0.6; }
.q.active { border: 1px solid var(--line); }
.q.future { opacity: 0.4; }
.q small { color: var(--muted); }
.help .hrow { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.08); }
.help .hrow p { margin: 0; color: #d8d0c0; }
.keeper-card { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.kcv { width: 200px; height: 220px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #4a3424, #1a120c); }
.keeper-card .bar { margin: 6px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .ddetail, .forge, .intro-grid, .breed-grid, .train-grid, .tdragon, .keeper-card { grid-template-columns: 1fr; }
  .dock-btn { width: 52px; } .dock-btn .lb { display: none; }
  .chip { min-width: 0; } .chip small { display: none; }
  .hbtn span { display: none; }
  #questTracker { display: none; }
  .trow { grid-template-columns: 1fr 1fr 40px 70px; }
}

/* gold coin icon (replaces the silver-looking 🪙 emoji) */
.coin { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; background: var(--coin) center / contain no-repeat; font-style: normal; }

/* battle strategy: status effects, enemy intent */
.bstatus { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.bstatus:empty { display: none; }
.schip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); white-space: nowrap; }
.schip.bad { background: rgba(255, 90, 60, 0.18); border-color: rgba(255, 110, 80, 0.45); }
.schip.good { background: rgba(110, 220, 120, 0.16); border-color: rgba(120, 230, 130, 0.45); }
.schip b { font-weight: 800; opacity: 0.8; }
.bintent { margin-top: 6px; padding: 5px 9px; border-radius: 8px; font-weight: 700; font-size: 13px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); }
.bintent:empty { display: none; }
.bintent small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.bintent.breath, .bintent.fury { background: rgba(255, 90, 40, 0.2); border-color: rgba(255, 120, 60, 0.6); }
.bintent.fury { animation: furyPulse 0.9s ease-in-out infinite; }
.bintent.guard { background: rgba(90, 170, 255, 0.18); border-color: rgba(120, 190, 255, 0.55); }
@keyframes furyPulse { 50% { box-shadow: 0 0 14px rgba(255, 110, 40, 0.8); } }

/* dragon detail: browse dragons */
.dnav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.dnav:hover { background: rgba(224, 179, 84, 0.35); border-color: var(--gold); }
.dnav.prev { left: 10px; } .dnav.next { right: 10px; }
.dcount { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.5); border-radius: 10px; padding: 2px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lootchip.good { background: rgba(110, 220, 120, 0.16); border-color: rgba(120, 230, 130, 0.5); }

/* element matchups */
.mu { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--muted); margin: 4px 0 2px; }
.mu b { color: var(--text, #eee); }
.mu b.good, .mchart td.good, .bintent em.good { color: var(--good); }
.mu b.bad, .mchart td.bad, .bintent em.bad { color: var(--bad); }
.bintent em { font-style: normal; font-size: 11px; font-weight: 700; margin-left: 4px; }
.mchart { border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.mchart th, .mchart td { width: 34px; height: 24px; text-align: center; border: 1px solid rgba(255, 255, 255, 0.08); }
.mchart th { font-size: 15px; background: rgba(0, 0, 0, 0.25); }
.mchart td { font-weight: 700; color: var(--muted); }
.mchart td.good { background: rgba(110, 220, 120, 0.12); }
.mchart td.bad { background: rgba(255, 90, 60, 0.12); }

.tquick { margin-top: 8px; gap: 6px; }
.trow-d small .bad { color: var(--bad); }
