/* =========================================================
   Oyunyap — Mobile-First Reset
   Single stylesheet, dark theme, zero dependencies.
   Designed so the same CSS works as a web app AND as a
   Capacitor-wrapped APK shell. Max-width 480 keeps desktop
   preview looking like a phone.
   ========================================================= */

:root {
  color-scheme: dark;
  --bg: #0a0b10;
  --bg-elev: #14161e;
  --bg-elev-2: #1b1e28;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f6fb;
  --muted: rgba(244, 246, 251, 0.62);
  --dim: rgba(244, 246, 251, 0.38);
  --accent: #ff8a3d;
  --accent-2: #ff4d6d;
  --accent-grad: linear-gradient(135deg, #ff8a3d, #ff4d6d);
  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;
  --ok: #4ade80;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          Inter, "Helvetica Neue", Arial, sans-serif;
  --tab-height: 68px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(ellipse at top, rgba(255, 138, 61, 0.12), transparent 40%),
    radial-gradient(ellipse at bottom left, rgba(255, 77, 109, 0.08), transparent 30%),
    var(--bg);
  background-attachment: fixed;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

a { color: var(--accent); }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 0.78rem; }
.eyebrow {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 6px;
}
.hidden { display: none !important; }

/* ========== App shell ========== */

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: calc(10px + var(--safe-top)) 0 calc(var(--tab-height) + var(--safe-bottom));
  position: relative;
}

body[data-route="challenge"] #app { padding-bottom: 0; }

.view {
  display: none;
  padding: 4px 16px 0;
  animation: fade-in 0.28s ease;
}
.view.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

/* ========== Top bar ========== */

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
  min-width: 0;
}

.top-bar-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.top-bar-title h1 {
  font-size: 1.5rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-title .tiny {
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-spacer { flex: 0 0 auto; width: 44px; height: 44px; }

/* Keep the "+ Yeni" pill button from stretching and eating the title. */
.top-bar .btn-pill {
  flex: 0 0 auto;
  max-width: 140px;
}

.back-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: background 0.18s ease;
}
.back-btn:active { background: var(--bg-elev-2); }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: background 0.18s ease;
}
.icon-btn:active { background: var(--bg-elev-2); }

/* ========== Feed search bar ========== */

.search-wrap {
  position: relative;
  margin: 0 0 12px;
}
.search-wrap input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 40px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.7;
  pointer-events: none;
}

/* ========== Category chip row ========== */

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 12px;
  margin: 0 -4px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row .chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.chip-row .chip:active { background: var(--bg-elev-2); }
.chip-row .chip.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: #180604;
}

/* ========== Card grid (feed) ========== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 24px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  cursor: pointer;
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:active { transform: scale(0.98); }
.card:hover { border-color: rgba(255, 138, 61, 0.35); }

.card-cover {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.card-cover.is-gradient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 45%),
    linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.35) 100%);
}

.preset-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--accent);
  border-radius: 4px;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.card-meta {
  padding: 10px 12px 12px;
  background: rgba(9, 10, 15, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  z-index: 2;
}
.card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.card-stats .creator {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-stats .likes {
  color: var(--accent-2);
  font-weight: 700;
  flex: 0 0 auto;
}

/* ========== Buttons ========== */

.btn {
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  border: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.14s ease, opacity 0.14s ease, background 0.14s ease;
  padding: 0 20px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.btn-primary {
  background: var(--accent-grad);
  color: #180604;
  box-shadow: 0 12px 30px rgba(255, 77, 109, 0.28);
}
.btn-primary:active { box-shadow: 0 6px 14px rgba(255, 77, 109, 0.22); }

.btn-ghost {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:active { background: var(--bg-elev-2); }
.btn-ghost.has-chev { justify-content: space-between; }
.btn-ghost .chev {
  margin-left: auto;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}
.btn-ghost strong { color: var(--text); font-weight: 800; }

.btn-secondary {
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}
.btn-secondary:active { background: var(--bg-elev); }

/* Create view: textarea on top, Gönder button below (stacked).
   Flex row caused the textarea to collapse and the Gönder button to
   swallow the full width; stacking keeps the textarea visible and the
   button compact below it. */
.create-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.create-input-row .field-textarea {
  width: 100%;
  margin-bottom: 0;
}
.create-input-row .send-idea-btn {
  align-self: flex-end;
  padding: 8px 22px;
  white-space: nowrap;
  font-size: 0.9rem;
  min-height: unset;
  max-width: 180px;
}

/* User draft bubble in create-chat (idea thread — solo user, no agent reply) */
.idea-thread-bubble {
  align-self: flex-end;
  max-width: 82%;
  background: linear-gradient(135deg, rgba(255, 150, 77, 0.85), rgba(255, 77, 109, 0.85));
  color: #180604;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  margin: 4px 0;
  font-size: 0.95rem;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.15);
}
.idea-thread-bubble .eyebrow {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #06150b;
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.25);
}
.btn-whatsapp:active { background: var(--whatsapp-dark); color: #fff; }

.btn-pill {
  width: auto;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #180604;
  font-size: 0.88rem;
  font-weight: 800;
  flex: 0 0 auto;
}

/* ========== Fields ========== */

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.field > span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }

.field-textarea textarea {
  resize: none;
  min-height: 110px;
  line-height: 1.4;
}

/* ========== Create view ========== */

.create-body {
  display: grid;
  gap: 14px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
}
.chip:active { background: var(--bg-elev-2); }

#preset-open-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
#preset-open-btn .chev {
  color: var(--muted);
  font-size: 1.3rem;
}
#preset-open-btn strong { color: var(--accent); }

.warning-line {
  background: rgba(255, 206, 107, 0.08);
  border: 1px solid rgba(255, 206, 107, 0.22);
  color: #ffce6b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.status-line {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.status-line.is-error { color: #ffa8a8; border-color: rgba(255, 168, 168, 0.3); background: rgba(255, 80, 80, 0.08); }

/* Aippy-style create chat — stage cards that animate from pending to
   active to done while the pipeline runs. Replaces the old
   progress-pill. */
.create-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px 14px;
  max-height: 60vh;
  overflow-y: auto;
}
.create-chat.hidden { display: none; }

.cchat-bubble {
  align-self: flex-end;
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  background: var(--bg-elev-2);
  color: var(--text);
  border-bottom-right-radius: 6px;
}

.cchat-agent-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.95rem;
}
.cchat-agent-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.95rem;
}

.cchat-assistant-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 2px 2px 4px;
  white-space: pre-wrap;
}

.cchat-question {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.cchat-question-title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}
.cchat-question-body {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.cchat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.cchat-option-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 138, 61, 0.08);
  border: 1px solid rgba(255, 138, 61, 0.35);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cchat-option-chip:hover,
.cchat-option-chip:active {
  background: rgba(255, 138, 61, 0.18);
}

.cchat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  align-self: flex-start;
}

