/* ================================================
   TwoSense — Minihry
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

/* ================================================
   THEME VARIABLES
   ================================================ */

:root {
  --bg: #ffffff;
  --surface: #faf9f7;
  --elevated: #f5f5f4;
  --text: #1c1917;
  --text-2: #78716c;
  --text-3: #a8a29e;
  --text-4: #c4c0bc;
  --text-5: #d6d3d1;
  --border: #e7e5e4;
  --border-2: #f5f5f4;
  --quote-accent: #d6d3d1;
  --quote-mark: rgba(28,25,23,0.06);
  --btn-bg: #1c1917;
  --btn-text: #faf9f7;
  --correct: #16a34a;
  --correct-soft: rgba(22,163,74,0.1);
  --wrong: #dc2626;
  --wrong-soft: rgba(220,38,38,0.1);
  --accent: #2563eb;
  --glow: rgba(0,0,0,0.08);
  --overlay-bg: rgba(0,0,0,0.4);
}

[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --elevated: #292524;
  --text: #faf9f7;
  --text-2: #a8a29e;
  --text-3: #78716c;
  --text-4: #57534e;
  --text-5: #44403c;
  --border: #292524;
  --border-2: #1c1917;
  --quote-accent: #57534e;
  --quote-mark: rgba(250,249,247,0.04);
  --btn-bg: #faf9f7;
  --btn-text: #0c0a09;
  --correct: #4ade80;
  --correct-soft: rgba(34,197,94,0.12);
  --wrong: #f87171;
  --wrong-soft: rgba(239,68,68,0.12);
  --glow: rgba(0,0,0,0.4);
  --overlay-bg: rgba(0,0,0,0.7);
}

/* ================================================
   VIEW TRANSITIONS (circular theme switch)
   ================================================ */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 9999; }

/* ================================================
   RESET & BASE
   ================================================ */

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ================================================
   THEME TOGGLE
   ================================================ */

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-3);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-icon--sun { display: none; }
.theme-icon--moon { display: block; }

[data-theme="dark"] .theme-icon--sun { display: block; }
[data-theme="dark"] .theme-icon--moon { display: none; }

/* ================================================
   TOP BAR (landing)
   ================================================ */

.topbar {
  padding: 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wordmark {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-4);
  transition: color 0.2s;
}

.wordmark:hover { color: var(--text); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-toggle {
  display: flex;
  gap: 0.6rem;
  font-size: 0.8rem;
}

.lang-toggle button {
  font-weight: 500;
  color: var(--text-4);
  padding: 0.2rem 0;
  border-bottom: 1.5px solid transparent;
  transition: all 0.15s;
}

.lang-toggle button:hover { color: var(--text-3); }

.lang-toggle .lang-switch__btn--active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ================================================
   LANDING
   ================================================ */

.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem 3rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.landing-head {
  text-align: center;
  margin-bottom: 3rem;
}

.landing-head h1 {
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 0.6rem;
}

.landing-head p {
  font-size: 1.05rem;
  color: var(--text-3);
  font-weight: 400;
}

/* ---- Tiles ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  width: 100%;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 18px;
  padding: 1.75rem 1.75rem 1.5rem;
  min-height: 180px;
  transition: transform 75ms ease-in-out, box-shadow 75ms ease-in-out;
  position: relative;
  overflow: hidden;
}

.tile:hover {
  transform: scale(1.023);
  box-shadow: 3px 6px 14px var(--glow);
}

.tile:active { transform: scale(1.01); }

.tile--cover {
  padding: 0;
  position: relative;
  grid-column: 1 / -1;
}

.tile-bg {
  width: 100%;
  display: block;
  border-radius: 18px;
}

.tile-overlay {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(to top, rgba(28,25,23,0.85) 0%, rgba(28,25,23,0.4) 55%, transparent 100%);
  pointer-events: none;
}

.tile-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 1;
  padding: 1.75rem;
}

.tile--cover .tile-title {
  color: #fff;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.tile--cover .tile-desc {
  color: rgba(255,255,255,0.8);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.5;
}

.tile--cover .tile-badge {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  backdrop-filter: blur(4px);
}

.tile-ktr { background: var(--surface); }
.tile-ktr:hover { background: var(--elevated); }

.tile-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.tile-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.55;
}

.tile-badge {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  background: var(--surface);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.tile--disabled {
  background: var(--surface);
  color: var(--text-5);
  cursor: default;
  pointer-events: none;
}

.tile--disabled .tile-title,
.tile--disabled .tile-desc { color: var(--text-5); }

.tile--disabled:hover { transform: none; box-shadow: none; }

/* ================================================
   FOOTER
   ================================================ */

.site-footer {
  padding: 2rem 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-5);
  margin-top: auto;
}

