/* That Perfect Day: 16-bit coastal world in the exact Hooga Guidebook UI language. */

@font-face {
  font-family: "Averia Serif Libre";
  src: url("/fonts/AveriaSerifLibre-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Averia Serif Libre";
  src: url("/fonts/AveriaSerifLibre-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Averia Serif Libre";
  src: url("/fonts/AveriaSerifLibre-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Averia Serif Libre";
  src: url("/fonts/AveriaSerifLibre-BoldItalic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/Montserrat-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0e1016;
  --line: #08090d;
  --slate: #2a2a35;
  --slate-hi: #363645;
  --slate-lo: #1f1f28;
  --ivory: #faf8f5;
  --muted: #c8c2b6;
  --gold: #c9a84c;
  --gold-hi: #dcc173;
  --gold-lo: #8f7427;
  --warn: #e39a7c;
  --amber: #ffb547;
  --tide: #5cc7f2;
  --emerald: #6ee7a0;
  --serif: "Averia Serif Libre", Georgia, serif;
  --sans: "Montserrat", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button {
  font: inherit;
  color: inherit;
}
.hidden {
  display: none !important;
}

/* ---------- Tactile 16-Bit Keycaps ---------- */
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--slate-hi);
  color: var(--ivory);
  border: 2.5px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 3px 0 var(--line);
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 0.06s, box-shadow 0.06s;
  position: relative;
}
.key:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28), 0 1px 0 var(--line);
}
.key--gold {
  background: var(--gold);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--gold-lo), 0 3px 0 var(--line);
}
.key--ghost {
  background: var(--slate-lo);
}
.key--square {
  width: 40px;
  min-height: 40px;
  padding: 0;
}
.key--sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 10.5px;
}
@media (hover: hover) {
  .key:hover {
    filter: brightness(1.08);
  }
}

/* ---------- Full-Viewport Beach World ---------- */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0b1320;
}
.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
.stage {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.beach-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: opacity 0.26s ease;
}

/* ---------- Golden Pins on the Beach ---------- */
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: none;
  z-index: 320;
}
.pin-cap {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--gold);
  color: var(--ink);
  border: 2.5px solid var(--line);
  border-radius: 11px;
  box-shadow: inset 0 -3px 0 var(--gold-lo), 0 3px 0 var(--line);
  animation: pin-bob 3.2s ease-in-out infinite, pin-glow 2.4s ease-out infinite;
}
.pin-badge {
  position: absolute;
  top: -6px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d96b43;
  color: #fff;
  border: 2px solid var(--line);
  font: 800 10px/14px var(--sans);
}
.pin-label {
  padding: 3px 9px;
  background: rgba(14, 16, 22, 0.86);
  border: 1.5px solid rgba(8, 9, 13, 0.9);
  border-radius: 999px;
  font: 700 9.5px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ivory);
}
.pin:active .pin-cap {
  transform: translateY(2px);
}
@media (hover: hover) {
  .pin:hover .pin-cap {
    background: var(--gold-hi);
  }
}
@keyframes pin-bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -3px;
  }
}
@keyframes pin-glow {
  0% {
    outline: 0 solid rgba(255, 221, 130, 0.65);
    outline-offset: 0;
  }
  70%,
  100% {
    outline: 8px solid rgba(255, 221, 130, 0);
    outline-offset: 2px;
  }
}

/* ---------- Pete & Nat Walking Guides + Speech Bubbles ---------- */
.guide {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
.guide-hit {
  position: relative;
  display: block;
  padding: 0;
  background: none;
  border: 0;
  pointer-events: auto;
  cursor: pointer;
}
.guide-sprite {
  position: relative;
  display: block;
  background-repeat: no-repeat;
}
.guide-shadow {
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 64%;
  height: 9px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(8, 14, 6, 0.52),
    rgba(8, 14, 6, 0) 70%
  );
}
.bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(240px, 72vw);
  padding: 9px 12px 10px;
  background: var(--ivory);
  color: var(--ink);
  border: 2.5px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--line);
  font: 15px/1.35 var(--serif);
  pointer-events: none;
  animation: pop 0.22s ease-out;
  z-index: 400;
}
.bubble strong {
  display: block;
  margin-bottom: 2px;
  color: var(--gold-lo);
  font: 800 10px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 12px;
  height: 12px;
  background: var(--ivory);
  border: 2.5px solid var(--line);
  border-top: 0;
  border-left: 0;
  transform: translate(-50%, -6px) rotate(45deg);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(6px) scale(0.92);
  }
}