.cchat-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.cchat-stage.is-active {
  color: var(--text);
  border-color: rgba(255, 138, 61, 0.35);
  background: rgba(255, 138, 61, 0.06);
}
.cchat-stage.is-done {
  color: var(--text);
  border-color: rgba(90, 220, 150, 0.28);
  background: rgba(90, 220, 150, 0.05);
}
.cchat-stage-icon { font-size: 1.1rem; }
.cchat-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3fcf8e;
  color: #0a1410;
  font-weight: 900;
  font-size: 0.82rem;
}
.cchat-check.big {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}
.cchat-stage-label {
  flex: 1 1 auto;
  min-width: 0;
}
.cchat-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 138, 61, 0.25);
  border-top-color: var(--accent);
  animation: cchat-spin 0.8s linear infinite;
}
@keyframes cchat-spin {
  to { transform: rotate(360deg); }
}

.cchat-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}
.cchat-footer.is-done {
  border-color: rgba(90, 220, 150, 0.45);
  background: rgba(90, 220, 150, 0.08);
  color: var(--text);
}
.cchat-footer.is-done > div { display: flex; flex-direction: column; gap: 2px; }
.cchat-footer.is-error {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 80, 80, 0.08);
  color: #ffc8c8;
}
.cchat-orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), #9a7bff, var(--accent));
  animation: cchat-spin 2s linear infinite;
  flex: 0 0 18px;
}

/* While a generation is submitted, collapse the input wrap so the stage
   chat takes the visual focus — same trick Aippy uses to scroll the
   prompt up into chat history. */
.create-input-wrap.is-submitted .field-textarea,
.create-input-wrap.is-submitted .create-actions {
  display: none;
}
.create-input-wrap.is-submitted #generate-btn {
  margin-top: 6px;
  opacity: 0.5;
  pointer-events: none;
}

.create-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
.preset-sub-line {
  text-align: left;
  margin: 2px 0 0 2px;
}
.preset-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px !important;
  font-size: 0.92rem;
}
.preset-mini strong { color: var(--accent); }
.preset-mini .chev { color: var(--muted); font-size: 1.2rem; }

.patience-slider {
  margin-top: 8px;
  padding: 12px;
  background: rgba(255,138,0,0.06);
  border: 1px solid rgba(255,138,0,0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.patience-slider label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.patience-slider label strong { color: var(--accent); font-size: 0.9rem; }
.patience-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.patience-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 0 2px;
}

/* ========== Play view ========== */

#play-view { padding: 4px 12px 0; }
.play-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 12px;
}
.play-bar .play-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 180px);
  background: #04060a;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 100%;
}
#game-frame, #challenge-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #04060a;
}

.play-hint {
  position: absolute;
  inset: auto 0 0;
  padding: 18px 20px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.88) 100%);
  pointer-events: none;
  color: var(--text);
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.play-hint > div { max-width: 80%; }
.play-hint.is-fading { opacity: 0; transition: opacity 0.35s ease; }

.play-score {
  text-align: center;
  padding: 10px 0;
}

.share-cta {
  margin: 8px 0 16px;
  /* Pulse the outer glow so users immediately notice the viral loop CTA */
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.3);
  animation: share-glow 2.4s ease-in-out infinite;
}
.share-cta:active { animation: none; }
.share-cta .icon { font-size: 1.3rem; }

@keyframes share-glow {
  0%, 100% { box-shadow: 0 10px 22px rgba(37, 211, 102, 0.25); }
  50%      { box-shadow: 0 18px 40px rgba(37, 211, 102, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
  .share-cta { animation: none; }
}

/* "Bu oyunu geliştir" CTA — secondary action below the WhatsApp CTA. */
.iterate-cta {
  margin: 4px 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 138, 61, 0.35);
  background: rgba(255, 138, 61, 0.08);
  color: var(--text);
}
.iterate-cta .icon { font-size: 1.15rem; }
.iterate-cta:active {
  background: rgba(255, 138, 61, 0.18);
}

/* Aippy-style segmented toggle in the play bar.
   "Sohbet | Önizleme" — only one button is active at a time. */
.segmented {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  max-width: 240px;
  margin: 0 auto;
}
.seg-btn {
  flex: 1 1 0;
  padding: 8px 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.seg-btn.active {
  background: var(--text);
  color: #0a0b10;
}

.play-title-strip {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
  margin: 4px 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-mode-pane.hidden { display: none; }

/* Chat pane — full-height conversation panel that replaces the iframe
   when the user toggles to "Sohbet". Per-game persistent thread. */
.chat-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 220px);
}
.chat-history {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px 16px;
  max-height: calc(100vh - 280px);
}
.chat-history::-webkit-scrollbar { width: 4px; }
.chat-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.generation-summary {
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}
.gen-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gen-label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gen-value {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-empty {
  text-align: center;
  padding: 32px 18px;
  color: var(--muted);
}
.chat-empty-emoji {
  font-size: 2.6rem;
  margin-bottom: 12px;
}
.chat-empty p { margin: 4px 0; }
.chat-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}

.chat-bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0b10;
  border-bottom-right-radius: 6px;
  font-weight: 600;
}
.chat-agent {
  align-self: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.chat-bubble.is-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 138, 61, 0.08);
  border: 1px solid rgba(255, 138, 61, 0.3);
  color: var(--accent);
  font-size: 0.88rem;
  font-style: italic;
  align-self: flex-start;
}
.chat-bubble.is-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: chat-status-pulse 1.2s ease-in-out infinite;
}
@keyframes chat-status-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1.1); }
}
.chat-bubble.is-error {
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.4);
  color: #ffaaaa;
  align-self: stretch;
  max-width: 100%;
}
.chat-bubble.is-version {
  align-self: stretch;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.version-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.18), rgba(255, 77, 109, 0.14));
  border: 1px solid rgba(255, 138, 61, 0.45);
  border-radius: 16px;
}
.version-emoji { font-size: 1.6rem; }
.version-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.version-arrow {
  font-size: 1.6rem;
  color: var(--accent);
}

/* ---------- Aippy-style persistent chat kinds (server-side chat_history) --- */

.chat-bubble .turn-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.chat-bubble .turn-body {
  white-space: pre-wrap;
}
.chat-bubble.is-initial-prompt {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0b10;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 24px rgba(255, 138, 61, 0.18);
}
.chat-bubble.is-initial-prompt .turn-badge {
  background: rgba(10, 11, 16, 0.25);
  color: #0a0b10;
}
.chat-bubble.is-iteration {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.9), rgba(255, 77, 109, 0.85));
  color: #0a0b10;
  border-bottom-right-radius: 6px;
}
.chat-bubble.is-iteration .turn-badge {
  background: rgba(10, 11, 16, 0.25);
  color: #0a0b10;
}
.chat-bubble.is-done {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.3);
  color: #74e8a0;
  font-size: 0.9rem;
  padding: 9px 13px;
}
.chat-bubble.is-done .turn-badge {
  background: transparent;
  padding: 0;
  font-size: 1rem;
}