/* ================================================
   GAME PAGE
   ================================================ */

.game-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---- Game nav ---- */
.game-nav {
  padding: 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link {
  font-size: 0.85rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }

.game-nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress {
  font-size: 0.8rem;
  color: var(--text-4);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pbar {
  width: 90px;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.pbar-fill {
  height: 100%;
  background: var(--text-3);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Game area ---- */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 2.5rem 2.5rem;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

.screen { width: 100%; }
.screen--hidden { display: none !important; }

/* ---- Live score counter ---- */
.score-live {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  padding: 0.2rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 2rem;
  text-align: center;
  letter-spacing: -0.02em;
}

.score-live:empty { display: none; }

/* ---- Intro / Start screen ---- */
.intro {
  text-align: center;
  animation: rise 0.5s ease both;
}

.intro-banner {
  width: 100%;
  border-radius: 18px;
  margin: 0 auto 2.25rem;
  display: block;
  box-shadow: 0 16px 56px var(--glow);
  border: 1px solid var(--border);
}

.intro h1 {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.intro p {
  color: var(--text-2);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.btn-start {
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 1.05rem 3.5rem;
  border-radius: 14px;
  transition: transform 75ms ease-in-out, box-shadow 0.2s;
  box-shadow: 0 2px 16px var(--glow);
}

.btn-start:hover { box-shadow: 0 6px 32px var(--glow); }
.btn-start:active { transform: scale(0.97); }

/* ---- Quote screen ---- */
.quote-wrap {
  animation: rise 0.4s ease both;
  width: 100%;
}

.quote-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--quote-accent);
  border-radius: 18px;
  padding: 3rem 2.75rem;
  position: relative;
  overflow: hidden;
}

.quote-box::before {
  content: '\201C';
  position: absolute;
  top: 0.1rem;
  right: 1.25rem;
  font-size: 8rem;
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--quote-mark);
  line-height: 1;
  pointer-events: none;
}

.quote-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.8;
  color: var(--text);
  font-style: italic;
  position: relative;
}

.quote-text::before { content: '\201E'; color: var(--text-4); }
.quote-text::after { content: '\201C'; color: var(--text-4); }

/* ---- Choices ---- */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1.5rem;
  width: 100%;
}

.pick {
  padding: 1.3rem 1.5rem;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: transform 100ms ease-out, box-shadow 0.2s, opacity 0.15s;
}

.pick::before {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.pick--hl::before { content: 'H'; }
.pick--tr::before { content: 'T'; }

.pick:active { transform: scale(0.96); }

.pick--hl {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 3px 16px rgba(220,38,38,0.3);
}

.pick--hl:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(220,38,38,0.5);
  transform: translateY(-2px);
}

.pick--tr {
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  box-shadow: 0 3px 16px rgba(59,130,246,0.3);
}

.pick--tr:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(59,130,246,0.5);
  transform: translateY(-2px);
}

.pick:disabled { cursor: default; transform: none; }
.pick:disabled::before { opacity: 0.5; }

/* ---- Result reveal ---- */
.reveal {
  margin-top: 1.5rem;
  animation: rise 0.3s ease both;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
}

.reveal-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
}

.reveal-row.correct {
  color: var(--correct);
  background: var(--correct-soft);
}

.reveal-row.wrong {
  color: var(--wrong);
  background: var(--wrong-soft);
}

