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

:root {
  --ink: #111827;
  --muted: #64748b;
  --paper: #f8fafc;
  --panel: #ffffff;
  --line: #d7dde6;
  --blue: #2454d6;
  --blue-dark: #173ea7;
  --red: #dc2626;
  --green: #14834f;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

body {
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    #eef2f7;
  background-size: 38px 38px;
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.back-bar {
  margin: 0 auto;
  max-width: 1180px;
  padding: 1rem 1.25rem 0;
}

.back-link {
  color: #475569;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: var(--ink);
}

.logo-game {
  margin: 0 auto;
  max-width: 1180px;
  padding: 1.25rem 1.25rem 2.5rem;
}

.hero-panel {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.eyebrow,
.prompt-label,
.panel-label {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 5.2rem);
  letter-spacing: 0;
  line-height: 0.94;
  margin-top: 0.35rem;
  max-width: 820px;
}

.progress-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 120px;
  padding: 0.85rem 1rem;
}

.progress-card span {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-card strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
  margin-top: 0.15rem;
}

.play-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.draw-panel,
.compare-panel > *,
.progress-card {
  box-shadow: var(--shadow);
}

.draw-panel,
.reference-card,
.controls,
.memory-wall {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.draw-panel {
  overflow: hidden;
}

.prompt-bar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 86px;
  padding: 1rem;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  letter-spacing: 0;
  line-height: 1;
}

.hint-btn,
.secondary-btn,
.tool-btn,
.next-btn,
.reveal-btn {
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 900;
  min-height: 42px;
  padding: 0.62rem 0.85rem;
}

.hint-btn,
.secondary-btn,
.tool-btn {
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #334155;
}

.hint-btn:hover,
.secondary-btn:hover,
.tool-btn:hover {
  background: #eef2f7;
  color: var(--ink);
}

.hint-text {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  padding: 0.8rem 1rem;
}

.toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
}

.tool-group,
.action-group,
.swatches {
  align-items: center;
  display: flex;
  gap: 0.45rem;
}

.tool-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.swatch {
  background: var(--swatch);
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  height: 30px;
  width: 30px;
}

.swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.size-control {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.82rem;
  font-weight: 900;
  gap: 0.5rem;
}

.size-control input {
  accent-color: var(--blue);
  width: 118px;
}

.action-group {
  margin-left: auto;
}

.canvas-wrap {
  background: #fdfdfb;
  min-height: 360px;
  padding: 0.75rem;
}

#logo-canvas {
  aspect-ratio: 45 / 28;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: crosshair;
  display: block;
  touch-action: none;
  width: 100%;
}

.compare-panel {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.reference-card,
.controls,
.memory-wall {
  padding: 1rem;
}

.reference-stage {
  align-items: center;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%),
    #ffffff;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  margin-top: 0.7rem;
  min-height: 230px;
  overflow: hidden;
  padding: 1rem;
  position: relative;
}

.reference-stage.locked .reference-logo {
  display: none;
}

.locked-message {
  color: #64748b;
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}

.reference-stage:not(.locked) .locked-message {
  display: none;
}

.reference-logo {
  width: min(230px, 100%);
}

.reference-logo img {
  display: block;
  height: 230px;
  object-fit: contain;
  width: 100%;
}

.controls {
  display: grid;
  gap: 0.75rem;
}

.reveal-btn,
.next-btn {
  background: var(--ink);
  border: 0;
  color: #fff;
}

.reveal-btn:hover,
.next-btn:hover {
  background: #2d3b4d;
}

.nav-row {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr 1fr;
}

.wall-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

#wall-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.wall-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.75rem;
  max-height: 270px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.wall-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  grid-column: 1 / -1;
  line-height: 1.45;
  padding: 1rem;
  text-align: center;
}

.wall-item {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.wall-item img {
  background: #fff;
  display: block;
  width: 100%;
}

.wall-item span {
  color: #334155;
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  overflow: hidden;
  padding: 0.38rem 0.45rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .hero-panel,
  .play-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .compare-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .logo-game {
    padding-inline: 0.75rem;
  }

  .prompt-bar {
    align-items: stretch;
    display: grid;
  }

  .action-group {
    margin-left: 0;
  }

  .toolbar {
    align-items: stretch;
  }

  .tool-group,
  .action-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .swatches {
    flex: 1;
  }

  .size-control {
    justify-content: space-between;
    width: 100%;
  }

  .size-control input {
    flex: 1;
    width: auto;
  }

  .nav-row,
  .wall-grid {
    grid-template-columns: 1fr;
  }
}
