/* Untitled Zoe Game — Storybook Flat-Shaded UI */
:root {
  --cream: #fcf7ee;
  --cream-dark: #f0e6d5;
  --ink: #382c24;
  --ink-soft: #6e5c4f;
  --coral: #e76f51;
  --coral-dark: #d25739;
  --sun: #e9c46a;
  --sage: #5c8d89;
  --mint: #2a9d8f;
  --line-blue: rgba(114, 159, 194, 0.28);
  --margin-red: rgba(231, 111, 81, 0.38);
  --shadow: 0 12px 32px rgba(56, 44, 36, 0.16);
}

* {
  box-sizing: border-box;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ede4d5;
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* Overlays (Title, Help, Victory) */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 44, 36, 0.22);
  backdrop-filter: blur(2.5px);
  z-index: 40;
  padding: 20px;
}

.title-card,
.modal-card {
  background: var(--cream);
  border: 2px solid rgba(56, 44, 36, 0.16);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 32px 36px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.title-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--sage);
  background: rgba(92, 141, 137, 0.12);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.game-title {
  margin: 0 0 10px;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-family: "Georgia", "Palatino", serif;
}

.game-subtitle {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.title-cast {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cast-pill {
  background: var(--cream-dark);
  border: 1px solid rgba(56, 44, 36, 0.12);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.title-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-2p {
  border-color: rgba(69, 123, 157, 0.45);
  color: #1d3557;
  background: #e6f2f8;
}

.btn-2p:hover {
  background: #d3e9f4;
}

.title-tip {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--coral);
  color: #fffdf8;
  box-shadow: 0 5px 0 var(--coral-dark);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #ee795c;
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--coral-dark);
}

.btn-secondary {
  background: var(--cream-dark);
  color: var(--ink);
  border: 1.5px solid rgba(56, 44, 36, 0.18);
}

.btn-secondary:hover {
  background: #e6d9c4;
}

/* HUD Layout */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.hud-top-left,
.hud-top-right,
.hud-bottom-left,
.hud-bottom-right {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-top-left {
  top: 16px;
  left: 16px;
}

.hud-top-right {
  top: 16px;
  right: 16px;
}

.hud-bottom-left {
  bottom: 16px;
  left: 16px;
  flex-wrap: wrap;
  max-width: calc(100vw - 600px);
}

.hud-bottom-right {
  bottom: 16px;
  right: 16px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(252, 247, 238, 0.94);
  border: 1.5px solid rgba(56, 44, 36, 0.16);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(56, 44, 36, 0.09);
}

.hud-btn-accent {
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.hud-btn-accent:hover {
  transform: translateY(-1px);
  background: #fffdf8;
}

.hud-room {
  color: var(--ink-soft);
  font-weight: 700;
}

.badge {
  background: var(--coral);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
}

.hud-pill.forbidden-pill {
  background: #fff0ec;
  border-color: rgba(231, 111, 81, 0.5);
  color: #b83c20;
}

.hud-pill.hidden-pill {
  background: #edf6f3;
  border-color: rgba(42, 157, 143, 0.45);
  color: #1f746a;
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 44, 36, 0.16);
  background: rgba(252, 247, 238, 0.94);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(56, 44, 36, 0.09);
  transition: transform 0.12s ease, background 0.12s ease;
}

.hud-icon-btn:hover {
  transform: translateY(-1px);
  background: #fffdf8;
}

.hud-zoom-btn {
  padding: 7px 12px;
  font-size: 13px;
}

.baobao-btn {
  background: #fff6e6;
  border-color: rgba(231, 111, 81, 0.35);
  color: #b54527;
}

.baobao-btn:hover {
  background: #ffedd2;
}

.berry-btn {
  background: #f5ecff;
  border-color: rgba(123, 44, 191, 0.28);
  color: #5a189a;
  padding: 6px 11px;
  font-size: 12.5px;
}

.berry-btn:hover {
  background: #ebd9ff;
}

.poop-btn {
  background: #eef6eb;
  border-color: rgba(88, 129, 87, 0.35);
  color: #3a5a40;
  padding: 6px 11px;
  font-size: 12.5px;
}

.poop-btn.ready {
  background: #d8f3dc;
  border-color: #2d6a4f;
  color: #1b4332;
  animation: tantrum-pulse 0.75s ease-in-out infinite alternate;
}

.meal-pill {
  background: #fff9e6;
  border-color: rgba(233, 196, 106, 0.65);
  color: #8c5a14;
  font-size: 12.5px;
  padding: 6px 12px;
}

/* Tantrum Charge Bar */
.tantrum-pill {
  cursor: pointer;
  gap: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  transition: transform 0.12s ease, background 0.15s ease;
}

.tantrum-track {
  width: 72px;
  height: 9px;
  background: rgba(56, 44, 36, 0.14);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}

.tantrum-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f4a261, #e76f51, #d62828);
  transition: width 0.18s ease;
}

.tantrum-pct {
  font-size: 11.5px;
  min-width: 30px;
  text-align: right;
  color: var(--ink-soft);
}

.tantrum-pill.ready {
  background: #ffe3e0;
  border-color: #d62828;
  color: #b5171e;
  animation: tantrum-pulse 0.7s ease-in-out infinite alternate;
}

.tantrum-pill.ready .tantrum-pct {
  color: #b5171e;
  font-weight: 900;
}

@keyframes tantrum-pulse {
  from { transform: scale(1); box-shadow: 0 0 0 rgba(214, 40, 40, 0.25); }
  to { transform: scale(1.04); box-shadow: 0 0 14px rgba(214, 40, 40, 0.45); }
}

/* Handwritten Notebook Checklist Drawer */
.checklist-drawer {
  position: absolute;
  top: 66px;
  left: 16px;
  width: min(308px, calc(100vw - 32px));
  max-height: calc(100vh - 188px);
  overflow-y: auto;
  pointer-events: auto;
  background:
    linear-gradient(90deg, transparent 34px, var(--margin-red) 34px, var(--margin-red) 35.5px, transparent 35.5px),
    repeating-linear-gradient(180deg, #fffcf4 0px, #fffcf4 29px, var(--line-blue) 29px, var(--line-blue) 30px);
  border: 1.5px solid rgba(56, 44, 36, 0.2);
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(56, 44, 36, 0.17);
  padding: 16px 16px 14px 46px;
  transform: translateX(-115%) rotate(-1.5deg);
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.checklist-drawer.open {
  transform: translateX(0) rotate(-0.8deg);
  opacity: 1;
}

.notebook-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.notebook-header h2 {
  margin: 0;
  font-family: "Georgia", "Palatino", serif;
  font-size: 20px;
  color: var(--ink);
}

.notebook-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
}

.notebook-close {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.notebook-close:hover {
  background: rgba(56, 44, 36, 0.08);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-zone-hdr {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--sage);
  margin: 10px 0 4px;
}

.task-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 0;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-box {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 1.8px solid var(--ink-soft);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--coral);
}

.task-text {
  position: relative;
  font-weight: 600;
}

.task-item.done .task-text {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 2.2px;
}

.task-item.done .task-box {
  border-color: var(--coral);
  background: rgba(231, 111, 81, 0.12);
}

.task-item.bonus .task-text {
  color: #9e6b1b;
}

.task-hint {
  margin-left: 23px;
  font-size: 11.5px;
  color: var(--ink-soft);
  font-style: italic;
}

.notebook-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(56, 44, 36, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-soft);
}

.hint-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 600;
}

