/* Scraps and the lost Princess: Chapter 1. All character art by Isabelle Herbst. */
@font-face {
  font-family: 'Patrick Hand';
  src: url('fonts/patrick-hand.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ink: #37281a;
  --paper: #f6eedd;
  --paper2: #efe2c8;
  --wood: #7a5230;
  --wood-dark: #5b3c22;
  --red: #b32832;
  --gold: #e0a63c;
  --sky: #35a3d9;
  --green: #3f8f3f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: #241a10;
  font-family: 'Patrick Hand', 'Comic Sans MS', cursive;
  color: var(--ink);
  overflow: hidden;
}

#wrap { position: fixed; inset: 0; display: grid; place-items: center; }
#stage {
  position: relative; width: 1280px; height: 800px;
  transform-origin: center center;
  background: #6d4326;
  box-shadow: 0 12px 60px rgba(0,0,0,.55);
  border-radius: 6px; overflow: hidden;
}
#game { position: absolute; inset: 0; width: 1280px; height: 800px; display: block; }

.hidden { display: none !important; }

/* ------------------------------------------------ HUD (her blue mockup row) */
#hud {
  position: absolute; top: 0; left: 0; right: 0; height: 78px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(38,138,196,.92), rgba(53,163,217,.85));
  border-bottom: 3px solid #1c5d85;
  pointer-events: none;
}
#hearts { display: flex; gap: 4px; }
#hearts img { width: 46px; height: 46px; object-fit: contain; }
#hearts img.empty { filter: grayscale(1) brightness(.72); opacity: .5; }
#hud-right { display: flex; gap: 10px; pointer-events: auto; }
.hud-btn {
  width: 62px; height: 62px; border-radius: 12px; border: 3px solid #14486b;
  background: rgba(246,238,221,.9); cursor: pointer; position: relative;
  display: grid; place-items: center; padding: 4px;
}
.hud-btn:hover { background: #fff; }
.hud-btn img { max-width: 48px; max-height: 44px; object-fit: contain; }
#hud-gadget-lv {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  background: var(--red); color: #fff; font-size: 14px; line-height: 1;
  padding: 2px 7px; border-radius: 9px; border: 2px solid #7e1119; white-space: nowrap;
}

#area-name {
  position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
  background: rgba(55,40,26,.82); color: var(--paper); padding: 6px 22px;
  border-radius: 20px; font-size: 26px; letter-spacing: .5px;
  transition: opacity .6s; pointer-events: none;
}

/* ------------------------------------------------------------------ toasts */
#toasts {
  position: absolute; top: 96px; right: 16px; display: flex;
  flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none;
  z-index: 30;
}
.toast {
  background: var(--paper); border: 3px solid var(--wood); color: var(--ink);
  border-radius: 12px; padding: 8px 16px; font-size: 20px; max-width: 460px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); animation: toast-in .3s ease-out;
}
.toast.gold { border-color: var(--gold); background: #fdf3d7; }
@keyframes toast-in { from { transform: translateX(40px); opacity: 0; } }

/* ------------------------------------------------ dialogue (speech bubbles) */
#dialog {
  position: absolute; left: 90px; right: 90px; bottom: 26px;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 18px;
  display: flex; gap: 16px; padding: 14px 20px; align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); cursor: pointer; z-index: 40;
}
#dialog::before {
  content: ''; position: absolute; top: -16px; left: 60px;
  border: 10px solid transparent; border-bottom-color: var(--ink);
}
#dlg-img { width: 96px; height: 110px; object-fit: contain; flex: none; }
#dlg-name { font-size: 22px; color: var(--red); }
#dlg-text { font-size: 26px; line-height: 1.25; }
.dlg-hint { font-size: 15px; opacity: .55; margin-top: 4px; }