/* ---------- Multiplayer room UI ---------- */

.mp-room-badge {
  display: inline-block;
  margin: 6px auto 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #74e8a0;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.35);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.mp-code-display {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-align: center;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.14), rgba(37, 211, 102, 0.04));
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #74e8a0;
}

.mp-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}
.mp-players .mp-player {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text);
}
.mp-players .mp-player.is-host::before {
  content: "👑 ";
}
.mp-players .mp-player.is-you {
  border-color: var(--accent);
  color: var(--accent);
}

.mp-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.mp-divider::before, .mp-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.mp-join-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: -4px;
}
.mp-join-input {
  width: 100%;
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
}
.mp-join-input:focus {
  border-color: var(--accent);
}

.mp-error {
  padding: 10px 12px;
  margin-top: 6px;
  border-radius: 12px;
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.35);
  color: #ffaaaa;
  font-size: 0.85rem;
}

/* ---------- Spectator overlay (full live canvas stream) ---------- */

.spectator-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000;
  pointer-events: auto;
  border-radius: inherit;
  overflow: hidden;
  animation: spectator-in 0.25s ease-out;
}
@keyframes spectator-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* The live video: full-size JPEG that gets swapped ~7 fps */
.spectator-stream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.spectator-stream:not([src]),
.spectator-stream[src=""] {
  opacity: 0;
}

/* Floating HUD (top-left): avatar + name + "oynuyor" */
.spectator-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, 0.4);
  z-index: 2;
}
.spectator-hud-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.3), rgba(255, 77, 109, 0.18));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  animation: spectator-pulse 2s ease-in-out infinite;
}
@keyframes spectator-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); box-shadow: 0 0 12px rgba(255, 138, 61, 0.5); }
}
.spectator-hud-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.spectator-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.spectator-status {
  font-size: 0.62rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 2px;
}

/* Floating score pill (top-right) */
.spectator-score-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  padding: 7px 14px;
  background: rgba(10, 11, 16, 0.78);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  z-index: 2;
}
.spectator-score-label {
  font-size: 0.58rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.spectator-score {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fde047;
  font-family: ui-monospace, "SF Mono", monospace;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}
.spectator-score.is-bump {
  transform: scale(1.2);
  color: #ff8a3d;
}

/* Bottom bar with hint + animated dots */
.spectator-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px 14px;
  background: linear-gradient(to top, rgba(10, 11, 16, 0.95), rgba(10, 11, 16, 0));
  z-index: 2;
  text-align: center;
}
.spectator-hint {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.spectator-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.spectator-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: spectator-dot 1.4s infinite;
}
.spectator-dots span:nth-child(2) { animation-delay: 0.2s; }
.spectator-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes spectator-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40%           { opacity: 1; transform: scale(1.3); }
}

/* Placeholder shown before the first frame arrives (connecting state) */
.spectator-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle at center, #14161e, #0a0b10);
  text-align: center;
  z-index: 1;
}
.spectator-placeholder-emoji {
  font-size: 3rem;
  animation: spectator-pulse 1.5s ease-in-out infinite;
}
.spectator-placeholder-text {
  font-size: 0.9rem;
  color: var(--muted);
}
.spectator-stream[src]:not([src=""]) + .spectator-hud ~ .spectator-placeholder,
.spectator-overlay.has-stream .spectator-placeholder {
  display: none;
}

/* ---------- Celebration overlay (winner/loser with confetti) ---------- */

.celebration-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: radial-gradient(circle at center, rgba(13, 15, 22, 0.94), rgba(10, 11, 16, 0.99));
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  overflow: hidden;
  border-radius: inherit;
}
.celebration-card {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 28px 22px;
  min-width: 280px;
  max-width: 340px;
  background: linear-gradient(135deg, rgba(30, 22, 16, 0.94), rgba(18, 14, 20, 0.94));
  border: 1px solid rgba(255, 138, 61, 0.45);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: celebration-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celebration-pop {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.celebration-emoji {
  font-size: 4.5rem;
  margin-bottom: 6px;
  animation: celebration-bounce 0.8s ease-in-out;
}
@keyframes celebration-bounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-10px) rotate(5deg); }
}
.celebration-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
  text-shadow: 0 4px 20px rgba(255, 138, 61, 0.4);
}
.celebration-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.celebration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: all 0.3s;
}
.celebration-row.is-winner {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(37, 211, 102, 0.08));
  border-color: rgba(37, 211, 102, 0.5);
  transform: scale(1.05);
}
.celebration-row.is-winner::before {
  content: "👑 ";
  font-size: 1.2rem;
}
.celebration-name {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.celebration-points {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fde047;
  font-family: ui-monospace, "SF Mono", monospace;
}
.celebration-overlay .btn { width: 100%; margin-top: 6px; }

/* Simple CSS confetti: 30 colored squares falling from top */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti::before,
.confetti::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle 4px at 10% -10%, #ff8a3d, transparent),
    radial-gradient(circle 4px at 25% -10%, #25d366, transparent),
    radial-gradient(circle 4px at 40% -10%, #fde047, transparent),
    radial-gradient(circle 4px at 55% -10%, #ff4d6d, transparent),
    radial-gradient(circle 4px at 70% -10%, #38bdf8, transparent),
    radial-gradient(circle 4px at 85% -10%, #a855f7, transparent);
  animation: confetti-fall 2.8s linear infinite;
}
.confetti::after {
  animation-delay: -1.4s;
  filter: hue-rotate(40deg);
}
@keyframes confetti-fall {
  0%   { transform: translateY(-10%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(120%); opacity: 0; }
}

/* ---------- Versus-turn banner (solo games played head-to-head) ---------- */

.turn-banner {
  margin: 8px 16px 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.14), rgba(255, 77, 109, 0.08));
  border: 1px solid rgba(255, 138, 61, 0.45);
  text-align: center;
  animation: invite-banner-slide 0.25s ease-out;
}
.turn-banner-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 2px;
}
.turn-banner-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.turn-banner-sub strong { color: var(--text); }

.turn-banner-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 12px 0 8px;
}
.score-col {
  min-width: 80px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.score-col.is-win {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.18), rgba(37, 211, 102, 0.05));
  border-color: rgba(37, 211, 102, 0.5);
}
.score-col .score-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.score-col .score-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.score-vs {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.turn-banner-actions {
  margin-top: 8px;
}
.turn-banner-actions .btn {
  min-width: 200px;
}

/* ---------- MP-active mode: hide solo CTAs, show game chat ---------- */

/* By default the in-game chat strip is hidden; it only appears when
   body[data-mp-active="true"] (both players connected). */
.game-chat-strip { display: none; }

body[data-mp-active="true"] .share-cta,
body[data-mp-active="true"] .iterate-cta,
body[data-mp-active="true"] #share-whatsapp-cta,
body[data-mp-active="true"] #open-chat-btn {
  display: none !important;
}
body[data-mp-active="true"] .invite-banner-actions {
  /* Once both players are in, the share/copy buttons are no longer
     the primary CTA — shrink the action row. */
  display: none;
}
body[data-mp-active="true"] .invite-banner {
  padding: 10px 14px;
}
body[data-mp-active="true"] .invite-banner-footer {
  border-top: 0;
  padding-top: 0;
}
body[data-mp-active="true"] .game-chat-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 16px 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  animation: invite-banner-slide 0.25s ease-out;
}
.game-chat-history {
  max-height: 110px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  padding-right: 4px;
}
.game-chat-history:empty { display: none; }
.game-chat-msg {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.35;
  word-break: break-word;
}
.game-chat-msg .who {
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.game-chat-msg.is-self .who { color: var(--whatsapp); }
.game-chat-msg .body { color: var(--text); flex: 1; }
.game-chat-reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.game-chat-reactions .reaction {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  border-radius: 12px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.game-chat-reactions .reaction:hover { background: var(--bg-elev); }
.game-chat-reactions .reaction:active { transform: scale(0.92); }
.game-chat-input-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
#game-chat-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}
#game-chat-input:focus { border-color: var(--accent); }
#game-chat-send {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  cursor: pointer;
}

/* ---------- One-tap multiplayer invite banner ---------- */

.invite-banner {
  margin: 10px 16px 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.16), rgba(255, 77, 109, 0.10));
  border: 1px solid rgba(255, 138, 61, 0.45);
  box-shadow: 0 10px 30px rgba(255, 138, 61, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: invite-banner-slide 0.25s ease-out;
}
@keyframes invite-banner-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.invite-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.invite-banner-text { flex: 1; min-width: 0; }
.invite-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.invite-banner-sub {
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
}
.invite-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: mp-dot-pulse 1.2s ease-in-out infinite;
}
.invite-dot.is-ready {
  background: #25d366;
  animation: none;
}
.invite-banner-actions {
  display: flex;
  gap: 8px;
}
.invite-banner-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 12px 10px;
  font-size: 0.92rem;
}
.invite-banner-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 138, 61, 0.2);
}
.invite-banner-footer strong {
  color: var(--accent);
  letter-spacing: 0.15em;
  font-family: ui-monospace, "SF Mono", monospace;
}
.invite-mini-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}
.invite-mini-btn:hover { color: #ffaaaa; }

/* "Oyuncu bekleniyor" pulsing status strip inside the MP drawer */
.mp-wait-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 138, 61, 0.08);
  border: 1px solid rgba(255, 138, 61, 0.35);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
}
.mp-wait-status .mp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: mp-dot-pulse 1.2s ease-in-out infinite;
}
.mp-wait-status .mp-dot-green {
  background: #25d366;
  animation: none;
}
@keyframes mp-dot-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* ---------- Router decision preview drawer ---------- */

