/* Price Guessing Game — styles
 * Mobile-first, warm auction vibe, zero external requests (system font stack).
 */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #241f1a;
  --muted: #7a6f63;
  --accent: #e8590c;
  --accent-dark: #c94a08;
  --accent-soft: #ffe8d9;
  --line: #e9e0d4;
  --green: #2f9e44;
  --yellow: #e8b004;
  --orange: #f08c00;
  --red: #e03131;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(60, 40, 20, 0.08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 99;
}
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--accent);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.brand { font-size: 1.05rem; font-weight: 800; text-decoration: none; color: var(--ink); letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-left: 16px; }
.site-nav a:hover { color: var(--accent); }
.auth-area { display: flex; align-items: center; gap: 10px; margin-left: 18px; min-height: 32px; }
.oauth-buttons { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oauth-button { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; color: var(--ink); background: var(--card); font-size: 0.72rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.oauth-button:hover { border-color: var(--accent); color: var(--accent-dark); }
.user-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.user-pic { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent-soft, #ffd8a8); }
.logout-btn {
  border: 1px solid var(--muted); background: none; color: var(--muted);
  font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; cursor: pointer;
}
.logout-btn:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 640px) {
  .site-nav a:first-child { display: none; }
  .auth-area { margin-left: 10px; }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 28px 16px 8px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  letter-spacing: -0.03em;
}
.tagline { margin: 0 auto; max-width: 34em; color: var(--muted); font-size: 1.02rem; }
.tagline strong { color: var(--ink); }

.stats { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 18px; min-width: 92px; box-shadow: var(--shadow);
}
.stat-num { display: block; font-size: 1.3rem; font-weight: 800; }
.stat-label { font-size: 0.75rem; color: var(--muted); }

/* ---------- Game ---------- */
.game { padding: 20px 16px 8px; }

.unit-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.unit-title { font-weight: 800; font-size: 1.15rem; }
.unit-date { color: var(--muted); font-size: 0.85rem; }

.progress { display: flex; gap: 6px; padding-bottom: 4px; }
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--line); display: inline-block; transition: transform 0.15s;
}
.dot-current { transform: scale(1.35); box-shadow: 0 0 0 2px var(--accent-soft); }
.dot-t-green { background: var(--green); }
.dot-t-yellow { background: var(--yellow); }
.dot-t-orange { background: var(--orange); }
.dot-t-red { background: var(--red); }
.unit-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.closer-entry {
  border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent-dark);
  font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.closer-entry:hover { background: var(--accent); color: #fff; }

/* ---------- Close Call mode ---------- */
.closer-card { text-align: center; }
.closer-title { margin: 0 0 6px; font-size: 1.3rem; }
.closer-sub { color: var(--muted); margin: 0 0 14px; font-size: 0.92rem; }
.closer-history { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.closer-history li {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 1.05rem; font-weight: 700; padding: 8px 12px; border-radius: 8px;
}
.cl-guess { min-width: 90px; text-align: right; }
.cl-arrow { min-width: 22px; text-align: center; }
.cl-off { font-size: 0.78rem; font-weight: 600; opacity: 0.85; min-width: 84px; text-align: left; }
.cl-green { background: #d3f9d8; color: #2b8a3e; }
.cl-yellow { background: #fff3bf; color: #e67700; }
.cl-red { background: #ffe3e3; color: #c92a2a; }
.closer-stats-line { font-size: 0.85rem; color: var(--muted); margin: 14px 0 0; }
.mode-btns { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; overflow-x: auto; max-width: 100%; }

/* Close Call guess distribution (Wordle-style bars) */
.closer-dist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-width: 340px; margin-left: auto; margin-right: auto; }
.closer-dist .cd-title { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.closer-dist li { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.cd-label { font-weight: 800; min-width: 14px; text-align: right; color: var(--ink); }
.cd-bar-wrap { flex: 1; background: var(--line); border-radius: 4px; overflow: hidden; }
.cd-bar { display: block; height: 16px; background: var(--green); border-radius: 4px; }
.cd-count { min-width: 22px; font-weight: 700; color: var(--ink); }

/* Battle Royale */
.br-round-line { font-size: 0.95rem; font-weight: 800; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: 6px 14px; display: inline-block; margin: 0 0 12px; }
.br-challenge { font-size: 0.92rem; font-weight: 800; color: #fff; background: var(--accent); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.br-result .btn-primary { margin-top: 12px; }
.br-prog { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 700; }
.br-result { margin: 10px 0 0; }
.br-board-wrap { margin-top: 16px; }
.br-board-title { font-size: 0.85rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
.br-board li { justify-content: flex-start; text-align: left; background: var(--bg); border: 1px solid var(--line); }
.br-board .lb-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-board .lb-meta { font-size: 0.75rem; }
.br-board .lb-pts { font-size: 0.9rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 20px; text-align: center;
}

.item-emoji { font-size: 3.4rem; line-height: 1.15; margin-bottom: 6px; }
.item-name { margin: 0 0 4px; font-size: 1.25rem; letter-spacing: -0.01em; }
.item-desc { color: var(--muted); margin: 0 0 18px; font-size: 0.95rem; }

.bid-row { display: flex; gap: 8px; justify-content: center; align-items: stretch; flex-wrap: wrap; }
.bid-label { width: 100%; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.bid-input-wrap {
  position: relative; display: flex; align-items: center;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color 0.15s;
}
.bid-input-wrap:focus-within { border-color: var(--accent); }
.bid-prefix { padding-left: 14px; color: var(--muted); font-weight: 700; }
.bid-input-wrap input {
  border: none; outline: none; font-size: 1.15rem; font-weight: 700;
  padding: 12px 14px; width: 140px; background: transparent; color: var(--ink);
  font-family: inherit;
}
.bid-input-wrap input::-webkit-outer-spin-button,
.bid-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bid-input-wrap input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.btn {
  border: none; border-radius: 12px; font-size: 1rem; font-weight: 700;
  padding: 13px 22px; cursor: pointer; font-family: inherit; transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); padding: 11px 20px; }
.btn-ghost:hover { background: var(--accent-soft); }

.bid-hint { color: var(--red); font-size: 0.85rem; min-height: 1.2em; margin: 10px 0 0; }

/* ---------- Reveal ---------- */
.reveal-tier { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.t-green { color: var(--green); }
.t-yellow { color: #b98a00; }
.t-orange { color: var(--orange); }
.t-red { color: var(--red); }
.reveal-price { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 6px; }
.reveal-line { color: var(--muted); font-size: 0.95rem; }
.reveal-label { margin-top: 2px; font-weight: 700; }
.reveal-score { color: var(--muted); margin: 6px 0 16px; font-size: 1.05rem; }

/* ---------- Results ---------- */
.results-title { margin: 0 0 4px; font-size: 1.4rem; }
.results-score { font-size: 2.2rem; font-weight: 800; color: var(--accent); margin-bottom: 14px; letter-spacing: -0.02em; }
.results-list { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; }
.results-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 6px;
  background: var(--bg); border: 1px solid var(--line); font-size: 0.92rem;
}
.rl-emoji { font-size: 1rem; flex-shrink: 0; }
.rl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-pts { font-weight: 800; flex-shrink: 0; color: var(--muted); }

.results-card .btn-primary { width: 100%; }
.share-hint { color: var(--green); font-size: 0.9rem; min-height: 1.3em; margin: 8px 0; white-space: pre-line; }
.results-card .btn-ghost { width: 100%; margin-top: 8px; }
.countdown { margin-top: 16px; color: var(--muted); font-size: 0.95rem; }

/* ---------- Rank & identity ---------- */
.rank-line {
  margin: 0 0 14px; padding: 9px 12px;
  background: var(--accent-soft); border-radius: 10px;
  font-weight: 700; color: var(--accent-dark); font-size: 0.98rem;
}
.name-chip {
  display: inline-block; margin: 4px 0 0; padding: 4px 10px;
  background: transparent; border: 1px dashed var(--line); border-radius: 999px;
  color: var(--muted); font-size: 0.8rem; cursor: pointer; font-family: inherit;
}
.name-chip:hover { border-color: var(--accent); color: var(--accent); }
.rl-avg {
  flex-shrink: 0; font-size: 0.72rem; color: var(--muted);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 8px;
}

/* ---------- Leaderboard ---------- */
.lb-intro { color: var(--muted); margin: 0 0 10px; }
.lb-stats { font-weight: 700; color: var(--accent-dark); margin: 0 0 16px; }
.lb-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 620px) { .lb-grid { grid-template-columns: 1fr 1fr; } }
.lb-col {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px;
}
.lb-col h3 { margin: 0 0 10px; font-size: 1rem; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; font-size: 0.9rem;
}
.lb-list li:nth-child(odd) { background: var(--bg); }
.lb-list li.lb-me { background: var(--accent-soft); }
.lb-rank { width: 30px; flex-shrink: 0; font-weight: 800; text-align: center; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-meta { flex-shrink: 0; color: var(--muted); font-size: 0.75rem; }
.lb-pts { flex-shrink: 0; font-weight: 800; color: var(--accent); }
.lb-empty { color: var(--muted); justify-content: center; }

.hero-tight { padding: 14px 16px 0; }
.hero-tight h1 { font-size: clamp(1.2rem, 4vw, 1.55rem); margin-bottom: 2px; }
.hero-tight .tagline { font-size: 0.92rem; }
.closer-entry.is-on { background: var(--accent); color: #fff; border-style: solid; }

/* ---------- Rummage lot (sealed door → pull finds) ---------- */
.lot {
  padding: 0; border: 2px solid #3a2414; border-radius: 12px; overflow: hidden;
  background: #120e0b; color: #f3e6d4;
  box-shadow: 0 12px 40px rgba(40, 20, 8, 0.35); text-align: center;
}
.lot-stage { background: #120e0b; }
.unit-bay {
  position: relative; height: 380px; overflow: hidden;
  background: #0e0b09;
}
.lot-stage.is-open .unit-bay { height: auto; min-height: 300px; overflow: visible; }
.lot-stage.is-open .unit-inside { position: relative; min-height: 260px; padding-top: 48px; }
.unit-door {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 16px 28px;
  background: repeating-linear-gradient(180deg, #d45e14 0 17px, #b84c0e 17px 20px);
  box-shadow: inset 0 0 0 10px #6b2e08, inset 0 -18px 0 #4a1e06;
  transform-origin: 50% 0;
  transition: transform 0.55s cubic-bezier(.2, .8, .2, 1);
}
.lot-stage.is-open .unit-door { transform: translateY(-86%); }
.lot-stage.is-done .unit-bay { display: none; }
.unit-door.rg-shake { animation: rg-shake 0.45s ease; }
@keyframes rg-shake {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(4px) rotate(-0.6deg); }
  40% { transform: translateY(-3px) rotate(0.5deg); }
  60% { transform: translateY(3px); }
}
.lot-stage.is-open .unit-door.rg-shake {
  animation: rg-shake-open 0.4s ease;
}
@keyframes rg-shake-open {
  0%, 100% { transform: translateY(-86%); }
  30% { transform: translateY(-84%) rotate(-0.4deg); }
  60% { transform: translateY(-87%); }
}
.unit-num {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; color: #3a1606; margin-bottom: 6px;
}
.unit-hammer-kicker {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #3a1606;
}
.unit-hammer {
  font-size: clamp(2.2rem, 8vw, 3rem); font-weight: 800; letter-spacing: -0.04em;
  color: #1a0c04; line-height: 1.05; margin: 2px 0 10px;
  text-shadow: 0 1px 0 rgba(255, 220, 180, 0.35);
}
.unit-peek {
  list-style: none; margin: 0; padding: 0; max-width: 22em;
  font-size: 0.82rem; font-weight: 600; color: #3a1606; text-align: left;
}
.unit-peek li { margin: 0 0 4px; padding-left: 1em; position: relative; }
.unit-peek li::before { content: "·"; position: absolute; left: 0; }
.unit-inside {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 54px 14px 12px;
  background:
    radial-gradient(ellipse at 50% 18%, #5a3d1e 0%, transparent 42%),
    linear-gradient(180deg, #1a120c 0%, #0e0b09 100%);
  color: #f6ead8;
}
.lot .rg-pnl { width: 100%; margin: 0 0 8px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.lot .rg-pnl-cell {
  background: #241810; border: 1px solid #4a3424; border-radius: 10px;
  padding: 8px 6px; font-size: 0.72rem; color: #c4b09a;
}
.lot .rg-pnl-cell strong { display: block; font-size: 1.02rem; color: #f6ead8; margin-top: 2px; }
.lot .rg-pnl-num { font-weight: 800; font-size: 0.92rem; color: #f6ead8; }
.lot .t-green { color: #8ce99a; }
.lot .t-red { color: #ff8787; }
.lot .t-yellow { color: #ffd43b; }
.lot .item-name { color: #f6ead8; }
.lot .item-desc { color: #c4b09a; }
.lot .reveal-price { color: #ffd8a8; }
.lot .rg-find-note { color: #c4b09a; }
.lot .rg-remain { color: #c4b09a; margin: 4px 0 8px; }
.lot .rg-offer {
  background: #3a2410; border: 1px solid #e8590c; color: #f6ead8;
  width: 100%; max-width: 28em; border-radius: 12px; padding: 12px 14px; margin: 8px 0 0;
}
.lot .rg-offer p { color: #f6ead8; margin: 0 0 10px; font-weight: 600; }
.rg-offer-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rg-find { margin: 4px 0 6px; width: 100%; }
.rg-find.rg-find-pop { animation: rg-pop 0.35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rg-pop {
  0% { transform: scale(0.84) translateY(8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.lot-actions { padding: 12px 14px 14px; }
.btn-cut {
  width: 100%; border: none; border-radius: 10px;
  background: #ffb703; color: #1a0c04;
  font-size: 1.15rem; font-weight: 800; letter-spacing: 0.02em;
  padding: 16px 18px; min-height: 52px; cursor: pointer; font-family: inherit;
}
.btn-cut:hover { background: #ffc933; }
.btn-cut:active { transform: scale(0.98); }
.btn-cut:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-pass {
  display: inline-block; margin-top: 8px;
  background: none; border: none; color: #c4b09a;
  font-size: 0.88rem; font-weight: 700; cursor: pointer; font-family: inherit;
  min-height: 44px; padding: 8px 12px;
}
.btn-pass:hover { color: #ffb703; }
.haul {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.haul li {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: #1a1410; border: 1px dashed #5a4a38; border-radius: 8px;
  font-size: 1.35rem;
}
.haul li.filled { border-style: solid; border-color: #e8590c; background: #2a1c12; }
.lot #rg-result { padding: 18px 16px 16px; color: #f6ead8; }
.lot #rg-result .results-score { color: #ffb703; }
.lot #rg-result .reveal-line { color: #c4b09a; }
.lot #rg-result .results-list li {
  background: #1a1410; border-color: #4a3424; color: #f6ead8;
}
.lot .share-hint { color: #8ce99a; }
.lot-quiz { width: 100%; color: #7a6f63; }
.lot + .closer-stats-line, .lot .closer-stats-line { color: #c4b09a; padding: 0 12px; }
#rg-stats-line { color: #7a6f63; }
@media (prefers-reduced-motion: reduce) {
  .unit-door { transition: none; }
  .unit-door.rg-shake, .lot-stage.is-open .unit-door.rg-shake, .rg-find.rg-find-pop { animation: none; }
}

/* ---------- Content sections ---------- */
.section { padding: 34px 16px 10px; }
.section h2 { font-size: 1.45rem; letter-spacing: -0.02em; margin: 0 0 14px; }

.howto { padding-left: 20px; margin: 0 0 12px; }
.howto li { margin-bottom: 10px; }
.howto-note { color: var(--muted); font-size: 0.95rem; }

details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 8px;
}
summary { font-weight: 700; cursor: pointer; }
details p { margin: 10px 0 2px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 44px; padding: 26px 0 34px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem;
  text-align: center;
}
.foot-note { font-size: 0.8rem; opacity: 0.8; }

/* ---------- Desktop polish ---------- */
@media (min-width: 560px) {
  .card { padding: 30px 34px; }
  .item-emoji { font-size: 4.2rem; }
  .results-card .btn-primary, .results-card .btn-ghost { width: auto; padding: 13px 34px; }
}
