:root {
  --bg: #07111f;
  --bg-soft: #0d1b2e;
  --panel: #111c2c;
  --panel-soft: #16243a;
  --panel-dark: #081321;
  --text: #eef6ff;
  --text-light: #eef6ff;
  --muted: #a8b5c7;
  --line: rgba(238, 246, 255, 0.14);
  --line-dark: rgba(238, 246, 255, 0.16);
  --accent: #4aa8ff;
  --accent-dark: #7bc0ff;
  --accent-deep: #176cc5;
  --green: #14935f;
  --red: #c93535;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

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

body {
  min-height: 100vh;
  color: var(--text);
  font-family: 'Inter', Arial, sans-serif;
  background:
    linear-gradient(140deg, #07111f 0%, #0d1b2e 58%, #111927 100%);
}

button,
a {
  font: inherit;
}

.app-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 56px;
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px auto;
  padding: 9px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  color: var(--text-light);
  background: rgba(13, 17, 23, 0.78);
  backdrop-filter: blur(18px);
}

.back-link,
.status-pill,
.score-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  font-weight: 800;
}

.back-link {
  padding: 0 14px;
  color: var(--text-light);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

.game-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.score-pill {
  padding: 0 12px;
  color: #e8f7ff;
  border: 1px solid rgba(68, 210, 214, 0.34);
  background: rgba(68, 210, 214, 0.1);
}

.status-pill {
  padding: 0 12px;
  color: var(--accent-dark);
  border: 1px solid rgba(74, 168, 255, 0.34);
  background: rgba(74, 168, 255, 0.1);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 0 28px;
}

.hero {
  max-width: 850px;
  margin-bottom: 12px;
  color: var(--text-light);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 6px;
  font-size: clamp(2.25rem, 5.8vw, 4.8rem);
  line-height: 0.94;
}

h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  line-height: 1.1;
}

.hero p:last-child {
  max-width: 720px;
  margin-top: 10px;
  color: rgba(248, 250, 252, 0.78);
  font-size: 1rem;
  line-height: 1.65;
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.image-stage,
.guess-panel,
.error-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow), 0 0 0 1px rgba(74, 168, 255, 0.04);
  backdrop-filter: blur(18px);
}

.image-stage {
  padding: 16px;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.post-meta a {
  color: var(--accent-dark);
  text-decoration: none;
}

.post-meta a:hover {
  text-decoration: underline;
}

#post-title {
  margin-bottom: 14px;
}

.image-frame {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(74, 168, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(74, 168, 255, 0.06), transparent 42%),
    #050b14;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.34);
}

.image-frame a {
  width: 100%;
}

.image-frame img {
  width: 100%;
  max-height: none;
  object-fit: contain;
}

.image-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(248, 250, 252, 0.68);
  font-weight: 900;
  background: var(--panel-dark);
}

.image-placeholder.hidden {
  display: none;
}

.guess-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.guess-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.keyboard-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.keyboard-hints span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 19, 33, 0.58);
}

kbd {
  min-width: 24px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(123, 192, 255, 0.32);
  border-radius: 6px;
  color: var(--accent-dark);
  background: var(--panel-dark);
  font: inherit;
  font-size: 0.74rem;
}

.guess-btn,
.next-btn,
.error-state button {
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.guess-btn {
  color: #06101d;
  border: 1px solid rgba(123, 192, 255, 0.62);
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(74, 168, 255, 0.2);
}

.guess-btn:hover,
.guess-btn:focus {
  background: var(--accent-dark);
  outline: 3px solid rgba(74, 168, 255, 0.26);
}

.guess-btn[data-guess="real"] {
  color: var(--text);
  border-color: rgba(123, 192, 255, 0.42);
  background: #174268;
  box-shadow: 0 12px 28px rgba(74, 168, 255, 0.14);
}

.guess-btn[data-guess="real"]:hover,
.guess-btn[data-guess="real"]:focus {
  background: #1d5485;
  outline-color: rgba(74, 168, 255, 0.26);
}

.guess-btn.selected {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(238, 246, 255, 0.12), 0 16px 32px rgba(74, 168, 255, 0.28);
}

.guess-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.result-card,
.comment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.result-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.result-card.correct {
  border-color: rgba(44, 190, 124, 0.58);
  background:
    linear-gradient(135deg, rgba(44, 190, 124, 0.2), rgba(22, 34, 53, 0.92));
  box-shadow: 0 18px 44px rgba(20, 147, 95, 0.14);
}

.result-card.wrong {
  border-color: rgba(255, 92, 92, 0.58);
  background:
    linear-gradient(135deg, rgba(201, 53, 53, 0.2), rgba(22, 34, 53, 0.92));
  box-shadow: 0 18px 44px rgba(201, 53, 53, 0.14);
}

.result-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-card strong {
  font-size: 1.65rem;
  line-height: 1.05;
}

.result-card p {
  color: var(--muted);
  line-height: 1.55;
}

.comment-card {
  max-height: 360px;
  overflow-y: auto;
  padding: 14px;
}

.op-context {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.op-context p:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.comment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-heading span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

#comment-list {
  display: grid;
  gap: 8px;
  list-style: none;
}

#comment-list li {
  position: relative;
  padding: 11px 11px 11px 15px;
  border: 1px solid rgba(74, 168, 255, 0.13);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-dark);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#comment-list li::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 7px;
  width: 2px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.72;
}

.op-context p:last-child {
  overflow-wrap: anywhere;
}

.next-btn,
.error-state button {
  color: #06101d;
  background: var(--accent);
}

.next-btn:hover,
.error-state button:hover {
  background: var(--accent-dark);
}

.error-state {
  margin-top: 16px;
  padding: 22px;
}

.error-state p {
  max-width: 720px;
  margin: 10px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.app-footer {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 18px 0 28px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 880px) {
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .image-frame {
    min-height: 320px;
  }
}

@media (max-width: 520px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .back-link,
  .game-status,
  .status-pill,
  .score-pill,
  .guess-buttons {
    width: 100%;
  }

  .game-status {
    justify-content: stretch;
  }

  .score-pill,
  .status-pill {
    justify-content: center;
  }

  .guess-buttons {
    grid-template-columns: 1fr;
  }

  .image-frame {
    min-height: 260px;
  }
}
