:root {
  --cream: #FFF1D1;
  --straw: #E3CD7F;
  --terracotta: #E3B398;
  --sage: #A8B062;
  --taupe: #B0B096;
  --ink: #3a3530;
  --ink-muted: #6b6455;
}

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Georgia', serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1rem 3rem;
}

/* ── Header ── */

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.eyebrow {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}

h1 em {
  font-style: italic;
  color: var(--ink-muted);
}

.rule {
  width: 48px;
  height: 2px;
  background: var(--straw);
  margin: 1rem auto 0;
}

/* ── Workspace: canvas left, panel right ── */

.workspace {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Left: canvas panel ── */

.canvas-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.canvas-label {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--taupe);
}

.canvas-frame {
  position: relative;
  border: 3px solid var(--sage);
  border-radius: 4px;
  transition: border-color 0.25s;
}

.canvas-frame.active {
  border-color: var(--terracotta);
}

#canvas {
  display: block;
  cursor: crosshair;
  border-radius: 2px;
}

.corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--ink);
  border-style: solid;
  border-width: 0;
}

.corner.tl {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
  border-radius: 2px 0 0 0;
}

.corner.tr {
  top: -1px;
  right: -1px;
  border-top-width: 2px;
  border-right-width: 2px;
  border-radius: 0 2px 0 0;
}

.corner.bl {
  bottom: -1px;
  left: -1px;
  border-bottom-width: 2px;
  border-left-width: 2px;
  border-radius: 0 0 0 2px;
}

.corner.br {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
  border-radius: 0 0 2px 0;
}

.canvas-actions {
  align-self: stretch;
  display: flex;
  justify-content: flex-end;
}

button {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--taupe);
  border-radius: 2px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

button:hover {
  background: var(--straw);
  border-color: var(--straw);
  color: var(--ink);
}

button:active {
  opacity: 0.7;
}

/* ── Right: prediction + array stacked ── */

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.prediction-card {
  background: white;
  border: 1px solid var(--straw);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.pred-label {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.5rem;
}

#prediction {
  font-size: 5rem;
  line-height: 1;
  font-weight: normal;
  color: var(--ink);
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

#prediction.has-value {
  color: var(--sage);
}

.placeholder-digit {
  color: var(--straw);
  user-select: none;
}

/* ── Input array ── */

.hint {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.25rem;
}

#array {
  font-family: 'Courier New', monospace;
  font-size: 7px;
  line-height: 9px;
  white-space: pre;
  color: var(--ink-muted);
  background: white;
  border: 1px solid var(--straw);
  border-radius: 4px;
  padding: 0.5rem;
  display: block;
  width: fit-content;
  min-width: calc(28 * 3 * 1ch + 1rem);
  min-height: calc(28 * 9px + 1rem);
}