.route-card {
  padding: 16px;
  margin: 12px 0 8px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.12), rgba(255, 77, 109, 0.08));
  border: 1px solid rgba(255, 138, 61, 0.35);
}
.route-preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.route-preset-label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}
.route-preset-cost {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.15);
  color: #74e8a0;
  border: 1px solid rgba(37, 211, 102, 0.35);
}
.route-reason {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  opacity: 0.85;
}
.route-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.route-tags .tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.route-tags .tag.is-highlight {
  background: rgba(255, 138, 61, 0.14);
  border-color: rgba(255, 138, 61, 0.45);
  color: var(--accent);
}
.route-enriched {
  padding: 12px;
  margin: 10px 0;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.route-enriched-body {
  margin: 6px 0 0;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.78rem;
  color: #bae6fd;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  max-height: 220px;
  overflow-y: auto;
}
.route-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.chat-input-wrap {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 0 4px;
  background: var(--bg);
}
#chat-input {
  flex: 1 1 auto;
  resize: none;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}
#chat-input:focus {
  border-color: rgba(255, 138, 61, 0.55);
}
.chat-send {
  width: 48px !important;
  max-width: 48px;
  height: 48px;
  border-radius: 50% !important;
  padding: 0 !important;
  flex: 0 0 48px;
  font-size: 1.4rem;
}
.chat-hint { text-align: center; padding: 6px 0 10px; }

/* ========== Challenge view (public /g/{id}) ========== */

body[data-route="challenge"] #tabbar { display: none; }
body[data-route="challenge"] #app {
  max-width: 480px;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
#challenge-view { padding: 0; }
.challenge-frame-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  aspect-ratio: auto;
  height: 100dvh;
  max-height: 100dvh;
}

.challenge-splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 138, 61, 0.25), transparent 50%),
              var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  z-index: 120;
  gap: 14px;
  animation: fade-in 0.4s ease;
}
.challenge-splash h2 { font-size: 1.7rem; line-height: 1.15; max-width: 360px; }
.challenge-splash h2 span { color: var(--accent); }
.challenge-splash .challenge-score {
  font-size: 1rem;
  color: var(--muted);
}
.challenge-splash .challenge-score strong {
  color: var(--text);
  font-size: 2rem;
  display: block;
  margin-top: 6px;
}
.challenge-splash .btn {
  max-width: 340px;
  margin-top: 20px;
}
.challenge-splash.is-dismissing {
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.challenge-result {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 16, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 14px;
  z-index: 140;
  animation: fade-in 0.35s ease;
}
.challenge-result h2 { font-size: 1.7rem; }
.challenge-result-scores {
  display: flex;
  gap: 20px;
  padding: 18px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 10px 0 16px;
}
.challenge-result-scores > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}
.challenge-result-scores strong {
  font-size: 2rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.challenge-result .btn { max-width: 340px; }

/* ========== Global gen banner ========== */

.global-gen-banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  width: min(100%, 448px);
  padding: 12px 16px;
  background: rgba(255, 138, 61, 0.14);
  border: 1px solid rgba(255, 138, 61, 0.45);
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 90;
  box-shadow: 0 12px 36px rgba(255, 77, 109, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  animation: fade-in 0.3s ease;
}
.global-gen-banner.hidden { display: none !important; }

.global-gen-banner .banner-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.6);
  animation: pulse 1.2s ease-out infinite;
  flex: 0 0 auto;
}
.global-gen-banner .banner-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.global-gen-banner strong {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 800;
}
.global-gen-banner .banner-sub {
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-gen-banner .banner-chev {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
}

/* When the banner is showing success state (completed) */
.global-gen-banner.is-done {
  background: rgba(74, 222, 128, 0.14);
  border-color: rgba(74, 222, 128, 0.5);
  box-shadow: 0 12px 36px rgba(74, 222, 128, 0.22);
}
.global-gen-banner.is-done .banner-dot {
  background: #4ade80;
  animation: none;
}

.global-gen-banner.is-error {
  background: rgba(255, 110, 110, 0.12);
  border-color: rgba(255, 110, 110, 0.5);
  box-shadow: 0 12px 36px rgba(255, 77, 77, 0.2);
}
.global-gen-banner.is-error .banner-dot {
  background: #ff6e6e;
  animation: none;
}

/* ========== Tab bar ========== */

#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tab-height);
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 11, 16, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 4px;
  z-index: 80;
}
#tabbar > .tab {
  flex: 0 1 140px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#tabbar .tab .icon { font-size: 1.4rem; }
