/* flatdeck - mobile-first, dark, one thumb. The card is the product.
 * Deck card layout ported from flat-radar's site/index.html (full card
 * parity, 2026-10-08): absolute cards in the stage, tap-through photo
 * set with the map as the last frame, back card behind the top one. */

:root {
  --bg: #14121f;
  --card: #201d33;
  --text: #efeef6;
  --muted: #9a96b5;
  --like: #58e08c;
  --nope: #ff7a7a;
  --accent: #8f86e8;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
}

.view { height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }
.error { color: #ff8f8f; font-size: 0.9rem; margin-top: 0.6rem; }
.spacer { flex: 1; }

.bar {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 1rem; padding-top: calc(0.7rem + env(safe-area-inset-top));
}
.link {
  background: none; border: none; color: #b9b4d6;
  font-size: 0.95rem; padding: 0.2rem 0.3rem; cursor: pointer;
}
.link:active { color: #fff; }

/* ---- login ---- */
#login { justify-content: center; align-items: center; }
.login-box { width: min(24rem, 88vw); }
.login-box h1 { font-size: 1.8rem; letter-spacing: 0.02em; }
.tag { margin: 0.4rem 0 1.6rem; color: var(--muted); }
#loginForm { display: flex; flex-direction: column; gap: 0.7rem; }
#loginForm input, .form-box input:not([type="checkbox"]) {
  background: #201d33; border: 1px solid #34304e; color: var(--text);
  border-radius: 0.6rem; padding: 0.8rem 0.9rem; font-size: 1rem; width: 100%;
}
#loginForm button, .form-box button {
  background: #6d5ef0; border: none; color: #fff; font-size: 1rem;
  border-radius: 0.6rem; padding: 0.8rem; cursor: pointer; margin-top: 0.4rem;
}
button:active { filter: brightness(1.2); }

