:root {
  color-scheme: light;
  --ink: #f7f0df;
  --field: #1f3327;
  --accent: #f2a541;
  --muted: #52665a;
  --panel: rgba(255, 252, 246, 0.86);
  --panel-border: rgba(31, 51, 39, 0.2);
  --shadow: 0 20px 40px rgba(26, 28, 22, 0.18);
  --grid: rgba(247, 240, 223, 0.14);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Goudy Old Style", "Garamond", "Palatino Linotype", serif;
  color: #16231b;
  background:
    radial-gradient(circle at 10% 20%, #fbe9cf 0%, transparent 55%),
    radial-gradient(circle at 80% 10%, #d9efda 0%, transparent 40%),
    linear-gradient(120deg, #f7f0df 0%, #f2dcc2 45%, #e9f2df 100%);
}

.page {
  padding: 32px clamp(20px, 4vw, 48px) 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  font-size: clamp(32px, 5vw, 54px);
  margin: 10px 0 6px;
}

.tagline {
  max-width: 520px;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

.status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(22, 35, 27, 0.08);
  border: 1px solid rgba(22, 35, 27, 0.14);
  padding: 10px 14px;
  border-radius: 999px;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.6s ease both;
  min-width: 0;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}

.field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
}

input[type="text"],
input[type="number"],
select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(22, 35, 27, 0.22);
  background: rgba(255, 255, 255, 0.9);
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22, 35, 27, 0.22);
  background: rgba(255, 255, 255, 0.9);
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  resize: vertical;
}

#llmDebugOutput,
#llmPromptOutput {
  display: none;
  margin-bottom: 14px;
}

#llmDebugOutput.is-visible,
#llmPromptOutput.is-visible {
  display: block;
}

input[type="number"] {
  width: 72px;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  margin-bottom: 10px;
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

button {
  border: 1px solid rgba(22, 35, 27, 0.3);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(22, 35, 27, 0.15);
}

button.primary {
  background: var(--accent);
  color: #2b1a05;
  border-color: rgba(43, 26, 5, 0.4);
}

.canvas-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.canvas-shell {
  position: relative;
  width: 100%;
  padding: 14px;
  border-radius: 20px;
  background: rgba(22, 35, 27, 0.08);
  border: 1px solid rgba(22, 35, 27, 0.18);
  box-shadow: var(--shadow);
  animation: rise 0.6s ease 0.1s both;
}

#lifeCanvas {
  width: 100%;
  display: block;
  border-radius: 14px;
  background: var(--field);
  touch-action: none;
}

.hint {
  position: absolute;
  bottom: 10px;
  right: 16px;
  font-size: 12px;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  color: rgba(247, 240, 223, 0.7);
}

.palette {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

.palette div {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(22, 35, 27, 0.16);
  border-radius: 999px;
  padding: 6px 12px;
}

#logoCanvas {
  width: 100%;
  background: #fdf8ed;
  border-radius: 16px;
  border: 1px solid rgba(22, 35, 27, 0.2);
  height: 200px;
}

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 8px 0 16px;
}

.pattern-preview {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(22, 35, 27, 0.16);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
}

#patternPreview {
  width: 100%;
  height: 140px;
  display: block;
  border-radius: 10px;
  background: #fdf8ed;
}

.glyph-cell {
  width: 100%;
  padding-top: 100%;
  position: relative;
  border-radius: 6px;
  background: rgba(31, 51, 39, 0.08);
  border: 1px solid rgba(31, 51, 39, 0.2);
  cursor: pointer;
}

.glyph-cell.active {
  background: var(--accent);
  border-color: rgba(43, 26, 5, 0.4);
}

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.status-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  min-height: 16px;
}

.llm-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9c1b0;
  border: 1px solid rgba(22, 35, 27, 0.25);
}

.status-dot.ok {
  background: #73b86b;
}

.status-dot.warn {
  background: #f2a541;
}

.status-dot.error {
  background: #d16b5a;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .status {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 24px 18px 32px;
  }
  .panel {
    padding: 16px;
  }
  #logoCanvas {
    height: 160px;
  }
}