#tabbar .tab.active { color: var(--accent); }

/* ========== Modal (onboarding) ========== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  animation: fade-in 0.35s ease;
}
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  text-align: center;
}
.modal-card .btn { margin-top: 4px; }
.modal-emoji { font-size: 3rem; line-height: 1; }
.error {
  color: #ffa8a8;
  font-size: 0.85rem;
  margin: 0;
}

/* ========== Drawer (preset + share) ========== */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.25s ease;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.drawer-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 12px 20px calc(24px + var(--safe-bottom));
  display: grid;
  gap: 14px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slide-up 0.28s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.drawer-handle {
  width: 46px;
  height: 4px;
  background: var(--line-strong);
  border-radius: 999px;
  margin: 0 auto 4px;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-head h3 { font-size: 1.2rem; }
.drawer-sub { margin-bottom: 4px; }

.preset-list {
  display: grid;
  gap: 10px;
}
.preset-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease;
  width: 100%;
}
.preset-row:active { background: #1f2330; }
.preset-row.is-active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.14), rgba(255, 77, 109, 0.1));
}
.preset-row.is-premium {
  border-color: rgba(191, 149, 255, 0.35);
}
.preset-row.is-premium.is-active {
  border-color: #bf95ff;
  background: linear-gradient(135deg, rgba(140, 82, 255, 0.22), rgba(255, 77, 200, 0.15));
}
.preset-row-main { display: grid; gap: 3px; min-width: 0; }
.preset-row-main strong {
  font-size: 1rem;
  color: var(--text);
  font-weight: 800;
}
.preset-row-main span { color: var(--muted); font-size: 0.78rem; }
.preset-row-cost {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 138, 61, 0.12);
  border: 1px solid rgba(255, 138, 61, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.preset-row.is-premium .preset-row-cost {
  color: #c9a4ff;
  background: rgba(140, 82, 255, 0.15);
  border-color: rgba(191, 149, 255, 0.35);
}

.preset-group-header {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 8px;
  border-left: 3px solid var(--accent);
  margin: 8px 0 2px;
}
.preset-row.is-recommended {
  border-color: rgba(74, 222, 128, 0.35);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(37, 211, 102, 0.04));
}
.preset-row.is-recommended.is-active {
  border-color: #4ade80;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.18), rgba(37, 211, 102, 0.10));
}

/* ========== Share sheet ========== */

.share-preview {
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ========== Toast ========== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  z-index: 220;
  animation: fade-in 0.2s ease;
}

/* ========== Wider screens: keep the phone shell centered ========== */

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(ellipse at top, rgba(255, 138, 61, 0.10), transparent 50%),
      #050508;
  }
  #app {
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    border-radius: 40px;
    margin-top: 16px;
    margin-bottom: 16px;
    min-height: calc(100vh - 32px);
    overflow: hidden;
    background: var(--bg);
  }
  #tabbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    border-radius: 0 0 40px 40px;
    bottom: 16px;
  }
}

/* ============================================================
   SOCIAL LAYER (social.js) — coin pill, engagement rail,
   rewards drawer, save modal, toast stack.
   Colors pull from existing --accent / --surface vars.
   ============================================================ */

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 138, 0, 0.12);
  border: 1px solid rgba(255, 138, 0, 0.35);
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #ffcf71;
  cursor: pointer;
  position: relative;
  margin-right: 8px;
  transition: transform 120ms ease, background 120ms ease;
}
.coin-pill:hover { transform: translateY(-1px); background: rgba(255, 138, 0, 0.2); }
.coin-pill:active { transform: translateY(0); }
.coin-icon { font-size: 14px; }
.coin-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #ff3b5c;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg, #0a0b10);
  animation: coin-dot-pulse 1.6s ease-in-out infinite;
}
@keyframes coin-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* Engagement rail on card covers */
.eng-rail {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
}
.card-cover { position: relative; }
.eng-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 15, 20, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
  transition: transform 120ms ease, background 120ms ease;
}
.eng-btn:hover { background: rgba(15, 15, 20, 0.85); transform: scale(1.08); }
.eng-btn:active { transform: scale(0.95); }
.eng-btn.active { background: rgba(255, 138, 0, 0.3); }
.eng-ico { line-height: 1; display: inline-block; }
.eng-like.active .eng-ico { animation: heart-pop 320ms ease; }
@keyframes heart-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.save-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(67, 206, 162, 0.25);
  border: 1px solid rgba(67, 206, 162, 0.6);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 12px;
  z-index: 2;
}

/* Rewards drawer */
#rewards-drawer.drawer { z-index: 90; }
.rewards-sheet {
  padding: 12px 18px 24px;
  background: var(--surface, #0f1017);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  max-height: 86vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rewards-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rewards-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.rewards-balance strong {
  font-size: 28px;
  font-weight: 800;
  color: #ffcf71;
}
.rewards-coin-icon { font-size: 22px; }

.rewards-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: rgba(255, 138, 0, 0.08);
  border: 1px solid rgba(255, 138, 0, 0.2);
  border-radius: 14px;
}
.rewards-card-title { font-weight: 700; margin-bottom: 2px; }

