:root {
  /* Doodles core palette (FG 45 / BG 14, exact printed values) */
  --petal: #FFB3E6; --sorbet: #FFC897; --lemon: #FFE780; --grass: #B3FFC7; --skies: #A1E9FF; --grape: #C5C5FF;
  --peach: #FFEAD2; --rosy: #FFD0B8; --caramel: #E8A68B; --grey3: #F2E7EA; --grey2: #D1B6B6; --grey1: #AD9999;
  /* Gradient-example endpoints (BG 16) */
  --g-green: #79E8B3; --g-blue: #99E2FF; --g-purple: #8B8BFF; --g-pink: #FF97E4;
  /* Project choices (not source tokens): text ink, surfaces, elevation */
  --ink: #1C1A1F; --ink2: #5E5560; --paper: #FFFFFF;
  --pink: var(--petal); --pink2: #FFE3F5; --mint: var(--grass); --mint2: #E3FFEC; --lav: var(--grape); --lav2: var(--grey3);
  --cyan: var(--skies); --yellow: var(--lemon);
  --shadow: 0 10px 30px rgba(60, 40, 70, .14), 0 2px 6px rgba(60, 40, 70, .08);
  /* Corner radii (BG 23 ranges): small 8-10, cards/modals 12-16, playful 20+, buttons fully rounded */
  --r-sm: 10px; --r-card: 16px; --r-play: 24px; --r-pill: 999px;
  --font-head: "Funnel Sans", "Helvetica Neue", Arial, sans-serif;
  --font-ui: "Kumbh Sans", "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--skies); font-family: var(--font-ui); font-weight: 400; color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: none; }
button:disabled { opacity: .45; cursor: default; }

.btn { background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 10px 18px; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s; min-height: 44px; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--pink); }
.btn.mint { background: var(--mint); }
.btn.lav { background: var(--lav); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; }
.btn.small { padding: 6px 12px; font-size: 14px; min-height: 36px; border-radius: 12px; }
.btn.danger { background: #ffb3b3; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 50;
  background: radial-gradient(circle at 30% 20%, #ffe3f4 0, transparent 50%), radial-gradient(circle at 80% 70%, #d6f4ff 0, transparent 55%), #f6ecff; }
#title { background: linear-gradient(180deg, rgba(246, 236, 255, .2), rgba(246, 236, 255, .85)); }
.logo { font-size: 44px; font-weight: 900; letter-spacing: -1px; color: var(--ink); text-shadow: 0 4px 0 var(--pink2); }
.logo span { color: #ff7fb5; margin-left: 8px; }
.logo.big { font-size: clamp(48px, 10vw, 86px); text-shadow: 0 6px 0 #fff, 0 10px 0 var(--lav); }
.subtitle { font-weight: 700; color: var(--ink2); margin-top: -10px; }
.title-buttons { display: flex; flex-direction: column; gap: 12px; min-width: 240px; }
.saveinfo { font-size: 13px; color: var(--ink2); min-height: 18px; }
.warn { background: #fff0c4; border: 2px solid #e6c56b; padding: 8px 12px; border-radius: 12px; max-width: 360px; text-align: center; font-size: 14px; }
.bar { width: min(320px, 70vw); height: 16px; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--pink)); transition: width .2s; }
#load-text { font-weight: 700; color: var(--ink2); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud-area { position: absolute; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 8px 18px; font-weight: 900; box-shadow: var(--shadow); opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
#hud-area.show { opacity: 1; }
.chip { background: rgba(255, 250, 255, .92); border: 2px solid var(--ink); border-radius: 14px; padding: 6px 12px; font-size: 13px; font-weight: 700; box-shadow: 0 3px 0 rgba(60, 40, 90, .2); }
#hud-quest { position: absolute; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); max-width: min(46vw, 320px); cursor: pointer; }
#hud-quest b { color: #e0609a; display: block; font-size: 12px; }
#hud-buttons { position: absolute; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); display: flex; gap: 8px; }
.round { width: 48px; height: 48px; border-radius: 50%; background: var(--paper); border: 3px solid var(--ink); font-weight: 900; font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
#prompt { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 14px; padding: 8px 16px; font-weight: 800; pointer-events: none; }
#prompt kbd { background: #fff; color: var(--ink); border-radius: 6px; padding: 1px 7px; margin-right: 6px; font-family: inherit; }
body.touch #prompt { display: none; }
#touch { position: absolute; inset: 0; pointer-events: none; }
#stick-zone { position: absolute; left: calc(14px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); width: 170px; height: 170px; pointer-events: auto; display: flex; align-items: center; justify-content: center; touch-action: none; }
#stick-base { width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 250, 255, .55); border: 3px solid rgba(59, 47, 82, .55); display: flex; align-items: center; justify-content: center; }
#stick-knob { width: 54px; height: 54px; border-radius: 50%; background: var(--pink); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.act { position: absolute; right: calc(22px + var(--safe-r)); bottom: calc(34px + var(--safe-b)); width: 86px; height: 86px; border-radius: 50%; background: var(--mint); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-weight: 900; font-size: 15px; pointer-events: auto; padding: 4px; line-height: 1.05; }
.act.idle { opacity: .5; }

/* Dialog */
#dialog { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); width: min(720px, calc(100vw - 24px)); background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 16px 20px 18px; box-shadow: var(--shadow); z-index: 40; min-height: 108px; cursor: pointer; }
#dialog .speaker { position: absolute; top: -18px; left: 18px; background: var(--pink); border: 3px solid var(--ink); border-radius: 12px; padding: 2px 12px; font-weight: 900; font-size: 15px; }
#dialog .speaker:empty { display: none; }
#dialog .text { font-size: 18px; font-weight: 700; line-height: 1.4; min-height: 50px; }
#dialog .more { position: absolute; right: 16px; bottom: 8px; animation: bob 0.8s infinite; color: #e0609a; }
#dialog .choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* Modal panels */
#modal, #overlay { position: fixed; inset: 0; background: rgba(59, 47, 82, .35); display: flex; align-items: center; justify-content: center; z-index: 30; padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); }
#overlay { z-index: 45; }
.panel { background: var(--paper); border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow); width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
#overlay .panel { width: min(560px, 100%); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 3px solid var(--lav2); flex-wrap: wrap; }
.panel-head h2 { margin: 0 8px; font-size: 22px; flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tab { background: var(--lav2); border: 2px solid transparent; border-radius: 12px; padding: 7px 11px; font-weight: 800; font-size: 14px; }
.tab.on { background: var(--pink); border-color: var(--ink); }
.panel-body { padding: 14px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.close { width: 40px; height: 40px; border-radius: 50%; background: var(--pink2); border: 3px solid var(--ink); font-weight: 900; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.muted { color: var(--ink2); font-size: 14px; }
.note { background: var(--lav2); border-radius: 12px; padding: 8px 12px; font-size: 14px; }

/* Creature slots */
.slot { display: flex; gap: 10px; align-items: center; background: #fff; border: 3px solid var(--lav2); border-radius: 16px; padding: 8px; cursor: pointer; text-align: left; width: 100%; }
.slot.sel { border-color: var(--ink); background: var(--pink2); }
.slot.fainted { opacity: .6; }
.slot img, .thumb { width: 56px; height: 56px; object-fit: contain; flex: none; }
.slot .info { flex: 1; min-width: 0; }
.slot .nm { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp { height: 10px; background: #eee; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.hp i { display: block; height: 100%; background: #6fdc9a; transition: width .5s; }
.hp i.mid { background: #ffd36b; } .hp i.low { background: #ff7f9f; }
.xp { height: 6px; background: #eee; border-radius: 6px; overflow: hidden; margin-top: 3px; }
.xp i { display: block; height: 100%; background: var(--cyan); }
.aff { display: inline-block; border-radius: 9px; padding: 1px 8px; font-size: 12px; font-weight: 900; border: 2px solid var(--ink); }
.status { display: inline-block; border-radius: 6px; padding: 0 5px; font-size: 11px; font-weight: 900; color: #fff; background: var(--ink2); margin-left: 4px; }
.party-wrap { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.3fr); gap: 14px; }
@media (max-width: 640px) { .party-wrap { grid-template-columns: 1fr; } }
.inspect { background: #fff; border: 3px solid var(--lav2); border-radius: 18px; padding: 12px; }
.inspect .big { width: 140px; height: 140px; object-fit: contain; display: block; margin: 0 auto; }
.stats { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; font-size: 14px; align-items: center; }
.stats .sb { height: 8px; border-radius: 6px; background: var(--lav); }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.move { background: var(--lav2); border-radius: 12px; padding: 6px 8px; font-size: 13px; font-weight: 800; border: 2px solid transparent; text-align: left; }
.evo-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.evo-line .st { text-align: center; font-size: 11px; font-weight: 800; }
.evo-line img { width: 64px; height: 64px; object-fit: contain; }
.sil { filter: brightness(0) opacity(.25); }
.dex-cell { background: #fff; border: 3px solid var(--lav2); border-radius: 16px; padding: 6px; text-align: center; cursor: pointer; }
.dex-cell img { width: 72px; height: 72px; object-fit: contain; }
.dex-cell .n { font-size: 12px; font-weight: 900; }
.dex-cell.caught { border-color: var(--mint); }
.item-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--lav2); border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; }
.item-row .grow { flex: 1; }
.qty { font-weight: 900; min-width: 34px; text-align: right; }
.quest { background: #fff; border: 3px solid var(--lav2); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.quest.done { opacity: .6; } .quest.done h4::before { content: '✓ '; color: #3bb873; }
.quest h4 { margin: 0 0 4px; }
.map-wrap { position: relative; width: 100%; max-width: 560px; margin: 0 auto; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; }
.map-wrap img { width: 100%; display: block; }
.map-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--ink); background: var(--pink); transform: translate(-50%, -50%); }
.map-dot.q { background: var(--yellow); width: 14px; height: 14px; }
.map-label { position: absolute; transform: translate(-50%, -50%); font-size: 11px; font-weight: 900; background: rgba(255, 255, 255, .85); border-radius: 8px; padding: 1px 6px; white-space: nowrap; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 2px dashed var(--lav2); flex-wrap: wrap; }
.setting input[type=range] { width: 180px; accent-color: #ff7fb5; }
select { font: inherit; border: 3px solid var(--ink); border-radius: 10px; padding: 4px 8px; background: #fff; }
input[type=text] { font: inherit; font-size: 18px; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; width: 100%; user-select: text; -webkit-user-select: text; }
kbd { background: var(--lav2); border-radius: 6px; padding: 1px 6px; font-family: inherit; font-weight: 800; }

/* Starter cards */
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .starters { grid-template-columns: 1fr; } }
.starter { background: #fff; border: 3px solid var(--lav2); border-radius: 18px; padding: 10px; text-align: center; cursor: pointer; }
.starter.sel { border-color: var(--ink); background: var(--pink2); }
.starter img { width: 110px; height: 110px; object-fit: contain; }

/* Battle */
#battle { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#battle > * { pointer-events: auto; }
.card { position: absolute; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 8px 12px; width: min(300px, 46vw); box-shadow: var(--shadow); }
#card-enemy { top: calc(14px + var(--safe-t)); left: calc(14px + var(--safe-l)); }
#card-player { right: calc(14px + var(--safe-r)); bottom: calc(176px + var(--safe-b)); }
.card .nm { font-weight: 900; display: flex; justify-content: space-between; gap: 6px; }
.card .hpnum { font-size: 12px; font-weight: 800; text-align: right; color: var(--ink2); }
.card .team { display: flex; gap: 3px; margin-top: 4px; }
.card .team i { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); }
.card .team i.out { background: #ccc; }
#battle-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); display: flex; gap: 10px; align-items: stretch; }
#battle-msg { flex: 1.2; background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; padding: 14px 16px; font-size: 18px; font-weight: 800; min-height: 150px; box-shadow: var(--shadow); cursor: pointer; }
#battle-actions { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
#battle-actions.locked { opacity: .5; pointer-events: none; }
#battle-actions .btn { min-height: 50px; font-size: 16px; padding: 6px 8px; }
#battle-actions .mv { text-align: left; font-size: 14px; line-height: 1.15; }
#battle-actions .mv small { display: block; font-size: 11px; opacity: .8; font-weight: 700; }
#battle-actions .wide { grid-column: span 2; }
@media (max-width: 700px) {
  #battle-bottom { flex-direction: column; }
  #battle-msg { min-height: 74px; font-size: 16px; padding: 10px 12px; }
  #card-player { bottom: auto; top: calc(14px + var(--safe-t)); }
  #battle-actions .btn { min-height: 46px; font-size: 15px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #battle-msg { min-height: 90px; font-size: 15px; }
  #card-player { bottom: auto; top: calc(14px + var(--safe-t)); }
  .card { padding: 6px 10px; width: min(260px, 40vw); }
  #battle-actions .btn { min-height: 40px; font-size: 14px; }
}
.chance { height: 10px; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: #fff; margin-top: 3px; }
.chance i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--mint)); }

#toasts { position: fixed; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 60; pointer-events: none; width: min(92vw, 520px); }
.toast { background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 12px; font-weight: 800; font-size: 14px; animation: tin .25s; text-align: center; }
.toast.err { background: #d94a76; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
#fade { position: fixed; inset: 0; background: #fff; z-index: 55; pointer-events: none; opacity: 0; transition: opacity .35s; }
#fade.on { opacity: 1; }
.tut { position: fixed; left: 50%; top: calc(110px + var(--safe-t)); transform: translateX(-50%); z-index: 35; background: var(--yellow); border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; font-weight: 800; box-shadow: var(--shadow); max-width: min(92vw, 480px); font-size: 15px; pointer-events: auto; cursor: pointer; }
.tut small { display: block; font-size: 12px; opacity: .7; margin-top: 4px; }
.fps { position: fixed; bottom: 4px; left: 50%; transform: translateX(-50%); font: 11px monospace; color: var(--ink2); z-index: 70; pointer-events: none; }

.ficon { width: 40px; height: 40px; object-fit: contain; flex: none; }
.tastes .ficon { width: 26px; height: 26px; vertical-align: middle; }
.tastes { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.react { font-size: 12px; font-weight: 800; background: var(--lav2); border-radius: 8px; padding: 1px 6px; }
.sheet { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: #fff; margin: 6px 0 2px; transition: max-height .2s; }
.sheet.big { max-height: 70vh; }

/* ---- Doopie Dex (styled after the Species Guide v1.0) ---- */
.dexbtn { background: #ff8fc2; color: #fff; font-size: 22px; }
.dexdev { background: #fff; border-radius: 18px; }
.dexdev-top { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, #ff9fd2, #ffb6de); border-radius: 16px; padding: 8px 12px; border: 3px solid var(--ink); }
.led { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: #ff6b8e; display: inline-block; }
.led.big { width: 30px; height: 30px; background: radial-gradient(circle at 35% 35%, #fff, #8bdaf5 40%, #4bb6e0); }
.led.r { background: #ff6b8e; } .led.y { background: #ffe17a; } .led.g { background: #7ee8a8; }
.dexlogo { height: 46px; margin-left: auto; filter: drop-shadow(0 2px 0 #fff); }
.dexno { margin-left: auto; font-size: 18px; letter-spacing: 1px; }
.dexstats { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 10px 2px; font-weight: 800; font-size: 14px; }
.dexbar { flex: 1; min-width: 120px; height: 10px; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: #fff; }
.dexbar i { display: block; height: 100%; background: linear-gradient(90deg, #7ee8a8, #8bdaf5, #a68bf2, #ff9fd2); }
.dexfilters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.dexsearch { width: 150px !important; font-size: 14px !important; padding: 5px 10px !important; }
.dexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px 18px; }
.dname { font-weight: 900; font-size: 13px; margin-bottom: 3px; cursor: pointer; letter-spacing: .3px; }
.dtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.dtile { position: relative; aspect-ratio: 1; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dtile img { width: 82%; height: 82%; object-fit: contain; }
.dtile .n { position: absolute; left: 4px; top: 1px; color: #fff; font-weight: 900; font-size: 13px; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.dtile .cb { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; background: #fff; border: 1.5px solid var(--ink); border-radius: 3px; font-size: 11px; line-height: 12px; text-align: center; font-weight: 900; color: #2a9d5c; }
.dtile.unknown { background: #a9a9b0; cursor: default; }
.dtile.unknown .q { font-size: 34px; font-weight: 900; color: #565662; }
.dexpanel { width: min(900px, 100%) !important; }
.dexentry { padding: 10px; overflow: auto; }
.dexentry-body { display: grid; grid-template-columns: minmax(240px, 1fr) 1.3fr; gap: 14px; margin-top: 10px; }
@media (max-width: 640px) { .dexentry-body { grid-template-columns: 1fr; } }
.dexview { position: relative; border-radius: 18px; border: 3px solid var(--ink); padding: 8px; min-height: 200px; }
.dexcanvas { width: 100%; display: block; touch-action: none; cursor: grab; }
.dexunk { position: absolute; inset: 0 0 90px 0; display: flex; align-items: center; justify-content: center; font-size: 80px; font-weight: 900; color: rgba(255,255,255,.75); pointer-events: none; }
.dexstages, .dexctl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.dexgrid2 { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 10px; font-size: 14px; margin: 8px 0; }
.dexentrytext { background: var(--lav2); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.dexinfo h4 { margin: 12px 0 4px; }
.dexnav { display: flex; justify-content: space-between; margin-top: 10px; }

.dexviews { background: #fff; border-radius: 12px; border: 2px solid var(--ink); margin-top: 8px; padding: 4px; }
.dexviews img { width: 100%; display: block; border-radius: 8px; }
.dexviews-h { font-family: "Chewy", cursive; font-size: 13px; text-align: center; }
.dexportrait { width: 64px; height: 64px; object-fit: contain; }
.dexsheetfull { cursor: zoom-in; max-height: 260px; }


/* =====================================================================
   Doodles Agent Kit v0.4 theme
   Source: Brand Guidelines 2025 BG 6-9 (logo), 14-16 (colour), 18-20 (type), 23-24 (corners, overlap).
   Values marked "project choice" are implementation decisions, not official Doodles tokens.
   ===================================================================== */
h1, h2, h3, h4, .panel-head h2, .gametitle { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; }
button, input, select, textarea, kbd { font-family: var(--font-ui); }
body { -webkit-font-smoothing: antialiased; }

/* Buttons: fully rounded (BG 23); labels in Funnel Sans Medium, sentence case */
.btn { font-family: var(--font-head); font-weight: 600; font-size: 17px; border: 0; border-radius: var(--r-pill); padding: 11px 22px; background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 0 rgba(28,26,31,.10), 0 6px 16px rgba(60,40,70,.12); transition: transform .08s, box-shadow .08s, background .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 rgba(28,26,31,.10); }
.btn:focus-visible, .round:focus-visible, .tab:focus-visible, .act:focus-visible, .slot:focus-visible { outline: 3px solid var(--g-purple); outline-offset: 2px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.mint { background: var(--grass); } .btn.lav { background: var(--grape); } .btn.danger { background: var(--petal); }
.btn.ghost { background: rgba(255,255,255,.7); box-shadow: none; text-decoration: none; }
.btn.small { border-radius: var(--r-pill); padding: 6px 14px; font-size: 14px; min-height: 36px; }
button:disabled { opacity: .4; }

/* Round HUD buttons and touch controls */
.round { border: 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); font-size: 18px; font-family: var(--font-ui); font-weight: 700; }
.dexbtn { background: var(--petal); color: var(--ink); }
#stick-base { background: rgba(255,255,255,.45); border: 0; box-shadow: inset 0 0 0 2px rgba(28,26,31,.12); }
#stick-knob { background: var(--paper); border: 0; box-shadow: var(--shadow); }
.act { background: var(--ink); color: #fff; border: 0; box-shadow: var(--shadow); font-family: var(--font-head); font-weight: 600; }

/* HUD */
#hud-area { border: 0; border-radius: var(--r-pill); font-family: var(--font-head); font-weight: 700; padding: 8px 20px; }
.chip { border: 0; border-radius: var(--r-card); background: rgba(255,255,255,.94); box-shadow: var(--shadow); font-weight: 400; font-size: 13px; padding: 8px 14px; line-height: 1.35; }
#hud-quest b { color: var(--ink2); font-family: var(--font-ui); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
#prompt { background: var(--ink); border-radius: var(--r-pill); font-weight: 500; padding: 9px 18px; }
#prompt kbd { border-radius: 6px; }

/* Dialog */
#dialog { border: 0; border-radius: var(--r-play); box-shadow: var(--shadow); padding: 20px 22px 20px; }
#dialog .speaker { border: 0; border-radius: var(--r-pill); background: var(--grape); font-family: var(--font-head); font-weight: 700; font-size: 15px; padding: 4px 14px; top: -14px; }
#dialog .text { font-weight: 400; font-size: 18px; line-height: 1.45; }
#dialog .more { color: var(--ink2); }

/* Panels, tabs, lists */
#modal, #overlay { background: rgba(28, 26, 31, .32); }
.panel { border: 0; border-radius: var(--r-play); box-shadow: 0 24px 60px rgba(40,25,50,.25); }
.panel-head { border-bottom: 1px solid var(--grey3); padding: 12px 14px; }
.panel-head h2 { font-size: 22px; }
.tab { background: var(--grey3); border: 0; border-radius: var(--r-pill); font-family: var(--font-ui); font-weight: 600; padding: 8px 14px; }
.tab.on { background: var(--ink); color: #fff; border: 0; }
.close { border: 0; background: var(--grey3); font-family: var(--font-ui); }
.slot, .inspect, .dex-cell, .item-row, .quest, .starter { border: 0; background: #fff; box-shadow: 0 0 0 1.5px var(--grey3) inset; border-radius: var(--r-card); }
.slot.sel, .starter.sel { background: var(--pink2); box-shadow: 0 0 0 2px var(--ink) inset; }
.slot .nm, .card .nm, .dname { font-family: var(--font-head); font-weight: 700; }
.dex-cell.caught { box-shadow: 0 0 0 2px var(--g-green) inset; }
.note, .dexentrytext { background: var(--peach); border-radius: var(--r-sm); font-weight: 400; }
.move { background: var(--grey3); border: 0; border-radius: var(--r-sm); font-weight: 600; }
.aff { border: 0; border-radius: var(--r-pill); font-family: var(--font-ui); font-weight: 600; padding: 2px 9px; }
.status { border-radius: 6px; font-family: var(--font-ui); }
.setting { border-bottom: 1px solid var(--grey3); }
.setting input[type=range] { accent-color: var(--g-purple); }
select, input[type=text] { border: 0; box-shadow: 0 0 0 1.5px var(--grey2) inset; border-radius: var(--r-sm); background: #fff; }
.map-wrap { border: 0; border-radius: var(--r-card); box-shadow: var(--shadow); }
.map-dot { border: 2px solid #fff; background: var(--ink); } .map-dot.q { background: var(--lemon); border-color: var(--ink); }
kbd { background: var(--grey3); font-weight: 600; }

/* Meters: HP keeps its number beside the bar, so colour is not the only signal */
.hp, .chance, .dexbar { border: 0; background: var(--grey3); height: 10px; border-radius: var(--r-pill); }
.hp i { background: var(--g-green); } .hp i.mid { background: var(--lemon); } .hp i.low { background: var(--g-pink); }
.xp { background: var(--grey3); border-radius: var(--r-pill); } .xp i { background: var(--g-blue); }
.chance i { background: linear-gradient(90deg, var(--petal), var(--lemon)); }
.dexbar i { background: linear-gradient(90deg, var(--g-green), var(--g-blue)); }
.stats .sb { background: var(--grape); }

/* Battle */
.card { border: 0; border-radius: var(--r-card); box-shadow: var(--shadow); padding: 10px 14px; }
.card .hpnum { font-family: var(--font-ui); font-weight: 500; }
.card .team i { border: 0; background: var(--g-green); } .card .team i.out { background: var(--grey2); }
#battle-msg { border: 0; border-radius: var(--r-play); box-shadow: var(--shadow); font-weight: 400; font-size: 18px; line-height: 1.45; }
#battle-actions .btn { font-size: 16px; }
#battle-actions .mv { font-family: var(--font-ui); font-weight: 600; }
#battle-actions .mv small { font-weight: 400; }

/* Toasts, tutorial tips */
.toast { border-radius: var(--r-pill); font-weight: 500; padding: 9px 16px; }
.toast.err { background: #B0386E; }
.tut { border: 0; background: var(--lemon); border-radius: var(--r-card); box-shadow: var(--shadow); font-weight: 500; }

/* Doopie Dex */
.dexdev-top { border: 0; border-radius: var(--r-card); background: linear-gradient(90deg, var(--petal), var(--lemon)); }
.led { border: 0; } .dexno { font-family: var(--font-ui); font-weight: 600; }
.dexview { border: 0; border-radius: var(--r-card); }
.dexviews { border: 0; box-shadow: 0 0 0 1.5px var(--grey3) inset; }
.dexviews-h { font-family: var(--font-ui); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); padding: 4px 0; }
.dtile { border-radius: var(--r-sm); }
.dtile .n { font-family: var(--font-ui); font-weight: 700; }
.dtile .cb { border: 0; border-radius: 4px; }

/* Loading and title: the illustration leads; logo, title and actions sit in its quiet areas */
.brandbg { background-size: cover; background-position: center; }
#title.brandbg.hills { background: url(assets/brand/title-hills.jpg) 50% 10% / cover no-repeat; }
#loading.brandbg.clouds { background: url(assets/brand/clouds.jpg) 50% 70% / cover no-repeat; }
#title.screen, #loading.screen { justify-content: space-between; gap: 0; padding: calc(28px + var(--safe-t)) 20px calc(28px + var(--safe-b)); }
.title-top { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.title-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.brandlogo { width: clamp(150px, 22vw, 260px); height: auto; display: block; }   /* aspect preserved (BG 9) */
.gametitle { margin: 2px 0 0; font-size: clamp(40px, 7vw, 76px); line-height: 1; color: var(--ink); }
.gametitle.light { color: #fff; }
#title .subtitle { margin: 6px 0 0; font-family: var(--font-ui); font-size: clamp(15px, 1.6vw, 18px); color: var(--ink); }
.title-buttons { display: flex; flex-direction: column; gap: 10px; width: min(320px, 82vw); min-width: 0; }
.title-buttons .btn { width: 100%; min-height: 50px; font-size: 18px; }
#title .btn.ghost { background: var(--grape); }
/* No save yet: hide the disabled Continue and promote New game to the primary action */
#t-continue:disabled { display: none; }
#t-continue:disabled + #t-new { background: var(--ink); color: #fff; }
#title .saveinfo { background: rgba(255,255,255,.88); border-radius: var(--r-pill); padding: 4px 12px; color: var(--ink); font-size: 13px; }
#title .saveinfo:empty { display: none; }
.warn { border: 0; background: var(--lemon); border-radius: var(--r-card); }
#loading .bar { width: min(340px, 74vw); height: 10px; border: 0; border-radius: var(--r-pill); background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1px rgba(28,26,31,.08); }
#loading .bar i { background: var(--ink); }
#load-text { background: rgba(255,255,255,.88); border-radius: var(--r-pill); padding: 4px 14px; color: var(--ink); font-weight: 500; font-size: 14px; }
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  /* Wide: keep the explorer centred and free; title in the sky, actions bottom-left on the purple foreground */
  #title.screen { align-items: stretch; }
  #title .title-top { align-items: center; }
  #title .title-bottom { align-items: flex-start; padding-left: clamp(16px, 4vw, 64px); }
}
/* Loading: the character fills the frame, so the title block sits on its own soft card to stay readable (BG 3/15) */
#loading .title-top { background: rgba(255,255,255,.88); border-radius: var(--r-play); padding: 16px 28px 18px; box-shadow: var(--shadow); }
/* Narrow screens: menu tabs scroll in one row instead of stacking */
@media (max-width: 640px) {
  .panel-head { flex-wrap: nowrap; }
  .panel-head .tabs { min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; padding-bottom: 2px; }
  .panel-head .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
}