/* ------------------------------------------- investigation popup (her pills) */
#invest {
  position: absolute; z-index: 45; background: rgba(246,238,221,.97);
  border: 3px solid var(--ink); border-radius: 14px; padding: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,.4); min-width: 210px;
}
#invest-title { font-size: 21px; padding: 2px 8px 6px; color: var(--wood-dark); }
#invest-opts { display: flex; flex-direction: column; gap: 6px; }
.invest-opt {
  font-family: inherit; font-size: 21px; color: var(--ink); text-align: left;
  background: #fff; border: 2px solid var(--wood); border-radius: 999px;
  padding: 5px 16px; cursor: pointer;
}
.invest-opt:hover { background: #ffe9b8; }

/* ---------------------------------------------------------------- touch UI */
#touch { position: absolute; inset: 0; pointer-events: none; z-index: 35; }
.t-left { position: absolute; left: 16px; bottom: 18px; display: flex; gap: 12px; }
.t-right { position: absolute; right: 16px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.t-row { display: flex; gap: 10px; }
.t-btn {
  pointer-events: auto; width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid rgba(55,40,26,.8); background: rgba(246,238,221,.72);
  font-family: inherit; font-size: 26px; color: var(--ink);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.t-btn:active { background: rgba(255,233,184,.95); }
.t-small { width: 66px; height: 66px; font-size: 18px; }

/* ------------------------------------------------------------- full screens */
.screen {
  position: absolute; inset: 0; z-index: 50; display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(224,166,60,.14), transparent 60%),
    radial-gradient(ellipse at 75% 85%, rgba(179,40,50,.12), transparent 55%),
    var(--paper);
  overflow: auto; padding: 24px;
}
.panel {
  background: #fffdf6; border: 4px solid var(--wood); border-radius: 20px;
  max-width: 760px; padding: 26px 34px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.panel h2 { font-size: 42px; color: var(--red); margin-bottom: 10px; }
.panel h3 { font-size: 26px; color: var(--wood-dark); margin: 14px 0 4px; }
.panel p { font-size: 23px; line-height: 1.3; margin: 8px 0; }
.panel .small { font-size: 18px; opacity: .75; }
.mid-img { height: 170px; object-fit: contain; margin: 6px auto; display: block; }

.btn {
  font-family: inherit; font-size: 24px; color: var(--paper);
  background: linear-gradient(180deg, #8a5f38, var(--wood-dark));
  border: 3px solid #3d2814; border-radius: 14px; padding: 8px 26px;
  cursor: pointer; margin: 8px 6px 0; box-shadow: 0 4px 0 #33200f;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #33200f; }
.btn.big { font-size: 30px; padding: 10px 38px; background: linear-gradient(180deg, #c8393f, #8e1f28); border-color: #5e1218; box-shadow: 0 5px 0 #4a0d12; }

/* title screen */
.title-inner { text-align: center; max-width: 1050px; }
#title-art { max-width: 850px; width: 90%; margin-top: 6px; }
.title-sub { font-size: 30px; color: var(--wood-dark); margin: 4px 0 14px; }
.title-row { display: flex; gap: 26px; align-items: center; justify-content: center; }
.title-dog { height: 230px; object-fit: contain; }
.howto {
  background: #fffdf6; border: 3px solid var(--wood); border-radius: 16px;
  padding: 12px 22px; max-width: 520px; text-align: left;
}
.howto h3 { color: var(--red); font-size: 26px; }
.howto p { font-size: 19px; line-height: 1.3; margin-top: 6px; }
.title-credit { margin-top: 14px; font-size: 18px; opacity: .7; }

/* intro */
.intro-panel { max-width: 640px; }
#intro-img { max-height: 240px; max-width: 96%; width: auto; height: auto; object-fit: contain; }
#intro-text { font-size: 27px; }

/* ------------------------------------------------------------ pause menu */
.menu-layout {
  display: flex; gap: 22px; width: 1120px; max-width: 96%; height: 700px; max-height: 92%;
}
.menu-tabs {
  width: 300px; flex: none; display: flex; flex-direction: column; gap: 6px;
  overflow: auto; padding: 4px;
}
#menu-art { width: 180px; align-self: center; margin-bottom: 4px; }
.mtab {
  font-family: inherit; font-size: 22px; text-align: left; color: var(--ink);
  background: #fffdf6; border: 3px solid var(--wood); border-radius: 12px;
  padding: 6px 16px; cursor: pointer;
}
.mtab:hover { background: #ffe9b8; }
.mtab.active { background: var(--wood); color: var(--paper); }
#menu-resume { background: var(--red); color: #fff; border-color: #6d1219; text-align: center; }
.menu-panel {
  flex: 1; background: #fffdf6; border: 4px solid var(--wood); border-radius: 18px;
  padding: 20px 26px; overflow: auto; text-align: left;
}
.menu-panel h2 { font-size: 34px; color: var(--red); margin-bottom: 8px; }
.menu-panel p { font-size: 21px; line-height: 1.3; margin: 6px 0; }
.menu-panel .small { font-size: 17px; opacity: .7; }

.chap-card {
  display: flex; gap: 16px; align-items: center; border: 3px solid var(--paper2);
  border-radius: 14px; padding: 10px 14px; margin: 10px 0; background: var(--paper);
}
.chap-card img { width: 84px; height: 100px; object-fit: contain; flex: none; }
.chap-card.current { border-color: var(--gold); background: #fdf3d7; }
.chap-card h3 { font-size: 24px; color: var(--wood-dark); }
.chap-card p { font-size: 18px; margin: 2px 0 0; }
.chap-tag { font-size: 15px; color: #fff; background: var(--green); border-radius: 8px; padding: 1px 8px; }
.chap-tag.later { background: #8a8378; }

.clue-row {
  display: flex; gap: 14px; align-items: center; margin: 10px 0;
  border-bottom: 2px dashed var(--paper2); padding-bottom: 10px;
}
.clue-dot { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 3px solid var(--wood);
  display: grid; place-items: center; font-size: 24px; background: var(--paper); }
.clue-row.found .clue-dot { background: var(--gold); }
.clue-row h3 { font-size: 22px; } .clue-row p { font-size: 18px; margin: 0; }

.task-row { font-size: 22px; margin: 8px 0; }
.task-row.done { opacity: .55; text-decoration: line-through; }
.task-row .tick { color: var(--green); margin-right: 8px; }

.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach {
  border: 3px solid var(--paper2); border-radius: 12px; padding: 8px 12px; background: var(--paper);
}
.ach.won { border-color: var(--gold); background: #fdf3d7; }
.ach h3 { font-size: 20px; } .ach p { font-size: 16px; margin: 0; opacity: .8; }

.bandana-row { display: flex; gap: 14px; margin-top: 10px; }
.bandana-swatch {
  width: 62px; height: 62px; border-radius: 12px; border: 4px solid var(--paper2); cursor: pointer;
}
.bandana-swatch.active { border-color: var(--ink); }

/* backpack */
#backpack-screen .panel { max-width: 860px; text-align: left; }
#backpack-screen h2 { text-align: center; }
#bp-items { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0; min-height: 40px; }
.bp-item {
  font-family: inherit; font-size: 20px; border: 3px solid var(--wood); border-radius: 12px;
  background: var(--paper); padding: 6px 14px; cursor: pointer;
}
.bp-item:hover { background: #ffe9b8; }
#bp-gadgets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.gadget-card {
  display: flex; gap: 12px; align-items: center; border: 3px solid var(--paper2);
  border-radius: 12px; padding: 8px 10px; background: var(--paper); cursor: pointer;
}
.gadget-card img { width: 74px; height: 56px; object-fit: contain; flex: none; }
.gadget-card h3 { font-size: 20px; } .gadget-card p { font-size: 15px; margin: 0; line-height: 1.2; }
.gadget-card.locked { opacity: .45; cursor: default; }
.gadget-card.active-gadget { border-color: var(--gold); background: #fdf3d7; }
.gadget-card .lv { font-size: 14px; color: #fff; background: var(--wood); border-radius: 8px; padding: 1px 7px; }

@media (max-width: 900px) {
  .title-dog { display: none; }
}
