/* ============================================================
   The Million Dollar Keyboard — light theme, retro board
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #9b9ba1;
  --line: #e8e8ed;
  --dash: #d2d2d7;
  --green: #16a34a;
  --green-dark: #15803d;
  --red: #d9453c;
  --blue: #3a7bd5;
  --yellow: #f0b429;
  --navy: #343a4e;
  --amber: #ffb02e;

  /* keycaps */
  --cap-face-hi: #f7f4ea;
  --cap-face-lo: #eae5d4;
  --cap-side: #b9b3a0;
  --legend-blue: #3d6bb0;

  --radius: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.modal-lock { overflow: hidden; }

a { color: inherit; }
button { font-family: inherit; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
}
.logo-key {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo));
  border: 1px solid var(--cap-side);
  border-bottom-width: 3px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}
.logo-key svg { width: 16px; height: 16px; display: block; }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  text-decoration: none;
  font-size: 14.5px;
  color: var(--text);
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--muted); }
.nav-ext { font-size: 11px; color: var(--faint); }
.btn {
  display: inline-block;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: #111;
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); background: #2a2a2e; }
.btn-lg { font-size: 16px; padding: 15px 34px; }

/* ---------------- Hero ---------------- */
.hero {
  text-align: center;
  padding: clamp(48px, 8vh, 96px) 20px 12px;
}
.press-any {
  display: inline-block;
  margin-bottom: 30px;
  padding: 9px 18px 11px;
  border: 1px solid var(--cap-side);
  border-bottom-width: 4px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo));
  color: var(--legend-blue);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  animation: press-any-pulse 2.4s ease-in-out infinite;
  transition: transform 0.08s ease, border-bottom-width 0.08s ease;
}
.press-any:hover { animation-play-state: paused; opacity: 1; }
.press-any:active { transform: translateY(2px); border-bottom-width: 2px; }
@keyframes press-any-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .press-any { animation: none; }
}

.hero h1 {
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 auto 18px;
  max-width: 18ch;
}
.hero p.sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--muted);
  max-width: 56ch;
  margin: 0 auto;
  line-height: 1.55;
}
.hero p.sub strong { color: var(--text); font-weight: 600; }

.goal {
  max-width: 560px;
  margin: 40px auto 0;
}
.goal-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.goal-raised { font-size: 15px; color: var(--muted); }
.goal-raised strong {
  color: var(--green);
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.goal-pct { font-size: 14.5px; font-weight: 700; color: var(--green); }
.goal-track {
  height: 8px;
  border-radius: 999px;
  background: #e9e9ee;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.goal-note { font-size: 13px; color: var(--faint); margin: 10px 0 0; }

#sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--dash);
  color: var(--muted);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
#sound-toggle:hover { border-color: var(--faint); }
#sound-toggle .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px #16a34a66;
}
#sound-toggle.off .dot { background: var(--faint); box-shadow: none; }

/* ---------------- Keyboard scene ---------------- */
.kb-scene {
  position: relative;
  padding: clamp(14px, 3vh, 30px) 14px clamp(48px, 7vh, 80px);
  perspective: 1800px;
  display: flex;
  justify-content: center;
}

.keyboard {
  position: relative;
  width: min(1160px, 97vw);
  transform: rotateX(7deg);
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
  border-radius: clamp(18px, 2.4vw, 30px);
  background: linear-gradient(180deg, #f4f1e8, #e7e3d5 55%, #dbd6c4);
  border: 1px solid #cfc9b6;
  border-bottom: 4px solid #beb7a1;
  padding: clamp(12px, 1.8vw, 22px) clamp(12px, 1.9vw, 24px) clamp(16px, 2.4vw, 30px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    0 18px 40px -14px rgba(92, 82, 54, 0.4),
    0 50px 90px -40px rgba(92, 82, 54, 0.35);
}

/* LED dot-matrix display */
.marquee {
  position: relative;
  height: clamp(52px, 7.5vw, 96px);
  border-radius: clamp(8px, 1.2vw, 14px);
  background: #141519;
  border: 3px solid #0d0e11;
  box-shadow:
    inset 0 4px 14px rgba(0, 0, 0, 0.85),
    0 1px 0 rgba(255, 255, 255, 0.65);
  margin-bottom: clamp(10px, 1.5vw, 18px);
  overflow: hidden;
}
.marquee::after {
  /* glass glare */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.09), transparent 28%);
  pointer-events: none;
}
.marquee canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#kb-rows {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.55vw, 7px);
}
.kb-row {
  display: flex;
  gap: clamp(4px, 0.55vw, 7px);
  height: clamp(36px, 4.8vw, 58px);
}
.kb-row-fn { height: clamp(24px, 3vw, 36px); }
.kb-row-fn .key .cap { gap: 2px; flex-direction: row; }
.kb-row-fn .k-icon { width: clamp(10px, 1.1vw, 14px); height: clamp(10px, 1.1vw, 14px); }