.gate-status {
  font-weight: 700;
  color: var(--sage);
}

/* Controls strip */
.controls-strip {
  background: rgba(252, 247, 238, 0.9);
  border: 1.5px solid rgba(56, 44, 36, 0.14);
  border-radius: 999px;
  padding: 7px 14px;
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 4px 12px rgba(56, 44, 36, 0.08);
}

kbd {
  display: inline-block;
  background: #fff;
  border: 1px solid rgba(56, 44, 36, 0.24);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 800;
  font-family: inherit;
  color: var(--ink);
}

/* Toast notifications */
.toast-container {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(42, 34, 28, 0.92);
  color: #fffdf8;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(42, 34, 28, 0.22);
  animation: toast-in 0.25s ease, toast-out 0.35s ease 2.85s forwards;
}

.toast.task {
  background: var(--mint);
}

.toast.unlock {
  background: var(--coral);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* Help Modal */
.help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  text-align: left;
  margin: 16px 0;
  font-size: 13.5px;
  align-items: center;
}

.help-tips {
  text-align: left;
  background: var(--cream-dark);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 20px;
}

.help-tips ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.help-tips li {
  margin-bottom: 4px;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.stat-box {
  background: var(--cream-dark);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 110px;
}

.stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--coral);
}

.stat-lbl {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1120px) {
  .controls-strip {
    display: none;
  }
  .hud-bottom-left {
    max-width: calc(100vw - 32px);
  }
}

@media (max-width: 820px) {
  .checklist-drawer {
    width: 276px;
  }
}