/* ---- deck ---- */
.stage {
  flex: 1; min-height: 0; position: relative;
  width: 100%; max-width: 520px; margin: 0 auto; padding: 0 10px;
}
.card {
  position: absolute; inset: 10px 0 12px;
  background: var(--card); border-radius: 1.1rem;
  box-shadow: 0 1.2rem 3rem rgba(0,0,0,0.45);
  overflow: hidden; display: flex; flex-direction: column;
  touch-action: none; user-select: none; -webkit-user-select: none;
  z-index: 1; will-change: transform;
}
.card, .card * { touch-action: none; }
.card.back {
  transform: scale(0.94) translateY(10px); opacity: 0.5;
  pointer-events: none; transition: transform .2s, opacity .2s; z-index: 0;
}
.photo {
  position: relative; flex: 0 0 58%; flex-shrink: 0;
  background: linear-gradient(160deg, #2a2647, #191630); overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  gap: 6px; align-items: center; justify-content: center;
  color: #6e6a92; font-size: 13px;
}
.tapzone {
  position: absolute; top: 0; bottom: 0; width: 38%; z-index: 3;
  display: flex; align-items: center; padding: 10px;
  color: rgba(255,255,255,0.85); font-size: 26px;
  opacity: 0; transition: opacity .15s;
}
.tapzone.left { left: 0; justify-content: flex-start; }
.tapzone.right { right: 0; justify-content: flex-end; }
.photo .tapzone:active { opacity: 1; }
.counter {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  background: rgba(0,0,0,0.55); padding: 3px 9px;
  border-radius: 999px; font-size: 12px; color: #fff;
}
.loading {
  position: absolute; inset: 0; z-index: 2; display: none;
  align-items: center; justify-content: center; background: rgba(20,18,31,0.45);
}
.loading.on { display: flex; }
.loading .ring {
  width: 26px; height: 26px; border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pagebadge {
  position: absolute; bottom: 10px; left: 10px; z-index: 5;
  background: rgba(0,0,0,0.6); color: #fff; border-radius: 8px;
  padding: 5px 10px; font-size: 11px; letter-spacing: 0.04em; display: none;
}
.hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 5; background: rgba(0,0,0,0.6); color: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 11px; letter-spacing: 0.03em; display: none;
}
.stamp {
  position: absolute; top: 24px; z-index: 4; padding: 5px 12px;
  border: 3px solid; border-radius: 10px; font-weight: 800;
  font-size: 20px; letter-spacing: 0.06em;
  opacity: 0; transform: scale(0.7); pointer-events: none;
}
.stamp.love { left: 22px; color: var(--like); border-color: var(--like); transform: rotate(-12deg); }
.stamp.no { right: 22px; color: var(--nope); border-color: var(--nope); transform: rotate(12deg); }

.info { flex: 1; padding: 14px 16px 12px; overflow: hidden; }
.info h2 { font-size: 18px; font-weight: 650; line-height: 1.25; }
.meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px;
  color: var(--muted); font-size: 13px;
}
.price { color: var(--like); font-weight: 700; font-size: 17px; }
.score { font-weight: 700; color: var(--accent); }
.score.strong { color: var(--like); }
.fresh { color: var(--like); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chips span {
  background: #2a2647; color: #c9c4e8; font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0.02em;
}
.chips span.outdoor {
  background: transparent; border: 1px solid var(--like);
  color: var(--like); font-weight: 650;
}
.btns { display: flex; gap: 8px; margin-top: 10px; }
.open {
  display: inline-block; color: var(--accent); text-decoration: none;
  font-size: 13.5px; border: 1px solid #34304e;
  padding: 6px 12px; border-radius: 8px; touch-action: manipulation;
}
.more {
  background: none; border: 1px solid #34304e; color: var(--accent);
  font: inherit; font-size: 13.5px; padding: 6px 12px;
  border-radius: 8px; cursor: pointer; touch-action: manipulation;
}
.more:active { background: #262243; }

.done {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  gap: 8px; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 0 20px;
}

.actions {
  display: flex; justify-content: center; gap: 1.2rem;
  padding: 1rem 0 calc(1.2rem + env(safe-area-inset-bottom));
}
.act {
  width: 4.2rem; height: 4.2rem; border-radius: 50%;
  border: none; font-size: 1.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.act.no { background: #3a2036; color: var(--nope); }
.act.love { background: #1d3a2c; color: var(--like); font-size: 1.8rem; }
.act.skip { background: #262243; color: #b9b4d6; font-size: 1.3rem; }
.queued { text-align: center; color: #e0b95e; font-size: 0.8rem; padding-bottom: 0.4rem; }

/* ---- card detail overlay (deck parity) ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,18,31,0.96);
  display: none; align-items: center; justify-content: center;
}
.overlay.on { display: flex; }
.panel {
  position: relative; width: 88%; max-width: 360px;
  background: #1a1730; border: 1px solid #34304e;
  border-radius: 14px; padding: 16px;
}
.panel h3 { font-size: 16px; font-weight: 650; margin-bottom: 8px; padding-right: 44px; }
.panel .pmeta {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  color: var(--muted); font-size: 13px; margin-bottom: 8px;
}
.panel .ptext {
  font-size: 13.5px; color: var(--muted); line-height: 1.5;
  max-height: 44vh; overflow: auto;
}
.panel .popen { margin-top: 12px; display: inline-block; }
.panel .pclose {
  position: absolute; top: 10px; right: 10px; border: none;
  background: #34304e; color: #fff; border-radius: 50%;
  width: 34px; height: 34px; font-size: 15px;
  cursor: pointer; touch-action: manipulation;
}

/* ---- criteria ---- */
.form-box { width: min(24rem, 88vw); margin: 0 auto; overflow-y: auto; padding-bottom: 2rem; }
.form-box h2 { margin-bottom: 0.3rem; }
.form-box label { display: block; margin-top: 1rem; color: #c9c4e8; font-size: 0.9rem; }
.form-box .row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.3rem; }
.form-box .row input { width: 5rem; }
.form-box .check { display: flex; gap: 0.5rem; align-items: center; }
.form-box .check input { width: auto; }

/* ---- loved ---- */
.loved-list { overflow-y: auto; padding: 0 1rem 2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.loved-card {
  background: var(--card); border-radius: 0.8rem; padding: 0.8rem 1rem;
  display: flex; gap: 0.9rem; align-items: center;
}
.loved-card img { width: 4.5rem; height: 3.4rem; object-fit: cover; border-radius: 0.5rem; background: #2a2647; }
.loved-card a { color: var(--text); text-decoration: none; font-weight: 600; }
.loved-card .price { font-size: 1rem; }

@media (max-height: 700px) {
  .photo { flex: 0 0 50%; }
  .info h2 { font-size: 16px; }
  .meta { font-size: 12px; }
}
@media (hover: hover) {
  .tapzone:hover { opacity: 1; }
  .more:hover { background: #262243; }
}