.rewards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rewards-stat {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rewards-stat strong { font-size: 18px; }

.rewards-section { margin-top: 4px; }
.rewards-tx-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.rewards-tx-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 13px;
}
.tx-amount.pos { color: #6ee7b7; font-weight: 700; }
.tx-amount.neg { color: #ff9a9a; font-weight: 700; }
.rewards-tx-list .muted { background: transparent; padding: 8px 0; }

.center { text-align: center; }

/* Save "Devam Et / Yeni Başla" modal */
.save-modal-card {
  text-align: center;
  padding: 28px 22px;
}
.save-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.save-modal-actions .btn { width: 100%; }

/* Toast stack (multi-slot, top-right) */
.toast-stack {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  padding: 10px 14px;
  background: rgba(20, 22, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateX(80px);
  transition: opacity 220ms ease, transform 220ms ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  max-width: 70vw;
}
.toast-item.show { opacity: 1; transform: translateX(0); }
.toast-item.toast-success {
  border-color: rgba(110, 231, 183, 0.5);
  color: #6ee7b7;
}
.toast-item.toast-error {
  border-color: rgba(255, 138, 138, 0.5);
  color: #ff9a9a;
}
.toast-item.toast-info {
  border-color: rgba(150, 180, 255, 0.5);
  color: #cfe0ff;
}

/* ============================================================
   OYUNYAP REDESIGN v2 — 5-tab FAB nav, premium cards,
   profile/rewards/live views. Appended so it wins specificity
   over the legacy styles above.
   ============================================================ */

/* ---------- Tab bar: 5 slots + center FAB ---------- */
#tabbar.tabbar-5 {
  justify-content: space-around;
  gap: 0;
  padding-left: 8px;
  padding-right: 8px;
  position: fixed;
  overflow: visible;
}
#tabbar.tabbar-5 > .tab {
  flex: 1 1 0;
  max-width: 96px;
  position: relative;
}
#tabbar.tabbar-5 > .tab .icon { font-size: 1.3rem; }
#tabbar.tabbar-5 > .tab.active { color: var(--accent); }

.tab-badge {
  position: absolute;
  top: 6px;
  right: 18%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ff3b5c;
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 0 0 2px rgba(10, 11, 16, 0.9);
}
.tab-badge.hidden { display: none; }

#tabbar.tabbar-5 > .tab.tab-fab {
  flex: 0 0 68px;
  margin-top: -18px;
}
#tabbar.tabbar-5 > .tab.tab-fab .fab-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  box-shadow: 0 12px 28px rgba(229, 46, 113, 0.45),
              0 0 0 3px rgba(10, 11, 16, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  transition: transform 180ms ease;
}
#tabbar.tabbar-5 > .tab.tab-fab .fab-inner .icon {
  font-size: 1.8rem;
  line-height: 1;
}
#tabbar.tabbar-5 > .tab.tab-fab:active .fab-inner { transform: scale(0.92); }
#tabbar.tabbar-5 > .tab.tab-fab.active .fab-inner {
  box-shadow: 0 12px 28px rgba(229, 46, 113, 0.65),
              0 0 0 3px rgba(10, 11, 16, 0.9),
              0 0 0 6px rgba(229, 46, 113, 0.25);
}

/* ---------- Feed view: modern premium cards ---------- */
#feed-view .card-grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 12px 120px;
}
#feed-view .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
  text-align: left;
  display: flex;
  flex-direction: column;
}
#feed-view .card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 138, 0, 0.4);
}
#feed-view .card:active { transform: translateY(0); }
#feed-view .card .card-cover {
  aspect-ratio: 3 / 4;
  position: relative;
  border-radius: 0;
  margin: 0;
}
#feed-view .card .card-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55) 90%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
}
#feed-view .card .card-meta { padding: 10px 12px 12px; gap: 6px; }
#feed-view .card .card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#feed-view .card .card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
#feed-view .card .card-stats .creator {
  color: rgba(255, 255, 255, 0.55);
  text-transform: none;
  letter-spacing: 0;
}
#feed-view .card .card-stats .likes { color: #ff6e6e; font-weight: 700; }

#feed-view .eng-rail { top: 10px; right: 10px; gap: 10px; z-index: 3; }
#feed-view .eng-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
  background: rgba(15, 15, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
#feed-view .eng-btn.active {
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.35), rgba(229, 46, 113, 0.35));
  border-color: rgba(255, 138, 0, 0.7);
}
#feed-view .save-badge {
  bottom: auto;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, rgba(67, 206, 162, 0.7), rgba(24, 90, 157, 0.6));
  border: 0;
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  z-index: 3;
}
#feed-view .card .preset-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  z-index: 3;
  letter-spacing: 0;
  text-transform: none;
}
#feed-view #new-game-btn { display: none; }

/* ---------- Profile view ---------- */
#profile-view {
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 24px);
  overflow-y: auto;
}
.profile-hero {
  padding: 8px 20px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  box-shadow: 0 8px 24px rgba(229, 46, 113, 0.3);
}
#profile-view .profile-hero h2 { margin: 4px 0 0; font-size: 22px; font-weight: 800; }
.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-bronze { background: rgba(205, 127, 50, 0.15); color: #e9a66b; border-color: rgba(205, 127, 50, 0.4); }
.badge-silver { background: rgba(192, 192, 192, 0.15); color: #d8d8d8; border-color: rgba(192, 192, 192, 0.4); }
.badge-gold   { background: rgba(255, 215, 0, 0.15);  color: #ffd95e; border-color: rgba(255, 215, 0, 0.4); }
.badge-platinum { background: rgba(0, 229, 255, 0.15); color: #7dffff; border-color: rgba(0, 229, 255, 0.4); }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 0 16px 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}
.pstat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pstat strong { font-size: 22px; font-weight: 800; }

.profile-earnings {
  margin: 0 16px 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.12), rgba(229, 46, 113, 0.08));
  border: 1px solid rgba(255, 138, 0, 0.3);
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.profile-earnings strong { color: #ffcf71; font-size: 18px; }

.profile-segments { margin: 0 16px 12px; width: auto; }
.profile-content { padding: 0 16px; }
#profile-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; }
#profile-grid .card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
}
#profile-grid .card .card-cover {
  aspect-ratio: 1 / 1;
  border-radius: 0;
  margin: 0;
  position: relative;
}
#profile-grid .card .card-meta { padding: 8px 10px 10px; }
#profile-grid .card .card-title {
  font-size: 12px;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 12px;
}

/* ---------- Rewards full view ---------- */
#rewards-view {
  padding: 0 16px calc(var(--tab-height) + var(--safe-bottom) + 24px);
  overflow-y: auto;
}
.rewards-hero { text-align: center; padding: 12px 0 8px; }
.rewards-hero-balance {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.rewards-hero-balance strong {
  font-size: 48px;
  font-weight: 900;
  color: #ffcf71;
  letter-spacing: -1px;
}
.rewards-hero-ico { font-size: 32px; }

.rewards-card-big {
  padding: 16px;
  margin: 16px 0;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.12), rgba(67, 206, 162, 0.08));
  border: 1px solid rgba(255, 138, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 14px;
}
.rewards-card-big .rewards-card-mid { flex: 1 1 auto; }

.rewards-ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.rewards-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 5; }
.ring-progress {
  fill: none;
  stroke: #ffcf71;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 163;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 400ms ease;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.rewards-howto {
  margin: 16px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.rewards-howto h4 { margin: 0 0 10px; font-size: 14px; }
.rewards-howto ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}
.rewards-howto b { color: #ffcf71; font-weight: 800; }

.rewards-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}
.rewards-section-head h4 { margin: 0; font-size: 14px; }

