/* Pricespot game styles. Builds on ../styles.css and ../yearspot/yearspot.css (board, form, result,
   modals, stats, archive) and adds Pricespot's accent, the item card, the price line and the amount input. */

/* Pricespot's own accent (raspberry), scoped to the game area so the site header keeps the brand blue */
.ps-accent { --accent: #cc2366; --accent-ink: #ffffff; --accent-text: #b81d5a; }
:root[data-theme="dark"] .ps-accent { --accent: #ff86b0; --accent-ink: #1f0d15; --accent-text: #ff9cbf; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ps-accent { --accent: #ff86b0; --accent-ink: #1f0d15; --accent-text: #ff9cbf; }
}

/* ---------- item card ---------- */

.ps-item {
  position: relative;
  margin-bottom: 14px;
  padding: 20px 22px 18px;
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent) 0%, transparent 55%),
    color-mix(in srgb, var(--accent) 4%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 18%, transparent);
  overflow: hidden;
}
/* a little swing tag in the corner */
.ps-tag {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 46px;
  border-radius: 7px 7px 9px 9px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 24%, 100% 100%, 0 100%, 0 24%);
  transform: rotate(14deg);
  transform-origin: 50% 0;
  opacity: .9;
}
.ps-tag-hole {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.ps-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding-right: 48px;
  font-size: .78rem;
  font-weight: 600;
}
.ps-cat {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ps-cat:empty { display: none; }
.ps-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.ps-name {
  margin-top: 12px;
  padding-right: 40px;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.ps-desc { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.ps-desc:empty { display: none; }
.ps-cur {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent-text);
}
.ps-cur[hidden] { display: none; }
.ps-cur b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  font-family: var(--font-display);
  font-weight: 800;
}

/* ---------- board: guesses with their clue underneath ---------- */

.ps-board .ys-k { width: 64px; }
.ps-board .ys-clue.is-locked .ys-v { font-size: .875rem; }
.ps-guess { justify-content: space-between; padding: 4px 4px 4px 16px; }
.ps-amount {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ps-guess .ys-chip { flex: none; }
.ps-arrow { display: inline-block; width: 1em; margin-right: 2px; text-align: center; font-weight: 800; }

/* ---------- price line (log scale) ---------- */

.ps-line {
  margin-top: 18px;
  padding: 12px 16px 10px;
  border-radius: 12px;
  background: var(--quiet);
}
.ps-track { margin-top: 12px; }
.ps-axis {
  position: relative;
  height: 14px;
  margin-top: 7px;
  color: var(--muted);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}
/* each label sits centred under its tick; --nudge (set in game.js) only pulls one back in at the panel's edge */
.ps-axis span { position: absolute; top: 0; transform: translateX(calc(-50% + var(--nudge, 0px))); white-space: nowrap; transition: left .45s var(--ease); }
/* the tick hangs just below the track, on the exact spot, whatever the nudge */
.ps-axis span::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(50% - var(--nudge, 0px) - .5px);
  width: 1px;
  height: 4px;
  background: currentColor;
  opacity: .5;
}
.ps-dot-guess { transition: left .45s var(--ease), opacity .2s var(--ease); }
/* a guess outside the zoomed-in window, pinned to the end of the line */
.ps-dot-guess.is-off { width: 9px; height: 9px; opacity: .5; }
/* the fill's ends sit exactly on the dots, however close they are */
.ps-track .ys-range { min-width: 0; }
/* the real price once a round is over: a marker on top of the guesses */
.ps-track .ys-range.is-price {
  z-index: 1;
  inset-block: auto;
  top: 50%;
  width: 6px;
  height: 20px;
  border: 2px solid var(--surface);
  box-sizing: content-box;
  transform: translate(-50%, -50%);
}

/* ---------- amount input ---------- */

.ps-field { position: relative; flex: 1; min-width: 0; display: flex; }
.ps-sym {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}
.ps-input { width: 100%; padding-left: var(--ps-sym-pad, 46px); letter-spacing: .01em; }

.ps-quick {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
}
.ps-chip {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--quiet);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.ps-chip:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ps-chip:active { transform: scale(.96); }
.ps-chip:disabled { opacity: .45; cursor: not-allowed; }
.ps-words {
  margin-left: auto;
  padding-right: 8px;
  color: var(--accent-text);
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ps-form .ys-hint { padding-left: 8px; }
.ps-form .ys-btn:disabled { opacity: .6; cursor: progress; }

/* ---------- result ---------- */

.ps-price { font-size: clamp(2.6rem, 11vw, 4.5rem); white-space: nowrap; }
.ps .ys-confetti i { width: 6px; height: 9px; }
.ps-basis { margin-top: 8px; color: var(--muted); font-size: .85rem; }
.ps-source { margin-top: 10px; font-size: .85rem; }
.ps-source[hidden] { display: none; }
.ps-source a { color: var(--accent-text); font-weight: 600; text-underline-offset: 3px; }

@media (max-width: 640px) {
  .ps-quick { padding-left: 4px; }
  .ps-form .ys-hint { padding-left: 4px; }
}
@media (max-width: 560px) {
  .ps-item { padding: 16px 16px 14px; }
  .ps-tag { top: 12px; right: 12px; width: 28px; height: 38px; }
  .ps-board .ys-k { width: auto; }
  .ps-guess { padding-left: 12px; }
}
@media (max-width: 360px) {
  .ps .ys-top { gap: 4px; }
  .ps .ys-back { gap: 4px; white-space: nowrap; font-size: .86rem; }
  .ps .ys-back svg { flex: none; width: 16px; height: 16px; }
  .ps .ys-tools { flex: none; gap: 0; }
  .ps .ys-tool-link { gap: 4px; padding: 0 4px; font-size: .8rem; white-space: nowrap; }
  .ps .ys-tool-link svg { flex: none; width: 16px; height: 16px; }
  .ps .ys-icon-btn { flex: none; width: 36px; }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes ps-swing {
    0%, 100% { transform: rotate(14deg); }
    35% { transform: rotate(-6deg); }
    65% { transform: rotate(22deg); }
  }
  @keyframes ps-chip-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes ps-price-finish {
    0% { transform: scale(1); text-shadow: 0 0 0 transparent; }
    45% { transform: scale(1.075); text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 48%, transparent); }
    100% { transform: scale(1); text-shadow: 0 0 0 transparent; }
  }
  .ps.is-swinging .ps-tag { animation: ps-swing .9s var(--ease); }
  .ps-board .ps-guess.is-new .ys-chip { animation: ps-chip-in .32s var(--ease) 90ms both; }
  /* Replace Yearspot's immediate win pop/loss shake: the price lands after the count-up. */
  .ps .ys-result.is-celebrating .ps-price { animation: none; }
  .ps .ys-result.is-price-settled .ps-price { animation: ps-price-finish .46s var(--ease) both; }
}
