:root {
  --ink: #f1ece0;
  --ink-dim: rgba(241, 236, 224, 0.6);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--ink);
  font-family: var(--serif);
  user-select: none;
  -webkit-user-select: none;
}

#viewport { position: fixed; inset: 0; cursor: pointer; }

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: #000;
  transform-origin: center center;
}

.layer { position: absolute; inset: 0; }

/* Backgrounds and mood */
.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease, filter 1.5s ease;
}
.bg-layer.in { opacity: 1; }
.mood-warm  { filter: none; }
.mood-flat  { filter: saturate(0.7); }
.mood-still { filter: saturate(0.45) brightness(0.92); }
.mood-grey  { filter: saturate(0.1) brightness(0.8); }

/* Art and placeholders */
.art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.art-label {
  position: absolute;
  left: 16px;
  top: 12px;
  font: 13px/1.4 var(--mono);
  color: rgba(255, 255, 255, 0.3);
  white-space: pre;
}
.art.has-image .art-label { display: none; }

#vignette {
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 45%, rgba(0, 0, 0, 0.55) 100%);
}
/* Always-on darkening + slight blur of the photo so text and props stay readable. */
#vignette::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 34% at 50% 46%, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.4) 65%, rgba(0, 0, 0, 0) 100%),
    rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(1.5px);
}

/* Slide text */
.slide-text {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 34px;
  line-height: 1.55;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 2px 16px rgba(0, 0, 0, 0.8);
  transition: opacity 0.3s ease;
}
.slide-text.out { opacity: 0; }
.slide-text .line {
  display: block;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.slide-text .line.in { opacity: 1; }
.slide-text b { font-weight: 700; }
.slide-text em {
  font-style: normal;
  color: #fff;
  border-bottom: 1px solid rgba(241, 236, 224, 0.5);
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  font-size: 22px;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.8s ease;
}
.hint.show { opacity: 1; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* Loading screen */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #000;
  transition: opacity 0.5s ease;
}
.loading.out { opacity: 0; }
.loading p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.4); }
.loading .count { font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.3); }
.loading .bar { width: 240px; height: 1px; background: rgba(255, 255, 255, 0.12); }
.loading .bar i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, 0.7); }

/* Title screen */
.title-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.title-screen.in { opacity: 1; }
.title-screen.out { opacity: 0; transition-duration: 0.6s; }

.title-screen h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  color: #fff;
}
.title-screen .prompt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 48px;
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}

