:root {
  --bg: #f5f5f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --good: #15803d;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  padding: 16px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
}

.top {
  margin-bottom: 0;
}

.top-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: start;
  gap: 6px;
}

.top-bar-center {
  text-align: center;
  min-width: 0;
}

.top-bar-spacer {
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--bg);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, color 120ms ease,
    border-color 120ms ease;
}

.info-btn:hover {
  transform: translateY(-1px);
  background: #f8fafc;
  color: var(--text);
  border-color: #d1d5db;
}

.info-btn:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.info-dialog {
  max-width: min(420px, calc(100vw - 32px));
  width: 100%;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
}

.info-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
}

.info-dialog-inner {
  padding: 16px 18px 18px;
}

.info-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.info-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.info-dialog-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.info-dialog-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.info-dialog-close:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.info-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #f3f4f6;
}

.info-tab {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.info-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.info-tab:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.info-panel {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

.info-panel p {
  margin: 0 0 12px;
}

.info-panel p:last-child {
  margin-bottom: 0;
}

.info-panel-note {
  font-size: 0.9rem;
}

.info-kofi-actions {
  margin-top: 16px !important;
}

.info-kofi-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffbeb;
  color: #92400e;
  font-weight: 600;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease;
}

.info-kofi-link:hover {
  transform: translateY(-1px);
  background: #fef3c7;
}

.info-kofi-link:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.info-feedback-actions {
  margin-top: 16px !important;
}

.info-feedback-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.info-feedback-link:hover {
  transform: translateY(-1px);
  background: #dbeafe;
}

.info-feedback-link:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 700;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.game {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  position: relative;
}

.game-timer {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text);
  pointer-events: none;
}

.game-timer[hidden] {
  display: none;
}

.cards.is-blurred img {
  filter: blur(10px) brightness(0.95);
  transform: scale(1.04);
}

.ready-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
}

.ready-overlay.hidden {
  display: none;
}

.ready {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: Consolas, sans-serif; 
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.ready:hover {
  transform: translateY(-1px);
  background: #f8fafc;
}

.ready:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 3px;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: var(--card);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.card:focus-visible {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.card.selected {
  border-color: #111827;
}

.card.correct {
  border-color: var(--good);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--good), transparent 70%);
}

.card.wrong {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad), transparent 75%);
}

.card:disabled {
  cursor: default;
}

.status {
  min-height: 62px;
  text-align: center;
  margin-top: 0;
}

#message {
  margin: 0;
  font-weight: 600;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
}

.stats {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fafafa;
  font-size: 0.94rem;
}

.share-wrap {
  margin-top: 0;
  text-align: center;
}

.share {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.share:not(:disabled):hover {
  transform: translateY(-1px);
  background: #f8fafc;
}

.share:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reveal-pop {
  animation: pop 250ms ease-out;
}

@keyframes pop {
  from {
    transform: scale(0.98);
    opacity: 0.65;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 12px 10px;
    gap: 8px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .top-bar {
    grid-template-columns: 40px 1fr 40px;
  }

  .info-btn,
  .top-bar-spacer {
    width: 40px;
    height: 40px;
  }

  .info-btn svg {
    width: 20px;
    height: 20px;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .card {
    border-radius: 10px;
  }

  .card img {
    min-height: 140px;
  }

  .game-timer {
    top: 8px;
    right: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .pill {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .share {
    padding: 8px 12px;
    font-size: 0.88rem;
  }
}
