/* Tidepool — Manu Arcade No. IV
   Game-specific styles only. The shared shell (palette.css) supplies tokens,
   the candlelit ground, masthead, gauges, seal, toggle, board-frame, overlay,
   and colophon. No em dashes in any on-screen copy by house style. */

/* ---- HUD tweaks --------------------------------------------------------- */
.tide-gauge #tide-count { min-width: 1.6em; text-align: right; display: inline-block; }
.tide-gauge .gauge-glyph { color: var(--pig-1); }
.rate-gauge { color: var(--ink-light); font-size: clamp(16px, 2.6vw, 21px); }
.rate-gauge .gauge-glyph { color: var(--forest); }
.rate-unit { font-size: .6em; color: var(--ink-light); margin-left: 1px; }
.seal-face { line-height: 1; transition: transform .4s var(--ease); }

/* ---- Layout: pool + ledger side by side, stacking on phones ------------- */
.pool-wrap {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(248px, 0.95fr);
  gap: clamp(14px, 2.4vw, 26px);
  align-items: start;
}

/* ---- The pool ----------------------------------------------------------- */
.pool-frame {
  padding: clamp(8px, 1.6vw, 14px);
  /* a darker, watery cradle than the default parchment frame */
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.10)),
    var(--parchment-deep);
}
#pool {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: pointer;
  border-radius: 8px;
  background: var(--oxblood-deep);
}
.pool-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 4vw, 28px);
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--hand);
  font-style: italic;
  color: rgba(246,238,214,.82);
  font-size: clamp(15px, 2.4vw, 19px);
  letter-spacing: .02em;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
  animation: hint-breathe 2.8s ease-in-out infinite;
  transition: opacity .6s var(--ease);
}
.pool-hint.gone { opacity: 0; }
@keyframes hint-breathe {
  0%, 100% { opacity: .55; transform: translateX(-50%) translateY(0); }
  50% { opacity: .95; transform: translateX(-50%) translateY(-3px); }
}

/* ---- Ledger / upgrades -------------------------------------------------- */
.ledger {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.ledger-title {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 28px);
  margin: 0 0 2px;
  text-align: center;
}

.upgrades { display: flex; flex-direction: column; gap: 9px; }

.upgrade {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(122,104,80,.34);
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(0,0,0,.02)),
    var(--cream);
  color: var(--ink-soft);
  cursor: pointer;
  overflow: hidden;
  font-family: var(--body);
  box-shadow: 0 2px 5px rgba(58,46,34,.10);
  transition: transform .14s var(--ease), border-color .2s var(--ease),
    box-shadow .2s var(--ease), background .2s var(--ease), opacity .3s var(--ease);
}
.upgrade:hover:not(:disabled) {
  border-color: rgba(90,26,31,.42);
  box-shadow: 0 5px 14px rgba(58,46,34,.18);
  transform: translateY(-1px);
}
.upgrade:active:not(:disabled) { transform: translateY(0) scale(.99); }
.upgrade:disabled { cursor: default; }

/* affordability: dim what you cannot yet buy */
.upgrade.poor { opacity: .62; }
.upgrade.poor .up-cost { color: var(--ink-light); }
.upgrade.rich { border-color: rgba(156,120,38,.55); }
.upgrade.rich .up-cost { color: var(--gold-deep); }

.up-glyph {
  grid-row: 1 / span 2;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 20px;
  color: var(--parchment);
  background: radial-gradient(circle at 38% 30%, var(--oxblood-bright), var(--oxblood) 60%, var(--oxblood-deep));
  box-shadow: inset 0 1px 0 rgba(227,183,84,.3), 0 2px 5px rgba(61,15,18,.3);
}
.upgrade[data-kind="rate"] .up-glyph {
  background: radial-gradient(circle at 38% 30%, var(--forest-bright), var(--forest) 65%, #142117);
}

.up-name {
  grid-column: 2; grid-row: 1;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.1;
}
.up-desc {
  grid-column: 2; grid-row: 2;
  font-size: 12.5px;
  color: var(--ink-light);
  line-height: 1.25;
}
.up-meta {
  grid-column: 3; grid-row: 1 / span 2;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  text-align: right;
}
.up-cost {
  font-family: var(--display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.up-cost::before { content: "≈ "; color: var(--pig-1); font-weight: 400; }
.up-level {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10.5px;
  color: var(--ink-light);
}

/* pulse a freshly purchased card */
@keyframes up-buy {
  0% { box-shadow: 0 0 0 0 rgba(200,156,58,0); }
  30% { box-shadow: 0 0 0 4px rgba(200,156,58,.45); }
  100% { box-shadow: 0 2px 5px rgba(58,46,34,.10); }
}
.upgrade.bought { animation: up-buy .6s var(--ease); }

/* floating "+N level" pop on a card */
.up-pop {
  position: absolute;
  right: 12px; top: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  color: var(--gold-deep);
  pointer-events: none;
  animation: up-pop-rise .8s var(--ease) forwards;
}
@keyframes up-pop-rise {
  0% { opacity: 0; transform: translateY(4px) scale(.8); }
  25% { opacity: 1; transform: translateY(-2px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-16px) scale(1); }
}

/* ---- CTA card (the Tideward funnel) ------------------------------------- */
.cta {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 15px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid rgba(90,26,31,.4);
  background:
    radial-gradient(120% 120% at 15% 0%, rgba(217,148,65,.20), rgba(217,148,65,0) 55%),
    linear-gradient(180deg, var(--oxblood), var(--oxblood-deep));
  color: var(--parchment);
  box-shadow: 0 6px 16px rgba(61,15,18,.32);
  transition: transform .16s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(61,15,18,.42); filter: brightness(1.06); }
.cta:active { transform: translateY(0) scale(.995); }
.cta-eyebrow {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 10.5px;
  color: var(--gold-bright);
}
.cta-line {
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  line-height: 1.15;
  color: var(--cream);
}
.cta-go {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 11.5px;
  color: var(--gold-bright);
  margin-top: 2px;
}

/* ---- Away + milestone notes -------------------------------------------- */
.away-note {
  max-width: 560px;
  margin: 2px auto 0;
  text-align: center;
  font-family: var(--hand);
  font-style: italic;
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--ink-soft);
  background: linear-gradient(180deg, rgba(217,148,65,.16), rgba(217,148,65,.04));
  border: 1px solid rgba(156,120,38,.4);
  border-radius: 10px;
  padding: 9px 16px;
  animation: arcade-rise .5s var(--ease);
}
.away-note[hidden] { display: none; }
.away-note b { font-style: normal; color: var(--oxblood); font-weight: 600; }

.milestone-note {
  min-height: 1.3em;
  margin: 0;
  text-align: center;
  font-family: var(--hand);
  font-style: italic;
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--forest);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.milestone-note.show { opacity: 1; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 720px) {
  .pool-wrap { grid-template-columns: 1fr; }
  .ledger { order: 2; }
  .pool-frame { order: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pool-hint, .up-pop, .upgrade.bought { animation: none !important; }
  .pool-hint { opacity: .8; }
}
