:root {
  --bg: #f4efe3;
  --bg-deep: #d9c7a3;
  --panel: rgba(255, 250, 241, 0.82);
  --panel-strong: #fffaf1;
  --ink: #1d1b18;
  --muted: #5f5a50;
  --accent: #b64926;
  --accent-soft: #f6c28b;
  --accent-alt: #0c6c67;
  --line: rgba(29, 27, 24, 0.12);
  --shadow: 0 18px 60px rgba(64, 38, 10, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 234, 193, 0.95), transparent 38%),
    radial-gradient(circle at top right, rgba(182, 73, 38, 0.18), transparent 28%),
    linear-gradient(135deg, #f2ebdb 0%, #efe2c4 48%, #ead7bc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(12, 108, 103, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 108, 103, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 90%);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.config-panel,
.visual-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.config-panel {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding-right: 6px;
}

.panel-card {
  position: relative;
  overflow: visible;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-card::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(182, 73, 38, 0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.panel-card > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.hero-card {
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.95), rgba(255, 242, 220, 0.78)),
    var(--panel);
}

.headline-band h2 {
  margin: 8px 0 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
}

.hero-card h1 {
  margin: 8px 0 0;
  max-width: 10ch;
  font-size: clamp(2rem, 2vw + 1.35rem, 3.6rem);
  line-height: 1.04;
  text-wrap: balance;
}

.hero-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0;
  color: var(--accent-alt);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1rem;
}

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

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(29, 27, 24, 0.14);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(182, 73, 38, 0.55);
  box-shadow: 0 0 0 4px rgba(182, 73, 38, 0.12);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 220px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.94rem;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: rgba(182, 73, 38, 0.55) rgba(29, 27, 24, 0.08);
}

textarea::-webkit-scrollbar {
  width: 10px;
}

textarea::-webkit-scrollbar-track {
  background: rgba(29, 27, 24, 0.08);
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb {
  background: rgba(182, 73, 38, 0.55);
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(182, 73, 38, 0.72);
}

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

button {
  border: 0;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

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

.primary-button,
.secondary-button,
.ghost-button,
.toggle-button {
  padding: 11px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, #b64926, #da7446);
  color: white;
  box-shadow: 0 14px 28px rgba(182, 73, 38, 0.24);
}

.secondary-button {
  background: rgba(12, 108, 103, 0.12);
  color: var(--accent-alt);
}

.ghost-button,
.toggle-button {
  background: rgba(29, 27, 24, 0.06);
  color: var(--ink);
}

.toggle-button.is-active {
  background: var(--ink);
  color: white;
}

.hint-tag,
.status-badge,
.summary-meta,
.table-label,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.hint-tag {
  background: rgba(12, 108, 103, 0.1);
  color: var(--accent-alt);
}

.headline-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 4px;
}

.status-badge {
  background: rgba(29, 27, 24, 0.08);
  color: var(--ink);
}

.status-badge.is-perfect {
  background: rgba(12, 108, 103, 0.14);
  color: var(--accent-alt);
}

.status-badge.is-warning {
  background: rgba(182, 73, 38, 0.14);
  color: var(--accent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.summary-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 250, 241, 0.92), rgba(255, 244, 223, 0.68));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.summary-card span {
  color: var(--muted);
}

.tabs-card {
  padding-bottom: 14px;
}

.rotation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rotation-tab {
  min-width: 80px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(29, 27, 24, 0.08);
  text-align: left;
}

.rotation-tab strong {
  display: block;
}

.rotation-tab span {
  color: var(--muted);
  font-size: 0.85rem;
}

.rotation-tab.is-active {
  background: linear-gradient(135deg, rgba(182, 73, 38, 0.94), rgba(228, 140, 84, 0.88));
  color: white;
}

.rotation-tab.is-active span {
  color: rgba(255, 255, 255, 0.84);
}

.rotation-canvas {
  display: grid;
  gap: 18px;
}

.rotation-board {
  display: none;
  animation: rise-in 220ms ease forwards;
}

.rotation-board.is-visible,
.rotation-board.is-forced-visible {
  display: grid;
  gap: 14px;
}

.rotation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rotation-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.rotation-subtitle {
  color: var(--muted);
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.table-card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(252, 243, 224, 0.82));
  border: 1px solid rgba(29, 27, 24, 0.08);
  box-shadow: 0 10px 26px rgba(64, 38, 10, 0.08);
  min-width: 0;
}

.table-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.table-card h4 {
  margin: 0;
  font-size: 1.08rem;
}

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

.group-column {
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(29, 27, 24, 0.06);
}

.group-column h5 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.group-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.group-column li {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(29, 27, 24, 0.05);
}

.group-column.group-a h5 {
  color: var(--accent);
}

.group-column.group-b h5 {
  color: var(--accent-alt);
}

.summary-meta {
  background: rgba(29, 27, 24, 0.06);
  color: var(--ink);
}

.validation-list {
  display: grid;
  gap: 10px;
}

.validation-item {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(29, 27, 24, 0.08);
}

.validation-item strong {
  display: block;
  margin-bottom: 4px;
}

.validation-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}

.validation-dot.ok {
  background: var(--accent-alt);
}

.validation-dot.warn {
  background: var(--accent);
}

.note-card p:last-child {
  margin-bottom: 0;
}

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

@media (max-width: 1120px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .config-panel {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
    gap: 18px;
  }

  .compact-grid,
  .table-layout {
    grid-template-columns: 1fr;
  }

  .headline-band,
  .section-head,
  .rotation-header {
    align-items: start;
    flex-direction: column;
  }
}
