:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(23, 37, 51, 0.1);
  --panel-shadow: 0 18px 40px rgba(20, 34, 48, 0.08);
  --text: #17222d;
  --muted: #667685;
  --accent: #ff7a1a;
  --accent-2: #007ea7;
  --danger: #ff5d6d;
  --success: #11845b;
  --surface: #f6f8fb;
  --surface-2: #eef2f6;
  --line: rgba(23, 37, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 122, 26, 0.08), transparent 180px),
    linear-gradient(90deg, rgba(23, 37, 51, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(23, 37, 51, 0.03) 1px, transparent 1px),
    #ffffff;
  background-size: auto, 28px 28px, 28px 28px, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.control-panel,
.preview-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-card {
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--bg-elevated);
  box-shadow: var(--panel-shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -15% -55% 35%;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 122, 26, 0.12), transparent 65%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  margin-bottom: 12px;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

.hero-copy,
.field-hint,
.selection-title,
.log-output {
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  min-height: 240px;
  resize: vertical;
  line-height: 1.45;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

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

button,
.file-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

button:active,
.file-button:active {
  transform: translateY(0);
}

button {
  background: var(--surface-2);
  color: var(--text);
}

.accent-button {
  background: linear-gradient(135deg, var(--accent), #ffa861);
  color: #1e0f03;
  font-weight: 700;
}

.danger-button {
  background: linear-gradient(135deg, var(--danger), #ff7b8a);
  color: #26050c;
  font-weight: 700;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text);
}

.file-button input {
  display: none;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-grid,
.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-grid div,
.inspector-grid div {
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
}

dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

dd {
  margin: 0;
  font-weight: 600;
}

.log-output {
  margin-top: 14px;
  min-height: 112px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.preview-stage {
  min-height: 70vh;
}

.pixel-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}

.pixel-cell {
  position: relative;
  min-height: 136px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(23, 37, 51, 0.02), transparent 55%),
    #ffffff;
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 8px;
}

.pixel-cell.active {
  border-color: rgba(255, 122, 26, 0.65);
  box-shadow: 0 0 0 2px rgba(255, 122, 26, 0.18);
}

.pixel-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.pixel-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 37, 51, 0.08);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.pixel-dot {
  width: 100%;
  height: 34px;
  border-radius: 12px;
  background: var(--pixel-color);
  border: 1px solid rgba(23, 37, 51, 0.08);
  position: relative;
  overflow: hidden;
}

.pixel-dot::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--pixel-level);
  background: rgba(255, 255, 255, 0.28);
}

.pixel-values,
.pixel-level {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.3;
}

.pixel-values {
  color: var(--text);
}

.pixel-temp-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(23, 37, 51, 0.1);
  background: linear-gradient(90deg, #ffb067 0%, #ffe7b3 50%, #b8d7ff 100%);
  overflow: hidden;
  opacity: calc(0.28 + var(--temp-strength, 0) * 0.72);
}

.pixel-temp-bar.is-hidden {
  display: none;
}

.pixel-temp-indicator {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: var(--temp-ratio);
  width: 2px;
  border-radius: 999px;
  background: rgba(23, 37, 51, 0.72);
  transform: translateX(-50%);
}

.pixel-temp-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  color: rgba(23, 37, 51, 0.78);
  letter-spacing: 0.02em;
}

.pixel-level {
  color: var(--muted);
}

.inspector-card {
  align-self: start;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .preview-stage {
    min-height: auto;
  }
}