/* Minigame stub */
.stub {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.stub.in { opacity: 1; }
.stub.out { opacity: 0; transition-duration: 0.3s; }
.stub .kicker { font: 14px var(--mono); letter-spacing: 0.2em; color: var(--ink-dim); }
.stub h2 { margin: 10px 0; font-size: 52px; font-weight: 400; }
.stub .note { font: 14px var(--mono); color: var(--ink-dim); }
.stub .prompt { margin-top: 70px; font-size: 20px; letter-spacing: 0.1em; animation: pulse 2.6s ease-in-out infinite; }

/* Black card (end) */
.card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.card.in { opacity: 1; }

/* Minigames */
.mg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.mg.in { opacity: 1; }
.mg-verb {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
.mg-hint {
  position: absolute;
  bottom: 44px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.mg-hint.show { opacity: 1; }

.clickable { cursor: pointer; }

.prop {
  position: absolute;
  transition: left 0.6s ease, top 0.6s ease, opacity 0.5s ease, transform 0.6s ease;
}
.prop:not(.clickable):not(.drag-tip) { pointer-events: none; }
.prop .art {
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}
.prop .art.has-image { border: none; }
.prop .art-label {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 12px;
}
.prop.clickable:hover .art { border-color: rgba(255, 255, 255, 0.65); }
.prop.tomato .art, .prop.drag-tip .art { border-radius: 50%; }
.prop.bait.drag-tip .art { border-radius: 8px; }
.target.small { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
.target.click { pointer-events: auto; cursor: pointer; }
.target.click:hover { border-color: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.08); }
.drag-tip { cursor: grab; touch-action: none; pointer-events: auto; }
.drag-tip.dragging { transition: none; cursor: grabbing; }

.mg-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mg-line { fill: none; stroke: rgba(241, 236, 224, 0.85); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }

.target {
  position: absolute;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  pointer-events: none;
  animation: pulse 2s ease-in-out infinite;
}

.water-zone {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
}
.ripple {
  position: absolute;
  width: 100px;
  height: 100px;
  margin: -50px 0 0 -50px;
  border-radius: 50%;
  cursor: pointer;
}
.ripple i {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  opacity: 0;
  animation: ring 2.4s ease-out infinite;
}
.ripple i:nth-child(2) { animation-delay: 0.8s; }
.ripple i:nth-child(3) { animation-delay: 1.6s; }
@keyframes ring {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Phone (drawn in CSS) */
.phone {
  position: absolute;
  left: 450px;
  top: 30px;
  width: 380px;
  height: 660px;
  box-sizing: border-box;
  padding: 14px;
  border-radius: 48px;
  background: #0a0a0c;
  border: 2px solid #2c2c32;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #eee;
}
.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 34px;
  overflow: hidden;
  background: #101114;
}
.view { position: absolute; inset: 0; animation: view-in 0.4s ease; }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }
.view.sleep { background: #000; }
.lock .time { margin-top: 110px; text-align: center; font-size: 92px; font-weight: 300; letter-spacing: -0.02em; }
.lock .time small { font-size: 26px; margin-left: 8px; opacity: 0.7; }
.lock .time.word { font-size: 76px; font-weight: 200; letter-spacing: 0.02em; }
.notif {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 380px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
}
.notif b { display: block; font-size: 15px; margin-bottom: 3px; }
.notif span { font-size: 15px; opacity: 0.85; }
.thread header, .inbox header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 18px;
  font-weight: 600;
}
.back { cursor: pointer; font-size: 28px; padding: 0 8px; line-height: 1; }
.bubbles {
  position: absolute;
  left: 0;
  right: 0;
  top: 68px;
  bottom: 76px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  overflow: hidden;
}
.bubble {
  align-self: flex-start;
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  background: #2a2b30;
  font-size: 16px;
  line-height: 1.3;
}
.bubble.me { align-self: flex-end; background: #2a6cf0; }
.inputbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
}
.field {
  flex: 1;
  height: 40px;
  box-sizing: border-box;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.4);
}
.field.typed { color: #fff; }
.send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a6cf0;
  opacity: 0.3;
}
.send.on { opacity: 1; }
.inbox .row { position: relative; padding: 12px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.inbox .row .then { position: absolute; right: 18px; top: 14px; font-size: 12px; font-style: normal; opacity: 0.4; }
.inbox .row b { display: block; font-size: 15px; }
.inbox .row span { font-size: 14px; opacity: 0.7; }

/* Fishing: rises fade out if not clicked; reel progress bar */
.ripple.fading { opacity: 0; transition: opacity 0.8s ease; }
.water-zone.clickable { cursor: crosshair; }
.mg-sink { stroke: rgb(241, 236, 224); stroke-width: 3; stroke-linecap: butt; }
.line-end { position: absolute; width: 0; height: 0; }
/* Rings on the water where the line goes under: the landing, and the wake while reeling in. */
.ring-fx {
  position: absolute;
  width: 64px;
  height: 20px;
  margin: -10px 0 0 -32px;
  border: 1.5px solid rgba(241, 236, 224, 0.6);
  border-radius: 50%;
  pointer-events: none;
  animation: ring-fx 1.1s ease-out forwards;
}
.ring-fx.wake { width: 34px; height: 11px; margin: -5px 0 0 -17px; border-color: rgba(241, 236, 224, 0.4); animation-duration: 0.8s; }
@keyframes ring-fx {
  from { transform: scale(0.15); opacity: 0.9; }
  to { transform: scale(1.5); opacity: 0; }
}
.reel {
  position: absolute;
  left: 50%;
  bottom: 96px;
  width: 240px;
  height: 2px;
  margin-left: -120px;
  background: rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.reel.show { opacity: 1; }
.reel i { display: block; height: 100%; width: 0; background: rgba(241, 236, 224, 0.9); }
