/* Paintistry, designed by Devesh Harri. Palette drawn from his painted page:
   cave browns, dark umber, teal cloak, mustard END-flag yellow. */
@font-face {
  font-family: "Gochi Hand";
  src: url("fonts/gochi-hand.woff2") format("woff2");
  font-display: swap;
}

:root {
  --earth: #8a6558;
  --earth-deep: #5c4238;
  --cave: #23201a;
  --cave-2: #37332a;
  --teal: #1e7d74;
  --flag: #f2c53d;
  --paper: #f4eee2;
  --ink: #2b2620;
  --red: #c0392b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: var(--cave);
  overflow: hidden;
  font-family: "Gochi Hand", "Comic Sans MS", "Chalkboard SE", cursive;
  color: var(--ink);
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

#stage {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 1280px; height: 800px;
  transform-origin: center center;
}

#game { position: absolute; inset: 0; width: 1280px; height: 800px; display: block; background: var(--cave); }

.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(94, 70, 58, .55), rgba(20, 17, 13, .88)),
              var(--cave);
}

.paper {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px 22px 16px 24px / 22px 16px 24px 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55), inset 0 0 60px rgba(138, 101, 88, .18);
  padding: 26px 44px 30px;
  max-width: 860px; width: 88%;
  max-height: 92%;
  text-align: center;
  overflow: auto;
}
.paper.small { max-width: 560px; }

h1 {
  font-size: 84px; line-height: 1;
  color: var(--teal);
  text-shadow: 3px 3px 0 rgba(43, 38, 32, .25);
  letter-spacing: 2px;
}
h2 { font-size: 44px; color: var(--teal); margin-bottom: 10px; }
.credit { font-size: 26px; margin: 2px 0 6px; color: var(--earth-deep); }
.tagline { font-size: 22px; margin: 8px 0 4px; }

#titlehero { height: 170px; margin: 4px auto; image-rendering: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.winhero { height: 180px; margin: 8px auto; }

#pickers { display: flex; gap: 34px; justify-content: center; margin: 10px 0 4px; flex-wrap: wrap; }
.picker span { font-size: 22px; display: block; margin-bottom: 6px; }
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 34px; height: 34px; border-radius: 50% 46% 52% 48%;
  border: 3px solid rgba(43, 38, 32, .35);
  cursor: pointer; transition: transform .12s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.sel { border-color: var(--ink); transform: scale(1.18); box-shadow: 0 0 0 3px var(--flag); }

.btnrow { display: flex; gap: 18px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.bigbtn {
  font-family: inherit; font-size: 27px;
  padding: 10px 30px;
  background: var(--teal); color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px 18px 12px 20px / 18px 12px 20px 14px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(43, 38, 32, .55);
  transition: transform .1s, box-shadow .1s;
}
.bigbtn:hover { transform: translateY(-2px); }
.bigbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 38, 32, .55); }
.bigbtn.ghost { background: var(--paper); color: var(--teal); }

#howlist { text-align: left; font-size: 21px; line-height: 1.45; margin: 6px 0 4px 26px; }
#howlist li { margin-bottom: 9px; }
#howlist b { color: var(--teal); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hud-left { position: absolute; left: 18px; top: 14px; }
#hpwrap {
  position: relative; width: 300px; height: 30px;
  background: rgba(20, 16, 12, .68);
  border: 3px solid var(--paper);
  border-radius: 10px 14px 10px 14px;
  overflow: hidden;
}
#hpbar {
  position: absolute; inset: 0;
  transform-origin: left center;
  background: linear-gradient(180deg, #7fce6c, #4d9e42);
  transition: transform .18s ease-out;
}
#hpbar.low { background: linear-gradient(180deg, #e2764f, var(--red)); }
#hptext {
  position: relative; z-index: 2;
  display: block; text-align: center; line-height: 25px;
  color: #fff; font-size: 19px; text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
#levelline { margin-top: 6px; font-size: 23px; color: var(--paper); text-shadow: 0 2px 3px rgba(0,0,0,.8); }
#depthtext { margin-left: 14px; color: var(--flag); }

#hud-right { position: absolute; right: 16px; top: 12px; display: flex; gap: 10px; align-items: flex-start; }
#symbolref { display: flex; gap: 8px; }
.sym {
  width: 74px; padding: 5px 4px 3px;
  background: rgba(244, 238, 226, .92);
  border: 3px solid var(--ink);
  border-radius: 10px 13px 9px 14px;
  text-align: center;
}
.sym img { height: 30px; max-width: 62px; object-fit: contain; display: block; margin: 0 auto; }
.sym span { font-size: 16px; }
.sym.flash { box-shadow: 0 0 0 4px var(--flag); }

#mutebtn {
  pointer-events: auto;
  width: 44px; height: 44px; font-size: 24px;
  background: rgba(244, 238, 226, .92); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 50%;
  cursor: pointer; font-family: inherit;
}
#mutebtn.off { color: #b0a695; text-decoration: line-through; }

#banner {
  position: absolute; left: 50%; top: 26%;
  transform: translateX(-50%);
  background: rgba(244, 238, 226, .95);
  border: 4px solid var(--ink);
  border-radius: 16px 20px 14px 22px;
  padding: 12px 36px;
  font-size: 34px; color: var(--earth-deep);
  white-space: nowrap;
  animation: bannerpop .45s ease-out;
}
@keyframes bannerpop {
  0% { transform: translateX(-50%) scale(.6); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ---------- touch ---------- */
#touchui { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#joystick {
  position: absolute; left: 30px; bottom: 30px;
  width: 150px; height: 150px;
  border: 4px solid rgba(244, 238, 226, .5);
  border-radius: 50%;
  background: rgba(20, 16, 12, .3);
  pointer-events: auto;
}
#joyknob {
  position: absolute; left: 50%; top: 50%;
  width: 62px; height: 62px;
  transform: translate(-50%, -50%);
  background: rgba(244, 238, 226, .85);
  border: 3px solid var(--ink);
  border-radius: 50%;
}
#jumpbtn, #drawbtn {
  position: absolute; pointer-events: auto;
  font-family: inherit; font-size: 24px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  width: 96px; height: 96px;
  cursor: pointer;
}
#jumpbtn { right: 150px; bottom: 34px; background: rgba(244, 238, 226, .85); color: var(--ink); }
#drawbtn { right: 30px; bottom: 90px; background: var(--teal); color: var(--paper); font-size: 26px; }