.withdraw-cta {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-weight: 800;
}
.withdraw-cta:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Live view ---------- */
#live-view {
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 24px);
  overflow-y: auto;
}
.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #ff3b5c;
  border-radius: 50%;
  margin-right: 6px;
  animation: live-pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes live-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.6); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(255, 59, 92, 0); }
}
.live-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}
.live-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.live-card .live-cover {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, #43cea2, #185a9d);
  flex-shrink: 0;
}
.live-card .live-meta { flex: 1 1 auto; min-width: 0; }
.live-card .live-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-card .live-sub { font-size: 12px; color: rgba(255, 255, 255, 0.55); }
.live-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}
.live-status.open { color: #6ee7b7; }
.live-status.starting { color: #ffcf71; }
.live-status.full { color: #ff6e6e; }
.live-card .btn { flex-shrink: 0; }

.live-empty {
  text-align: center;
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.live-empty-emoji { font-size: 56px; }
.live-empty h3 { margin: 0; font-size: 18px; }
.live-empty p { margin: 0; max-width: 280px; }

.btn.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ============================================================
   REDESIGN v2 FIXES — tab SVG icons, profile banner+hero,
   segment overflow fix, premium visual polish.
   ============================================================ */

/* Tab SVG icons replace emoji for consistent brand color */
#tabbar.tabbar-5 .tab-svg {
  width: 22px;
  height: 22px;
  color: currentColor;
  stroke: currentColor;
  display: block;
  margin-bottom: 2px;
}
#tabbar.tabbar-5 > .tab {
  color: rgba(255, 255, 255, 0.55);
}
#tabbar.tabbar-5 > .tab.active {
  color: #ffcf71;
}
#tabbar.tabbar-5 > .tab .label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#tabbar.tabbar-5 > .tab.tab-fab .fab-inner svg {
  width: 26px;
  height: 26px;
  color: #fff;
  stroke: #fff;
}

/* ---------- Profile: full visual refresh ---------- */
#profile-view {
  position: relative;
  padding-top: 0;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 32px);
  overflow-y: auto;
  overflow-x: hidden;
}

.profile-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 138, 0, 0.45), transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(229, 46, 113, 0.45), transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(67, 206, 162, 0.25), transparent 60%),
    linear-gradient(180deg, #1a0f18, #0a0b10);
  z-index: 0;
  pointer-events: none;
}
.profile-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 55%, rgba(10, 11, 16, 0.85) 100%);
}

.profile-top {
  position: relative;
  z-index: 2;
  padding: 14px 16px;
  background: transparent;
  justify-content: flex-end;
  border-bottom: 0;
}
.profile-share-btn {
  background: rgba(10, 11, 16, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.profile-share-btn svg { width: 18px; height: 18px; }

.profile-hero {
  position: relative;
  z-index: 1;
  padding: 20px 20px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.profile-avatar-wrap {
  position: relative;
  padding: 4px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, #ff8a00, #e52e71, #ff8a00);
  animation: avatar-rotate 12s linear infinite;
}
@keyframes avatar-rotate {
  to { transform: rotate(360deg); }
}
.profile-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a0b10, #1a1f2e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  border: 3px solid #0a0b10;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
}
#profile-view .profile-hero h2 {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.profile-handle-line {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
}
.profile-badge {
  margin-top: 4px;
  padding: 6px 14px;
  font-size: 12px;
}

.profile-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  margin: 20px 16px 14px;
  padding: 18px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pstat-divider {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.pstat strong {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #ff8a00, #ffcf71);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pstat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.profile-earnings {
  position: relative;
  z-index: 1;
  margin: 0 16px 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.16), rgba(229, 46, 113, 0.1));
  border: 1px solid rgba(255, 138, 0, 0.35);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(255, 138, 0, 0.1);
}
.earnings-label {
  display: flex;
  align-items: center;
  gap: 12px;
}
.earnings-label strong {
  color: #ffcf71;
  font-size: 22px;
  font-weight: 800;
  display: block;
  line-height: 1;
}
.earnings-ico {
  font-size: 28px;
  filter: drop-shadow(0 2px 8px rgba(255, 138, 0, 0.5));
}

/* Profile segments — horizontal scroll on overflow, no clipping */
.profile-segments-wrap {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 14px;
  padding: 0 16px;
}
.profile-segments-wrap::-webkit-scrollbar { display: none; }
.profile-segments {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  white-space: nowrap;
}
.pseg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms ease;
  flex-shrink: 0;
}
.pseg-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}
.pseg-btn.active {
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.25), rgba(229, 46, 113, 0.2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 138, 0, 0.2);
}
.pseg-ico { font-size: 14px; line-height: 1; }
.pseg-label { line-height: 1; }

.profile-content {
  position: relative;
  z-index: 1;
  padding: 0 16px;
}

.profile-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  color: rgba(255, 255, 255, 0.45);
}

/* Tighten .btn.tiny used for "Detay →" */
.btn.tiny {
  padding: 6px 10px;
  font-size: 12px;
  min-height: auto;
}

/* ============================================================
   Overflow fixes — feed chips + profile segments clip at right edge.
   Add scroll padding + gradient fade hint so cutoff feels intentional.
   ============================================================ */

#feed-view .chip-row {
  padding-right: 16px;
  padding-left: 12px;
  margin-left: 0;
  margin-right: 0;
  scroll-padding-right: 24px;
  position: relative;
}

#feed-view .chip-row .chip:last-child {
  margin-right: 4px;
}

.profile-segments-wrap {
  padding-right: 28px;
}
.profile-segments {
  padding-right: 4px;
}
.profile-segments::after {
  content: "";
  display: inline-block;
  width: 8px;
  flex: 0 0 auto;
}

/* ============================================================
   Definitive clip fix — last chip / last segment was being cut
   off because scroll container ended at viewport edge and no
   scroll-snap ensured full visibility.
   ============================================================ */

#feed-view .chip-row {
  padding-right: 48px !important;
  scroll-padding-inline-end: 48px;
  scroll-snap-type: x proximity;
}
#feed-view .chip-row > .chip:last-child {
  margin-right: 8px;
  scroll-snap-align: end;
}

.profile-segments-wrap {
  padding-right: 48px !important;
  scroll-padding-inline-end: 48px;
  scroll-snap-type: x proximity;
}
.profile-segments {
  padding-right: 12px;
}
.profile-segments .pseg-btn:last-child {
  scroll-snap-align: end;
  margin-right: 4px;
}

/* ============================================================
   TIKTOK-VARI DİKEY SLIDER FEED — her kart tam ekran, snap-y.
   Card-cover tüm ekrana full-bleed, overlay olarak engagement
   rail (sağ) + creator/title/stats (sol-alt) + preset badge (sol-üst)
   + save badge (sağ-üst).
   ============================================================ */

#feed-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-bottom: 0 !important;
  overflow: hidden;
  position: relative;
}

#feed-view > .top-bar {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(10, 11, 16, 0.85), rgba(10, 11, 16, 0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 0;
}

#feed-view > .search-wrap {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  margin: 0 12px 8px;
}

#feed-view > .chip-row {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  margin-bottom: 4px !important;
}

#feed-view #feed-grid {
  flex: 1 1 auto;
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none !important;
  gap: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
#feed-view #feed-grid::-webkit-scrollbar { display: none; }

#feed-view #feed-grid > .card {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 220px - var(--tab-height, 64px) - var(--safe-bottom, 0px));
  min-height: calc(100dvh - 220px - var(--tab-height, 64px) - var(--safe-bottom, 0px));
  border-radius: 0 !important;
  border: 0 !important;
  margin: 0 !important;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  display: block;
  padding-bottom: calc(var(--tab-height, 64px) + var(--safe-bottom, 0px));
  background: #000;
  transform: none;
}
#feed-view #feed-grid > .card:hover { transform: none !important; }

