* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #8fd0f5;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* the canvas takes every finger itself: no scrolling, no zooming */
canvas { display: block; cursor: grab; touch-action: none; }
canvas.point { cursor: pointer; }
canvas.dragging { cursor: grabbing; }

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.label {
  font-size: 12px;
  letter-spacing: 2.5px;
  opacity: 0.85;
}

#coinBox {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  text-shadow: 0 2px 10px rgba(40, 20, 0, 0.75);
}

#coins {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.05;
  color: #ffd84a;
}

#coins.bump { animation: bump 0.45s; }

@keyframes bump {
  40% { transform: scale(1.3); }
}

#served {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 1px;
  opacity: 0.85;
}

/* the order: top middle, never goes away */
#orderCard {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  padding: 8px 10px 10px;
  text-align: center;
  color: #4a2a12;
  background: #fff8e8;
  border: 3px solid #e2b26a;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(40, 20, 0, 0.3);
  transition: opacity 0.3s;
}

#orderCard.waiting { opacity: 0.45; }

#orderCard .label { color: #b0662a; font-weight: 700; opacity: 1; }

#orderPic {
  width: 120px;
  height: 120px;
  display: block;
  margin: 4px auto 2px;
  cursor: default;
}

#orderWords {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

#orderSlices {
  margin-top: 2px;
  font-size: 12px;
  letter-spacing: 1px;
  color: #8a5a32;
}

#soundBtn {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  pointer-events: auto;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(60, 30, 10, 0.35);
  color: #fff;
  font: inherit;
  font-size: 12px;
  letter-spacing: 2px;
  padding: 8px 12px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  touch-action: manipulation;
}

@media (hover: hover) {
  #soundBtn:hover, #boardBtn:hover { border-color: #fff; }
}
#soundBtn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.9); color: #4a2a12; }

/* turns you back to the board, like SPACE. Bottom right, away from the
   site's back link in the bottom left corner. Touch screens only. */
#boardBtn {
  display: none;
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  min-height: 52px;
  pointer-events: auto;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(60, 30, 10, 0.45);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 0 18px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  touch-action: manipulation;
}

#boardBtn:active { background: rgba(255, 255, 255, 0.9); color: #4a2a12; }

/* the oven bar: raw on the left, ready in green, burning in red */
#bakeBox {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(240, 220, 180, 0.6);
}

#bakeBox.hidden { display: none; }

#bakeReady, #bakeBurn {
  position: absolute;
  top: 0;
  bottom: 0;
}

#bakeReady { background: #5cc75a; }
#bakeBurn { background: #e2452f; right: 0; }

#bakeMark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 5px;
  margin-left: -2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

#bakeWord {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  line-height: 18px;
  color: #3a1e08;
}

#message {
  position: absolute;
  top: 300px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 3px 18px rgba(40, 20, 0, 0.85);
  opacity: 0;
  transition: opacity 0.25s;
}

#message.on { opacity: 1; }

#msgBig {
  font-size: 46px;
  font-weight: 700;
}

#msgSmall {
  margin-top: 4px;
  font-size: 18px;
}

#hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  font-size: 14px;
  letter-spacing: 1.5px;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(50, 25, 5, 0.55);
  backdrop-filter: blur(4px);
}

#hint:empty { display: none; }

/* ---------- start card ---------- */

#start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 35%, rgba(220, 110, 40, 0.8), rgba(70, 25, 5, 0.94));
  backdrop-filter: blur(3px);
}

#start.hidden { display: none; }

#start h1 {
  margin: 0;
  font-size: 68px;
  letter-spacing: 4px;
}

#start .tag {
  margin: 6px 0 22px;
  font-size: 17px;
  opacity: 0.9;
  letter-spacing: 1px;
}

#start .keys {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 14px;
  line-height: 1.9;
  opacity: 0.95;
}

#start .keys b {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  margin-right: 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 5px;
  font-size: 12px;
  letter-spacing: 1px;
}

#start .note {
  max-width: 560px;
  font-size: 13px;
  line-height: 1.65;
  opacity: 0.88;
  margin: 0 0 26px;
}

#start .note .hot { color: #ffb08a; }

#startBtn {
  cursor: pointer;
  border: none;
  background: #ffd84a;
  color: #5a2a08;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 15px 34px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(255, 200, 60, 0.35);
}

@media (hover: hover) {
  #startBtn:hover { background: #ffe57a; }
}

/* ---------- touch screens ---------- */
/* body.touch is set by game.js when there's a finger instead of a mouse */

body:not(.touch) .tch, body.touch .desk { display: none !important; }

body.touch #boardBtn { display: block; }
body.touch #soundBtn { min-height: 44px; padding: 8px 16px; }

/* keep the hint between the site's back link (bottom left) and the board
   button (bottom right), wrapping if it has to */
body.touch #hint {
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 8px));
  width: max-content;
  max-width: calc(100% - 340px);
  white-space: normal;
  text-align: center;
}

/* up out of the way of a two-line hint */
body.touch #bakeBox { bottom: max(100px, calc(env(safe-area-inset-bottom) + 80px)); }

body.touch #message { white-space: normal; width: min(90vw, 720px); }

#start { touch-action: none; }
#startBtn { touch-action: manipulation; }

@media (max-width: 820px) {
  #start h1 { font-size: 52px; }
}