.reveal-author {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

.reveal-author strong { color: var(--text); }

.stat-bar-bg {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.stat-bar {
  height: 100%;
  background: var(--text-3);
  border-radius: 99px;
  width: 0;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-4);
}

.btn-next {
  display: block;
  margin: 1.75rem auto 0;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 2.5rem;
  border-radius: 12px;
  transition: box-shadow 0.2s, transform 75ms ease-in-out;
  animation: rise 0.3s ease 0.1s both;
}

.btn-next:hover { box-shadow: 0 4px 20px var(--glow); }
.btn-next:active { transform: scale(0.97); }

/* ---- End screen ---- */
.outro {
  text-align: center;
  animation: rise 0.5s ease both;
}

.outro-score {
  font-size: clamp(4.5rem, 14vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.outro-pct {
  color: var(--text-2);
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.outro-msg {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 2.25rem;
  color: var(--text-2);
}

.outro-grid {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 2.25rem;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

.outro-grid-dot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  animation: dotPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.outro-grid-dot--correct { background: #22c55e; }
.outro-grid-dot--wrong { background: #ef4444; }

@keyframes dotPop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.btn-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-pill {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.8rem 2rem;
  border-radius: 12px;
  transition: opacity 0.12s, transform 75ms ease-in-out, box-shadow 0.2s;
}

.btn-pill:active { transform: scale(0.97); }

.btn-pill--dark {
  background: var(--btn-bg);
  color: var(--btn-text);
}

.btn-pill--dark:hover { box-shadow: 0 4px 20px var(--glow); }

.btn-pill--accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}

.btn-pill--accent:hover { box-shadow: 0 4px 24px rgba(37,99,235,0.5); }

.btn-pill--ghost {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
}

.btn-pill--ghost:hover { border-color: var(--text-3); color: var(--text); }

/* ================================================
   DISCLAIMER
   ================================================ */

.disclaimer {
  margin-top: auto;
  padding: 1rem 2.5rem 0.25rem;
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
}

.disclaimer-inner {
  border-top: 1px solid var(--border-2);
  padding-top: 0.75rem;
  font-size: 0.7rem;
  line-height: 1.65;
  color: var(--text-5);
}

/* ================================================
   COOKIE BAR
   ================================================ */

.cookie-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border-2);
  padding: 0.75rem 2rem;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.35s ease;
}

.cookie-bar--visible { transform: translateY(0); }

.cookie-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-3);
}

.cookie-inner p { flex: 1; min-width: 200px; }
.cookie-btns { display: flex; gap: 0.4rem; }

.cookie-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  transition: opacity 0.12s;
}

.cookie-btn--yes { background: var(--btn-bg); color: var(--btn-text); }
.cookie-btn--no { color: var(--text-3); border: 1px solid var(--border); }

/* ================================================
   SHARE MODAL
   ================================================ */

.share-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.share-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  position: relative;
  animation: rise 0.3s ease both;
  box-shadow: 0 24px 64px var(--glow);
}

.share-close {
  position: absolute;
  top: 0.75rem; right: 1rem;
  font-size: 1.5rem;
  color: var(--text-4);
  line-height: 1;
  transition: color 0.15s;
}

.share-close:hover { color: var(--text); }

.share-preview {
  background: var(--elevated);
  border-radius: 14px;
  padding: 1.75rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.share-preview-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.1rem;
}

.share-preview-sub {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

.share-preview-score {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.share-preview-grid {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 240px;
  margin: 0 auto;
}

.share-preview-grid .outro-grid-dot {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  animation: none;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  color: var(--text-2);
  transition: all 0.15s;
}

.share-btn:hover { border-color: var(--text-4); background: var(--elevated); }
.share-btn:active { transform: scale(0.97); }

.share-btn--copy { grid-column: 1 / -1; }
.share-btn--x { color: var(--text); }
.share-btn--whatsapp { color: #25d366; }
.share-btn--download svg { flex-shrink: 0; }

.share-btn--copied {
  background: var(--correct-soft);
  border-color: var(--correct);
  color: var(--correct);
}

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 520px) {
  .topbar, .game-nav { padding: 1.25rem 1.5rem; }
  .landing { padding: 1rem 1.5rem 2rem; }
  .game-area { padding: 1.25rem 1.5rem; }
  .choices { grid-template-columns: 1fr; }
  .pick::before { display: none; }
  .quote-box { padding: 2.25rem 1.5rem; }
  .quote-box::before { font-size: 5rem; right: 0.75rem; }
  .tiles { grid-template-columns: 1fr; }
  .cookie-inner { flex-direction: column; text-align: center; }
  .cookie-btns { justify-content: center; }
  .share-modal { padding: 1.5rem; }
  .share-actions { grid-template-columns: 1fr; }
  .share-btn--copy { grid-column: 1; }
  .disclaimer { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