/* stacked half-height arrow pair (MacBook style) */
.key-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.key-half { flex: 1; padding-bottom: 3px !important; }
.key-half .k-icon { width: clamp(9px, 1vw, 13px); height: clamp(9px, 1vw, 13px); }

/* ---------------- Keys ---------------- */
.key {
  position: relative;
  border: 0;
  padding: 0 0 clamp(4px, 0.5vw, 6px);
  border-radius: var(--radius);
  background: var(--cap-side);
  cursor: pointer;
  min-width: 0;
  transition: transform 0.06s ease, padding-bottom 0.06s ease;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 3px;
}
.key .cap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius) - 1px);
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -6px 8px -6px rgba(120, 110, 80, 0.55);
  color: var(--legend-blue);
  overflow: hidden;
}
.c-beige:hover .cap { background: linear-gradient(180deg, #fbf9f1, #f0ecdd 78%); }
.key.pressed {
  transform: translateY(clamp(2px, 0.3vw, 3px));
  padding-bottom: 1px;
}
.c-beige.pressed .cap {
  background: linear-gradient(180deg, #ece8da, #e2ddcb 78%);
  box-shadow:
    inset 0 1px 2px rgba(120, 110, 80, 0.35),
    inset 0 0 10px rgba(120, 110, 80, 0.18);
}

/* colored caps */
.c-navy { background: #23283a; }
.c-navy .cap {
  background: linear-gradient(180deg, #4a5069, #343a4e 78%);
  color: #d7dcef;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -6px 8px -6px rgba(0, 0, 0, 0.6);
}
.c-navy:hover .cap { background: linear-gradient(180deg, #545b76, #3b4157 78%); }
.c-navy.pressed .cap { background: linear-gradient(180deg, #3d4257, #2d3345 78%); }

.c-blue { background: #245094; }
.c-blue .cap {
  background: linear-gradient(180deg, #5b93e4, #3a76cc 78%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -6px 8px -6px rgba(10, 40, 90, 0.6);
}
.c-green { background: #1d6b42; }
.c-green .cap {
  background: linear-gradient(180deg, #48bb80, #2e9e63 78%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -6px 8px -6px rgba(8, 60, 34, 0.6);
}
.c-yellow { background: #b17f12; }
.c-yellow .cap {
  background: linear-gradient(180deg, #f8c651, #eab226 78%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -6px 8px -6px rgba(120, 80, 8, 0.55);
}
.c-red { background: #99251e; }
.c-red .cap {
  background: linear-gradient(180deg, #e56258, #d1443b 78%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -6px 8px -6px rgba(90, 15, 10, 0.6);
}
.c-blue:hover .cap, .c-green:hover .cap, .c-yellow:hover .cap, .c-red:hover .cap { filter: brightness(1.06); }
.c-blue.pressed .cap, .c-green.pressed .cap, .c-yellow.pressed .cap, .c-red.pressed .cap { filter: brightness(0.92); }

/* legends */
.k-main {
  font-size: clamp(10px, 1.1vw, 15px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.k-solo { font-size: clamp(11px, 1.2vw, 16px); }
.k-sub {
  font-size: clamp(7px, 0.82vw, 11px);
  opacity: 0.75;
  line-height: 1;
  font-weight: 600;
}
.k-word {
  font-size: clamp(6.5px, 0.78vw, 10.5px);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.k-glyph {
  font-size: clamp(8px, 0.9vw, 12px);
  line-height: 1;
  opacity: 0.85;
}
.k-sub-fn {
  font-size: clamp(6px, 0.7vw, 9px);
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.6;
  line-height: 1;
}
.k-icon {
  width: clamp(13px, 1.5vw, 20px);
  height: clamp(13px, 1.5vw, 20px);
}
.k-icon svg { width: 100%; height: 100%; display: block; }
.tri-blue { color: #5b93e4; }
.tri-navy { color: #2c3145; }

.wasd-dot {
  width: 3.5px;
  height: 3.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  margin-top: 2px;
}
.homing-bar {
  position: absolute;
  bottom: clamp(3px, 0.5vw, 6px);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(8px, 1vw, 13px);
  height: 2px;
  border-radius: 2px;
  background: rgba(80, 100, 140, 0.45);
}

/* ---------------- Owned keys — cap painted in the brand's chosen color ---------------- */
.key.owned::after {
  content: '';
  position: absolute;
  inset: -3px -5px -9px;
  border-radius: 12px;
  background: radial-gradient(60% 75% at 50% 100%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 72%);
  z-index: -1;
  pointer-events: none;
}
.key.owned { background: var(--bcap-side, var(--cap-side)); }
.key.owned .cap {
  background: linear-gradient(180deg, var(--bcap-hi, var(--cap-face-hi)), var(--bcap-lo, var(--cap-face-lo)) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 8px -6px rgba(0, 0, 0, 0.35);
}
.key.owned:hover .cap { filter: brightness(1.06); }
.key.owned.pressed .cap { filter: brightness(0.92); }
.brand-logo-wrap {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
}
.brand-logo {
  width: 48%;
  height: 48%;
  max-width: 27px;
  max-height: 27px;
  object-fit: contain;
}
.monogram { font-size: clamp(12px, 1.35vw, 18px); font-weight: 800; }
.cap.has-logo > .k-main,
.cap.has-logo > .k-sub,
.cap.has-logo > .k-solo,
.cap.has-logo > .k-word,
.cap.has-logo > .k-icon,
.cap.has-logo > .k-glyph,
.cap.has-logo > .k-sub-fn,
.cap.has-logo > .wasd-dot { visibility: hidden; }
.k-corner {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: clamp(6px, 0.7vw, 9px);
  font-weight: 700;
  opacity: 0.5;
}

/* LED wave */
.key.waving .cap {
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--wave, var(--red)) 65%, transparent),
    inset 0 0 14px color-mix(in srgb, var(--wave, var(--red)) 30%, transparent);
  transition: box-shadow 0.12s ease;
}
.key.waving::before {
  content: '';
  position: absolute;
  inset: -4px -6px -10px;
  border-radius: 12px;
  background: radial-gradient(60% 75% at 50% 100%, color-mix(in srgb, var(--wave, var(--red)) 45%, transparent), transparent 70%);
  z-index: -1;
}

/* ---------------- Tooltip ---------------- */
.kb-tip {
  position: fixed;
  z-index: 90;
  transform: translate(-50%, calc(-100% - 16px));
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.kb-tip.show { opacity: 1; }
.kb-tip strong { font-size: 12.5px; }
.kb-tip span { color: #a8a8ad; font-size: 11.5px; }

/* ---------------- Ticker ---------------- */
.ticker {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 13px 0;
  background: #fafafa;
  position: relative;
}
.ticker::before,
.ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  z-index: 2;
  pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(90deg, #fafafa, transparent); }
.ticker::after { right: 0; background: linear-gradient(-90deg, #fafafa, transparent); }
#ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  white-space: nowrap;
  animation: ticker-scroll 70s linear infinite;
  will-change: transform;
}
.ticker:hover #ticker-inner { animation-play-state: paused; }
@keyframes ticker-scroll {
  to { transform: translateX(-33.35%); }
}
.tk-item { color: var(--muted); font-size: 13px; display: inline-flex; align-items: baseline; gap: 8px; }
.tk-item strong { color: var(--text); font-weight: 600; }
.tk-key {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo));
  border: 1px solid var(--cap-side);
  border-bottom-width: 2px;
  color: var(--legend-blue);
  font-size: 11px;
  font-weight: 700;
  transform: translateY(2px);
}
.tk-date { color: var(--faint); font-size: 11.5px; }
.tk-sep { color: var(--red); font-size: 10px; }

/* ---------------- Sections ---------------- */
.section {
  max-width: 1020px;
  margin: 0 auto;
  padding: clamp(56px, 9vh, 104px) clamp(18px, 4vw, 32px) 0;
}
.section-head { text-align: center; margin-bottom: 38px; }
.section h2 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  font-weight: 700;
}
.section .lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 58ch;
  margin: 0 auto;
}

/* stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat {
  border: 1px dashed var(--dash);
  border-radius: 14px;
  background: #fff;
  padding: 20px 22px;
  text-align: center;
}
.stat .label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 8px;
}
.stat .value {
  font-size: clamp(20px, 2.6vw, 27px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat .value.accent { color: var(--green); }

/* leaderboard */
.lb {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.15);
}
.lb-head, .lb-row {
  display: grid;
  grid-template-columns: 48px 64px 1fr auto 92px;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
}
.lb-head {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.lb-row { border-bottom: 1px solid var(--line); transition: background 0.15s ease; }
.lb-row:last-child { border-bottom: 0; }
.lb-row:hover { background: #fafafa; }
.lb-rank { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.lb-keycap {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo));
  border: 1px solid var(--cap-side);
  border-bottom-width: 3px;
  font-weight: 700;
  font-size: 13px;
  color: var(--legend-blue);
}
.lb-owner { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; min-width: 0; }
.lb-swatch {
  width: 10px; height: 10px; border-radius: 3px; flex: none;
  background: var(--brand);
}
.lb-price { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14.5px; }
.lb-outbid {
  border: 1px solid var(--dash);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 0;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lb-outbid:hover { border-color: #111; color: #111; }

/* how it works */
.hiw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.hiw-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 28px 26px 30px;
}
.hiw-num {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo));
  border: 1px solid var(--cap-side);
  border-bottom-width: 3px;
  font-size: 12px;
  color: var(--legend-blue);
  font-weight: 800;
  margin-bottom: 16px;
}
.hiw-card h3 { margin: 0 0 10px; font-size: 18px; letter-spacing: -0.01em; }
.hiw-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.hiw-card p strong { color: var(--text); }

/* closing CTA */
.cta-final { text-align: center; padding-bottom: 20px; }
.cta-final p { color: var(--faint); font-size: 13px; margin-top: 16px; }

/* footer */
.site-footer {
  margin-top: clamp(56px, 9vh, 96px);
  border-top: 1px solid var(--line);
  padding: 30px clamp(18px, 4vw, 48px) 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 13px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ---------------- Modal ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 20, 22, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: min(440px, 100%);
  max-height: min(86vh, 720px);
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 26px 26px 28px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.35);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}
.modal.open .modal-card { transform: none; }
.m-top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.m-keycap {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--cap-side);
  padding: 0 0 6px;
  pointer-events: none;
  position: relative;
}
.m-keycap .cap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--cap-face-hi), var(--cap-face-lo) 78%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--legend-blue);
  overflow: hidden;
  position: relative;
}
.m-keycap.c-navy { background: #23283a; }
.m-keycap.c-navy .cap { background: linear-gradient(180deg, #4a5069, #343a4e 78%); color: #d7dcef; }
.m-keycap.c-blue { background: #245094; }
.m-keycap.c-blue .cap { background: linear-gradient(180deg, #5b93e4, #3a76cc 78%); color: #fff; }
.m-keycap.c-green { background: #1d6b42; }
.m-keycap.c-green .cap { background: linear-gradient(180deg, #48bb80, #2e9e63 78%); color: #fff; }
.m-keycap.c-yellow { background: #b17f12; }
.m-keycap.c-yellow .cap { background: linear-gradient(180deg, #f8c651, #eab226 78%); color: #fff; }
.m-keycap.c-red { background: #99251e; }
.m-keycap.c-red .cap { background: linear-gradient(180deg, #e56258, #d1443b 78%); color: #fff; }
.m-keycap .k-main, .m-keycap .k-solo { font-size: 18px; }
.m-keycap .k-sub { font-size: 11px; }
.m-keycap .k-word { font-size: 8.5px; }
.m-keycap .k-icon { width: 22px; height: 22px; }
.m-keycap .brand-logo { width: 30px; height: 30px; max-width: none; max-height: none; }
.m-keycap .monogram { font-size: 20px; }
.m-keycap .k-corner { font-size: 8px; }
.m-keycap.owned::after { display: none; }
.m-title h3 { margin: 0 0 7px; font-size: 22px; letter-spacing: -0.01em; }
.chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 4px 11px;
}
.chip-owned { background: color-mix(in srgb, var(--brand) 14%, #fff); color: color-mix(in srgb, var(--brand) 80%, #000); }
.chip-open { background: #e7f6ec; color: var(--green-dark); }
.chip-house { background: #f0f0f2; color: var(--muted); }
#m-close {
  margin-left: auto;
  align-self: flex-start;
  background: transparent;
  border: 0;
  color: var(--faint);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
#m-close:hover { color: var(--text); }

.m-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border: 1px dashed var(--dash);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
#m-price-label { color: var(--faint); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
#m-price { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--green); }

#m-history-wrap { margin-bottom: 18px; }
#m-history-wrap h4 {
  margin: 0 0 8px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
#m-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#m-history li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 9px;
  background: #f7f7f8;
}
.h-name { font-weight: 600; }
.h-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.h-date { color: var(--faint); font-size: 12px; margin-left: auto; }
.h-crown {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green-dark);
  background: #e7f6ec;
  padding: 2px 8px;
  border-radius: 999px;
}

#bid-form { display: flex; flex-direction: column; gap: 12px; }
.f-row { display: flex; gap: 10px; }
.f-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.f-field label { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.f-opt { text-transform: none; font-weight: 400; }
.f-field input,
.f-field select {
  background: #fff;
  border: 1px solid var(--dash);
  border-radius: 10px;
  color: var(--text);
  font-size: 14.5px;
  padding: 11px 13px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s ease;
}
.f-field input:focus,
.f-field select:focus { outline: none; border-color: #111; }
.f-field select { cursor: pointer; appearance: auto; }
.f-field input[type='color'] {
  padding: 4px;
  height: 43px;
  width: 56px;
  cursor: pointer;
}
.f-color-field { flex: none; }
#f-min-note { font-size: 12px; color: var(--faint); }

/* − $x + bid stepper */
.stepper { display: flex; gap: 10px; align-items: stretch; }
.step-btn {
  flex: none;
  width: 46px;
  border: 1px solid var(--dash);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.step-btn:hover:not(:disabled) { border-color: #111; }
.step-btn:active:not(:disabled) { background: #f2f2f4; }
.step-btn:disabled { opacity: 0.35; cursor: default; }
.stepper #f-amount {
  text-align: center;
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* logo picker */
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-preview {
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px dashed var(--dash);
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fafafa;
  overflow: hidden;
}
.logo-preview img { width: 34px; height: 34px; object-fit: contain; }
#logo-fallback { font-weight: 800; font-size: 17px; color: var(--faint); }
.logo-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
#logo-upload-btn, #logo-reset {
  border: 1px solid var(--dash);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
#logo-upload-btn:hover, #logo-reset:hover { border-color: #111; }
.logo-note { font-size: 12px; color: var(--faint); }

/* favicons/uploads sit on a uniform white badge so mixed icon styles stay clean */
.brand-logo.natural {
  width: 58%;
  height: 58%;
  max-width: 32px;
  max-height: 32px;
  background: linear-gradient(180deg, #ffffff, #ebebef);
  padding: 4.5%;
  border-radius: 24%;
  object-fit: contain;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.key-half .brand-logo.natural, .kb-row-fn .brand-logo.natural { max-width: 20px; max-height: 20px; }
#f-submit {
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #111;
  color: #fff;
  transition: transform 0.12s ease, background 0.12s ease;
}
#f-submit:hover { transform: translateY(-1px); background: #2a2a2e; }
.f-fineprint { font-size: 11.5px; color: var(--faint); text-align: center; margin: 2px 0 0; }
#m-house-note { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  z-index: 110;
  background: #1d1d1f;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  color: #c9c9ce;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
#toast strong { color: #fff; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .site-nav { display: none; }
  .stats-strip, .hiw-grid { grid-template-columns: 1fr; }
  .lb-head, .lb-row { grid-template-columns: 34px 48px 1fr auto; }
  .lb-head span:last-child, .lb-outbid { display: none; }
}
@media (max-width: 560px) {
  /* keep caps close to square — heights track viewport width */
  .kb-row { gap: 2.5px; height: 6vw; }
  .kb-row-fn { height: 3.8vw; }
  #kb-rows { gap: 2.5px; }
  .marquee { height: 12vw; border-width: 2px; margin-bottom: 8px; }
  .key { padding-bottom: 2.5px; border-radius: 5px; }
  .key .cap { border-radius: 4px; }
  .key.pressed { transform: translateY(1.5px); }
  .brand-logo.natural { max-width: 16px; max-height: 16px; border-radius: 3px; }
  .monogram { font-size: 9px; }
  .wasd-dot { display: none; }
  .homing-bar { display: none; }
  .k-sub, .k-sub-fn { display: none; }
  .k-corner { display: none; }
  .k-main { font-size: 8.5px; }
  .k-solo { font-size: 9px; }
  .k-icon { width: 10px; height: 10px; }
  .kb-row-fn .k-icon { width: 8px; height: 8px; }
  /* words don't fit tiny caps — keys with a mac glyph show just the glyph */
  .k-glyph { font-size: 9.5px; opacity: 1; }
  .k-glyph ~ .k-word { display: none; }
  .k-word { font-size: 5.5px; letter-spacing: 0.02em; }
  .keyboard { transform: none; }
  .site-header { gap: 10px; padding: 10px 14px; }
  .logo { font-size: 13.5px; white-space: nowrap; gap: 7px; }
  .logo-key { width: 24px; height: 24px; }
  #sound-toggle span:last-child { display: none; }
  #sound-toggle { padding: 8px 10px; }
  .btn { padding: 9px 14px; font-size: 13px; white-space: nowrap; }
}

/* rotate hint — only small portrait screens */
.rotate-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 16px 0;
  padding: 10px 16px;
  border: 1px dashed var(--dash);
  border-radius: 999px;
  background: #fffdf4;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
@media (max-width: 700px) and (orientation: portrait) {
  .rotate-hint { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  #ticker-inner { animation: none; }
  html { scroll-behavior: auto; }
}
