:root {
  color-scheme: light;
  --bg: #faf9f6;
  --text: #111111;
  --muted: #626260;
  --border: #dedbd6;
  --accent: #ff5600;
  --white: #ffffff;
  --blue: #65b5ff;
  --green: #0bdf50;
  --pink: #ff2067;
  --lime: #b3e01c;
  --red: #c41c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

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

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--text);
  border-radius: 4px;
  color: var(--text);
  background: var(--white);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

h1 {
  max-width: 860px;
  margin: 0 0 16px;
  font-size: 72px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.intro {
  max-width: 760px;
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel,
.review {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

form.panel {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.preview.panel {
  min-height: 560px;
  padding: 24px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: var(--bg);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
}

select {
  min-height: 48px;
  resize: none;
}

#prompt-template {
  min-height: 260px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint,
.status,
.condition-description,
.review-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hint,
.condition-description,
.review-copy {
  margin: 0;
}

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

.condition-box,
.confirm-box,
.review-group,
.badge-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.condition-box,
.confirm-box {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.condition-head,
.preview-header,
.review-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.condition-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.active-condition {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.condition-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.condition-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: var(--white);
}

.condition-button.is-active {
  color: var(--white);
  background: var(--text);
}

.condition-button.is-active:hover {
  color: var(--text);
  background: var(--white);
}

.confirm-box {
  border-color: var(--red);
  background: var(--white);
}

.confirm-box[hidden] {
  display: none;
}

.confirm-warning {
  margin: 0;
  color: var(--red);
  font-size: 16px;
  font-weight: 800;
}

button {
  min-height: 44px;
  border: 1px solid var(--text);
  border-radius: 4px;
  padding: 0 16px;
  color: var(--white);
  background: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

button.secondary {
  color: var(--text);
  background: transparent;
}

button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

button:hover {
  color: var(--text);
  background: var(--white);
  transform: scale(1.06);
}

button.secondary:hover {
  color: var(--white);
  background: var(--text);
}

button:active {
  transform: scale(0.94);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.preview-header {
  margin-bottom: 20px;
}

h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.swatches {
  display: flex;
  gap: 6px;
}

.swatches span {
  width: 18px;
  height: 18px;
  border: 1px solid var(--text);
  border-radius: 4px;
}

.swatches span:nth-child(1) { background: var(--accent); }
.swatches span:nth-child(2) { background: var(--blue); }
.swatches span:nth-child(3) { background: var(--green); }
.swatches span:nth-child(4) { background: var(--pink); }
.swatches span:nth-child(5) { background: var(--lime); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  padding: 24px;
}

.badge-card {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.badge-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

.badge-title,
.review-title {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

.badge-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-card a {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.review {
  margin-top: 24px;
  padding: 24px;
}

.review-list,
.review-group,
.review-meta {
  display: grid;
  gap: 14px;
}

.review-group {
  padding: 16px;
}

.review-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 20px;
}

.condition-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--text);
  border-radius: 4px;
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
}

details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

summary {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

pre {
  margin: 0;
  padding: 0 12px 12px;
  white-space: pre-wrap;
  color: var(--text);
  font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: var(--bg);
  font: inherit;
  font-size: 16px;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.checkbox-label {
  display: flex;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.auth-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  background: var(--white);
}

.auth-panel form {
  display: grid;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 1px;
  line-height: 1;
  text-transform: uppercase;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

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

.concept-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg);
}

.concept-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.concept-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.admin-card details {
  max-height: 260px;
  overflow: auto;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 54px;
  }
}

@media (max-width: 425px) {
  main {
    width: min(100% - 20px, 1180px);
    padding-top: 28px;
  }

  form.panel,
  .preview.panel,
  .review {
    padding: 16px;
  }

  h1 {
    font-size: 40px;
  }
}
