:root {
  color-scheme: light;
  --bg: #f6f1e7;
  --bg-deep: #efe5d2;
  --ink: #2b241b;
  --muted: #6f6150;
  --accent: #c25a2e;
  --accent-strong: #a9441f;
  --tile: #fff9f0;
  --tile-strong: #f6e7cf;
  --tile-border: #dbc9af;
  --shadow: 0 12px 30px rgba(51, 36, 21, 0.15);
  --mono: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --display: "Noe Display", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--display);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(255, 207, 143, 0.5), transparent 55%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.6s ease-out;
}

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

.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  padding: 32px clamp(16px, 4vw, 48px) 16px;
  gap: 20px;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 12px;
  line-height: 1.05;
}

.tagline {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 1rem;
}

.header-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  font-size: 0.9rem;
}

.hint-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(194, 90, 46, 0.2);
}

.app-shell {
  flex: 1;
  padding: 0 clamp(16px, 4vw, 48px) 24px;
}

.tiles {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 10px 4px 24px;
  scroll-behavior: smooth;
}

.tiles::-webkit-scrollbar {
  height: 10px;
}

.tiles::-webkit-scrollbar-thumb {
  background: rgba(111, 97, 80, 0.4);
  border-radius: 999px;
}

.tile {
  position: relative;
  flex: 0 0 clamp(280px, 32vw, 420px);
  min-height: 520px;
  background: var(--tile);
  border: 1px solid var(--tile-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding: 16px;
  animation: none;
}

.tile::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: linear-gradient(to bottom, rgba(194, 90, 46, 0.2), rgba(194, 90, 46, 0.6), rgba(194, 90, 46, 0.2));
}

.tile:first-child::before {
  display: none;
}

.tile--active {
  border-color: var(--accent);
  box-shadow: 0 16px 36px rgba(194, 90, 46, 0.25);
}

.tile--disabled {
  opacity: 0.7;
}

.tile-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.tile-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tile-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.tile-label {
  font-weight: 600;
}

.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--tile-border);
  background: rgba(255, 255, 255, 0.8);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge--json {
  color: #2f4b7a;
  border-color: rgba(47, 75, 122, 0.4);
}

.badge--text {
  color: #72512d;
  border-color: rgba(114, 81, 45, 0.4);
}

.badge--valid {
  color: #2b5d3b;
  border-color: rgba(43, 93, 59, 0.4);
}

.badge--invalid {
  color: #8a2d2d;
  border-color: rgba(138, 45, 45, 0.4);
  background: rgba(255, 233, 233, 0.8);
}

.tile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--tile-border);
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(51, 36, 21, 0.12);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: rgba(194, 90, 46, 0.4);
}

button.ghost {
  background: rgba(255, 255, 255, 0.2);
}

.mode-picker {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--tile-strong);
  border: 1px solid var(--tile-border);
  border-radius: 12px;
}

.mode-picker button {
  font-size: 0.75rem;
}

.tile-reason {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 18px;
}

textarea {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--tile-border);
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
}

textarea:disabled {
  background: rgba(245, 240, 231, 0.9);
  color: rgba(43, 36, 27, 0.6);
}

.dirty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px rgba(194, 90, 46, 0.15);
}

.app-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 48px) 32px;
}

.footer-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 20px rgba(51, 36, 21, 0.08);
}

.footer-card h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.footer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .tile {
    min-height: 460px;
  }

  .header-hint {
    width: 100%;
  }
}