#feed-view #feed-grid > .card > .card-cover {
  position: absolute !important;
  inset: 0 !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  height: 100% !important;
  width: 100% !important;
  margin: 0 !important;
}

#feed-view #feed-grid > .card > .card-cover::before {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.35) 0%,
    transparent 20%,
    transparent 55%,
    rgba(0, 0, 0, 0.65) 88%,
    rgba(0, 0, 0, 0.9) 100%
  ) !important;
}

#feed-view #feed-grid > .card > .card-meta {
  position: absolute;
  left: 18px;
  right: 86px;
  bottom: calc(var(--tab-height, 64px) + var(--safe-bottom, 0px) + 24px);
  padding: 0 !important;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#feed-view #feed-grid > .card > .card-meta .card-title {
  font-size: 22px !important;
  line-height: 1.2 !important;
  font-weight: 800 !important;
  color: #fff !important;
  -webkit-line-clamp: 3 !important;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
  margin: 0 !important;
}
#feed-view #feed-grid > .card > .card-meta .card-stats {
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
  pointer-events: auto;
}
#feed-view #feed-grid > .card > .card-meta .card-stats .creator {
  font-size: 14px !important;
  color: rgba(255, 255, 255, 0.92) !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
#feed-view #feed-grid > .card > .card-meta .card-stats .likes {
  font-size: 13px !important;
  color: #ffb0b0 !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

/* Engagement rail: sağ kenarda dikey stack, tabbar üstünde */
#feed-view #feed-grid > .card .eng-rail {
  position: absolute !important;
  top: auto !important;
  right: 14px !important;
  bottom: calc(var(--tab-height, 64px) + var(--safe-bottom, 0px) + 24px) !important;
  left: auto !important;
  gap: 14px !important;
  z-index: 4;
  flex-direction: column;
  display: flex;
}
#feed-view #feed-grid > .card .eng-btn {
  width: 52px !important;
  height: 52px !important;
  font-size: 22px !important;
  background: rgba(10, 11, 16, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Preset badge: sol-üst overlay */
#feed-view #feed-grid > .card .preset-badge {
  top: 14px !important;
  left: 14px !important;
  right: auto !important;
  bottom: auto !important;
  background: rgba(10, 11, 16, 0.65) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 5px 10px !important;
  z-index: 4;
}

/* Save badge: sağ-üst */
#feed-view #feed-grid > .card .save-badge {
  top: 14px !important;
  left: auto !important;
  right: 14px !important;
  bottom: auto !important;
  z-index: 4;
}

/* Tap-to-play center hint (decorative, non-blocking) */
#feed-view #feed-grid > .card::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgba(10, 11, 16, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.18);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 2;
  opacity: 0.85;
  transition: transform 200ms ease, opacity 200ms ease;
}
#feed-view #feed-grid > .card:active::after {
  transform: scale(0.92);
  opacity: 1;
}

/* Empty state message in slider mode */
#feed-view #feed-grid > p.muted {
  padding: 60px 24px !important;
  text-align: center;
  align-self: center;
  margin: auto !important;
}

/* ============================================================
   Profile segments: tutarlı görünüm (inactive de belirgin)
   ============================================================ */
.pseg-btn {
  border: 1px solid transparent !important;
}
.pseg-btn:not(.active) {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
.pseg-btn.active {
  border-color: transparent !important;
}

/* ============================================================
   FEED MODE TOGGLE — slider (default, TikTok-style) <-> grid
   (browse, 2-column). body[data-feed-mode="grid"] revertler.
   ============================================================ */

/* Toggle butonu */
.feed-mode-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  margin-right: 8px;
  color: rgba(255, 255, 255, 0.8);
  transition: background 140ms ease, color 140ms ease;
}
.feed-mode-btn:hover {
  background: rgba(255, 138, 0, 0.15);
  color: #ffcf71;
}
.feed-mode-btn .feed-mode-ico {
  width: 18px;
  height: 18px;
  display: none;
}
/* Slider modundayken grid ikonu göster (grid moda geçiş aksiyonu) */
body[data-feed-mode="slider"] .feed-mode-btn .feed-mode-grid,
body:not([data-feed-mode]) .feed-mode-btn .feed-mode-grid {
  display: block;
}
/* Grid modundayken slider (telefon) ikonu göster */
body[data-feed-mode="grid"] .feed-mode-btn .feed-mode-slider {
  display: block;
}

/* =========================================
   GRID MODE — revert slider overrides
   ========================================= */
body[data-feed-mode="grid"] #feed-view {
  height: auto;
  overflow: auto;
  padding-bottom: calc(var(--tab-height, 64px) + var(--safe-bottom, 0px) + 24px) !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid {
  flex: 0 1 auto;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  padding: 0 12px 120px !important;
  overflow: visible;
  scroll-snap-type: none !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card {
  height: auto;
  min-height: 0;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)) !important;
  scroll-snap-align: none !important;
  overflow: hidden;
  padding-bottom: 0 !important;
  display: flex;
  flex-direction: column;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-cover {
  position: relative !important;
  inset: auto !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  width: 100% !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-cover::before {
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55) 90%, rgba(0, 0, 0, 0.85) 100%) !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-meta {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  padding: 10px 12px 12px !important;
  z-index: auto;
  pointer-events: auto;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-meta .card-title {
  font-size: 14px !important;
  color: #fff !important;
  text-shadow: none !important;
  -webkit-line-clamp: 2 !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-meta .card-stats .creator {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.55) !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card > .card-meta .card-stats .likes {
  color: #ff6e6e !important;
  font-size: 11px !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card .eng-rail {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  bottom: auto !important;
  gap: 10px !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card .eng-btn {
  width: 40px !important;
  height: 40px !important;
  font-size: 18px !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card .preset-badge {
  left: 10px !important;
  bottom: 10px !important;
  top: auto !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card .save-badge {
  left: 10px !important;
  top: 10px !important;
  right: auto !important;
}

body[data-feed-mode="grid"] #feed-view #feed-grid > .card::after {
  display: none;
}

/* ============================================================
   CRITICAL BUG FIX: earlier slider CSS set `#feed-view {display:flex}`
   without `.active` qualifier. Because ID selector wins over `.view`
   class, feed-view stayed visible (display:flex) even when inactive,
   overlapping profile/rewards/live views and eating their tab clicks.
   Scope all layout/sizing to `.active` so non-active views go back
   to `.view { display:none }` from the base sheet.
   ============================================================ */

#feed-view:not(.active) {
  display: none !important;
}

#rewards-view:not(.active),
#profile-view:not(.active),
#live-view:not(.active) {
  display: none !important;
}

/* Active feed-view retains slider layout */
#feed-view.active {
  display: flex !important;
}