/* ---------- Minimal Top-Left Pill & Bottom 5-Key Dock ---------- */
.topbar-wrap {
  position: fixed;
  top: calc(10px + var(--safe-t));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 1000;
}
.topbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 7px 15px 7px 11px;
  background: rgba(14, 16, 22, 0.84);
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--line);
  pointer-events: auto;
  cursor: pointer;
}
.topbar-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  flex: none;
}
.topbar-title {
  font: italic 700 16px/1.1 var(--serif);
  white-space: nowrap;
}
.topbar-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.22);
}
.topbar-live {
  font: 700 10.5px/1.1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-b));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(580px, calc(100vw - 16px));
  padding: 8px;
  background: rgba(14, 16, 22, 0.88);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--line);
  z-index: 1000;
}
.dock-key {
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
  padding: 6px 2px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
}
.dock-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d96b43;
  color: #fff;
  border: 2px solid var(--line);
  font: 800 10px/14px var(--sans);
}

/* ---------- Hooga Guidebook Pop-Up Sheets ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 5000;
  animation: fade 0.18s ease-out;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 600px);
  max-height: 88dvh;
  transform: translateX(-50%);
  background: var(--slate);
  border: 3px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: inset 0 3px 0 var(--slate-hi);
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@media (min-width: 760px) and (min-height: 560px) {
  .sheet {
    top: 50%;
    bottom: auto;
    max-height: 84vh;
    transform: translate(-50%, -50%);
    border-bottom: 3px solid var(--line);
    border-radius: 22px;
    box-shadow: inset 0 3px 0 var(--slate-hi), 0 6px 0 var(--line);
    animation: fade 0.18s ease-out;
  }
}
@keyframes rise {
  from {
    transform: translateX(-50%) translateY(40px);
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 12px 20px;
  border-bottom: 2px solid var(--slate-lo);
}
.sheet-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  background: var(--gold);
  color: var(--ink);
  border: 2.5px solid var(--line);
  border-radius: 13px;
  box-shadow: inset 0 -3px 0 var(--gold-lo), 0 3px 0 var(--line);
}
.sheet-titles {
  flex: 1;
  min-width: 0;
}
.sheet-close {
  flex: none;
  align-self: flex-start;
}
.kicker {
  color: var(--gold);
  font: 700 10.5px/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sheet h2 {
  margin: 3px 0 0;
  font: italic 700 24px/1.14 var(--serif);
}
.sheet-body {
  padding: 12px 20px calc(26px + var(--safe-b));
  overflow-y: auto;
  overscroll-behavior: contain;
  line-height: 1.52;
}
.sheet-body h3 {
  margin: 18px 0 8px;
  color: var(--gold);
  font: 700 11px/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sheet-body h3:first-child {
  margin-top: 4px;
}

/* Sheet Blocks (Facts, Notes, Cards, 10-Day Rows) */
.note {
  margin: 12px 0;
  padding: 11px 14px;
  border-left: 4px solid var(--gold);
  border-radius: 4px 10px 10px 4px;
  background: rgba(201, 168, 76, 0.13);
  font-size: 16px;
}
.note--sunset {
  border-left-color: var(--amber);
  background: rgba(255, 181, 71, 0.14);
}
.facts {
  margin: 12px 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--slate-lo);
  overflow: hidden;
}
.facts-row {
  display: grid;
  grid-template-columns: minmax(110px, 40%) 1fr;
  gap: 10px;
  padding: 10px 14px;
}
.facts-row + .facts-row {
  border-top: 2px solid var(--slate);
}
.facts dt {
  color: var(--muted);
  font: 700 10.5px/1.5 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.facts dd {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.win-item {
  margin: 10px 0;
  padding: 13px 14px;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.win-item:hover {
  border-color: var(--gold);
}
.win-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.win-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.2);
  color: var(--gold-hi);
  font: 700 9.5px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.win-title {
  font: italic 700 19px/1.2 var(--serif);
}
.win-meta {
  margin-top: 4px;
  font: 600 12px/1.4 var(--sans);
  color: var(--muted);
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0 16px;
}

/* 10-Day Rows inside Sheet */
.day-card {
  margin: 8px 0;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.day-card--gold {
  border-color: var(--gold);
}
.day-head {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.day-head-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.day-title {
  font: italic 700 18px/1.15 var(--serif);
}
.day-sub {
  font: 600 11.5px/1.3 var(--sans);
  color: var(--muted);
}
.ribbon {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  height: 14px;
}
.ribbon-h {
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}
.ribbon-h.is-day {
  background: #3a4659;
}
.ribbon-h.is-tide {
  box-shadow: inset 0 -3px 0 var(--tide);
}
.ribbon-h.is-perfect {
  background: var(--gold);
}
.day-drawer {
  border-top: 2px solid var(--slate);
  padding: 8px 12px 10px;
  overflow-x: auto;
}
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font: 500 12px/1.35 var(--sans);
}
.mini-table th,
.mini-table td {
  padding: 5px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mini-table th {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mini-table tr.is-hit {
  background: rgba(201, 168, 76, 0.16);
}

/* Rules Form */
.rule-box {
  margin: 10px 0;
  padding: 12px 14px;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.rule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font: 600 13px/1.3 var(--sans);
}
.rule-row input[type="number"],
.text-inp {
  padding: 7px 10px;
  border-radius: 9px;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--ivory);
  font: 700 13px/1 var(--sans);
}
.rule-row input[type="number"] {
  width: 78px;
  text-align: center;
}
.text-inp {
  width: 100%;
  font-weight: 500;
}
.btn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.toast {
  margin-top: 8px;
  font: 600 12.5px/1.3 var(--sans);
  color: var(--emerald);
  min-height: 16px;
}
.owner-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.owner-link {
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--muted);
  font: 700 10.5px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.outbox-pre {
  margin: 8px 0;
  padding: 10px;
  background: var(--ink);
  border: 2px solid var(--line);
  border-radius: 10px;
  font: 500 11.5px/1.4 var(--sans);
  white-space: pre-wrap;
}

@media (max-width: 560px) {
  .topbar-sep {
    display: none;
  }
  .topbar-live {
    font-size: 9.5px;
  }
}

/* ---------- Ultra-Clean Visual Stat Tiles, Gems & Virtual Pete Chat ---------- */
.still {
  display: inline-block;
  background-repeat: no-repeat;
  flex: none;
}
.ask-faces {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 0;
  height: 58px;
}
.pete-quote {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 13px 15px;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  font-size: 17.5px;
  line-height: 1.42;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0 16px;
}
.stat-box {
  padding: 13px 14px;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-box--gold {
  border-color: rgba(201, 168, 76, 0.6);
}
.stat-big {
  font: italic 700 24px/1.1 var(--serif);
  color: var(--ivory);
}
.stat-lbl {
  font: 700 10px/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.cta-pair {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.gem-card {
  margin: 10px 0;
  padding: 14px 15px;
  background: var(--slate-lo);
  border: 2px solid var(--gold);
  border-radius: 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gem-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.gem-when {
  font: italic 700 21px/1.15 var(--serif);
}
.gem-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--slate);
  border: 1.5px solid var(--line);
  font: 700 11px/1.2 var(--sans);
  color: var(--ivory);
}
.pill--sunset {
  background: rgba(255, 181, 71, 0.18);
  color: #ffd79a;
  border-color: rgba(255, 181, 71, 0.5);
}
.week-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.week-row--hit {
  border-color: var(--gold);
}
.week-day {
  font: italic 700 17px/1.15 var(--serif);
}
.week-mid {
  font: 600 12px/1.2 var(--sans);
  color: var(--muted);
}
.week-tag {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font: 800 10.5px/1.1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.week-tag--quiet {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

/* Quick Chips & Ask Virtual Pete Chat */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 14px;
}
.chip-btn {
  padding: 7px 12px;
  background: var(--slate-lo);
  border: 2px solid var(--line);
  border-radius: 999px;
  font: 700 11.5px/1.1 var(--sans);
  color: var(--gold-hi);
  cursor: pointer;
}
.chip-btn:hover {
  border-color: var(--gold);
}
.chat-turn {
  margin: 12px 0;
}
.chat-q {
  width: fit-content;
  max-width: 85%;
  margin: 0 0 8px auto;
  padding: 9px 13px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  font: 600 14.5px/1.35 var(--sans);
}
.chat-a {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-face {
  flex: none;
  width: 34px;
  display: flex;
  justify-content: center;
}
.chat-bubble {
  max-width: 88%;
  padding: 10px 13px;
  background: var(--slate-hi);
  border: 2px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  font-size: 16.5px;
  line-height: 1.42;
}
.chat-bubble p {
  margin: 0;
  white-space: pre-line;
}
.chat-name {
  display: block;
  margin-bottom: 3px;
  color: var(--gold);
  font: 700 10px/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.chat-jump {
  margin-top: 8px;
}
.chat-ask {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 2px solid var(--slate-lo);
}
.chat-form {
  flex: 1;
  display: flex;
  gap: 8px;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 13px;
  background: var(--ink);
  color: var(--ivory);
  border: 2.5px solid var(--line);
  border-radius: 12px;
  font: 500 15px/1 var(--sans);
}
.chat-form input:focus {
  outline: 2px solid var(--gold);
}
