:root {
  --bg-top: #f8efd8;
  --bg-bottom: #b9d7c0;
  --panel: rgba(253, 248, 236, 0.92);
  --panel-border: #4d5b45;
  --text: #1f2a1f;
  --muted: #57664e;
  --accent: #be5a38;
  --accent-dark: #8d3c22;
  --success: #2f6d45;
  --canvas-border: #243119;
  --shadow: 0 14px 36px rgba(27, 44, 30, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.45), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.layout {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.intro-panel,
.result-panel {
  align-self: start;
}

.game-panel {
  grid-row: span 2;
}

.eyebrow,
.label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.2rem;
}

.lede {
  font-size: 1.05rem;
  line-height: 1.5;
}

.info-grid {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.info-grid div {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  border: 1px solid rgba(77, 91, 69, 0.28);
}

.info-grid strong {
  display: block;
  margin-top: 4px;
}

.desktop-note {
  margin-bottom: 0;
  color: var(--accent-dark);
}

.status-bar,
.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.status-bar {
  margin-bottom: 12px;
  font-weight: 600;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 3px solid var(--canvas-border);
  background: linear-gradient(180deg, #dff4fb 0%, #eef9ff 55%, #f5efda 56%, #ead7a8 100%);
}

.actions {
  margin-top: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff8ee;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

button:hover {
  background: var(--accent-dark);
}

.hint {
  flex: 1;
  min-width: 220px;
  color: var(--muted);
}

.flag-output {
  min-height: 132px;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #1c2419;
  color: #d8f3d0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
}

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

  .game-panel {
    grid-row: auto;
  }
}
