:root {
  --wh-black: #1a1a1a;
  --wh-yellow: #f2b705;
  --wh-red: #c53527;
  --cream: #fdfbf4;
  --border: #cabf9f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--wh-black);
}

.topbar {
  background: var(--wh-black);
  color: var(--wh-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  position: relative;
}

.topbar h1 {
  margin: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: Arial, Helvetica, "Segoe UI", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

.logo-emoji {
  font-size: 1.3rem;
  margin-right: 3px;
}

.logo .letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  background: var(--wh-yellow);
  color: var(--wh-black);
  font-size: 0.95rem;
  border-radius: 3px;
}

.icon-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: 2px solid var(--wh-yellow);
  color: var(--wh-yellow);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-weight: bold;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 12px 16px;
}

.tagline {
  text-align: center;
  color: #555;
  margin: 6px 0 4px;
  font-size: 0.9rem;
}

.puzzle-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  color: var(--wh-red);
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.timer {
  font-variant-numeric: tabular-nums;
}

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--wh-red);
  text-decoration: underline;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.plate-wrap {
  display: flex;
  justify-content: center;
}

.plate-wrap svg {
  width: 100%;
  max-width: 220px;
}

.attempts {
  text-align: center;
  font-weight: 600;
  margin: 6px 0;
  font-size: 0.9rem;
}

.guess-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.guess-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.header-row .header-cell {
  background: none;
  color: #777;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 2px 4px;
}

.cell {
  border-radius: 6px;
  padding: 5px 4px;
  font-size: 0.78rem;
  text-align: center;
  font-weight: 600;
  border: 2px solid var(--border);
}

.cell.correct {
  background: #3f8f4f;
  border-color: #3f8f4f;
  color: white;
}

.cell.wrong {
  background: #ece4cf;
  color: #555;
}

.guess-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  font-weight: 600;
  color: #444;
  gap: 2px;
}

select {
  padding: 6px;
  border-radius: 6px;
  border: 2px solid var(--border);
  font-size: 0.85rem;
  background: white;
}

.submit-btn {
  grid-column: span 2;
  background: var(--wh-red);
  color: white;
  border: none;
  padding: 9px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 2px;
}

.submit-btn:disabled {
  background: #ccc;
  cursor: default;
}

.message {
  text-align: center;
  font-weight: 700;
  min-height: 1.4em;
  font-size: 0.9rem;
  margin: 6px 0;
}

.message.win {
  color: #3f8f4f;
}

.message.lose {
  color: var(--wh-red);
}

.reveal {
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 6px 0;
  font-size: 0.85rem;
}

.reveal h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.reveal ul {
  padding-left: 16px;
  margin: 4px 0 0;
}

.marker-note {
  color: #666;
  font-weight: 400;
}

#share-btn {
  width: 100%;
}

.stats {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: #444;
  text-align: center;
}

dialog {
  border: none;
  border-radius: 12px;
  max-width: 420px;
  padding: 20px 24px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.source-note {
  font-size: 0.75rem;
  color: #888;
}

@media (max-width: 380px) {
  .guess-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
