:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6b6864;
  --line: #dfdad1;
  --paper: #f7f3ea;
  --surface: #fffdf7;
  --charcoal: #1e2225;
  --green: #16a77e;
  --rose: #df4e7a;
  --gold: #d79c24;
  --cyan: #39a9c7;
  --shadow: 0 18px 50px rgba(33, 30, 25, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
    sans-serif;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(247, 243, 234, 0.86);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: inline-block;
  background:
    linear-gradient(135deg, transparent 48%, var(--surface) 49% 55%, transparent 56%),
    conic-gradient(from 210deg, var(--rose), var(--gold), var(--green), var(--charcoal), var(--rose));
  border: 1px solid var(--ink);
}

.nav-links {
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  padding: 9px 11px;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  gap: 18px;
  min-height: calc(100vh - 108px);
  padding: 18px 0 26px;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.title-row,
.section-heading,
.art-info,
.score-row > div,
.ledger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-row {
  padding: clamp(18px, 4vw, 38px) 0 4px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(40px, 7vw, 92px);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 17px;
  line-height: 1.15;
}

.primary-action,
.secondary-action,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
  padding: 0 18px;
  box-shadow: 5px 5px 0 var(--gold);
}

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

.secondary-action {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--cyan);
}

.primary-action span {
  font-size: 20px;
}

.featured-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  min-height: 610px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--charcoal);
  box-shadow: var(--shadow);
}

.stage-art {
  position: relative;
  min-height: 520px;
  transition: background 260ms ease;
}

.stage-art::before,
.stage-art::after,
.art-visual::before,
.preview-art::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage-art::before,
.art-visual::before,
.preview-art::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.12) 1px, transparent 1px);
  background-size: 26px 26px;
  mix-blend-mode: overlay;
}

.stage-art::after {
  inset: 8%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.stage-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 26px;
  background: var(--surface);
  border-left: 1px solid var(--ink);
}

.stage-copy p:last-of-type {
  color: var(--muted);
  line-height: 1.6;
}

.status-pill,
.jury-badge,
.score-chip {
  width: fit-content;
  margin: 0;
  border: 1px solid var(--ink);
  background: #f9dc5c;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  padding: 7px 9px;
}

.stage-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--ink);
  color: var(--surface);
}

.stats-panel,
.submission-form,
.review-panel,
.ledger-panel,
.market-panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
}

.stats-panel {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.stat-block {
  padding: 18px;
  border: 1px solid var(--ink);
  background: var(--surface);
}

.stat-block span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stat-block strong {
  display: block;
  font-size: clamp(38px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.stat-block.approved {
  box-shadow: inset 7px 0 0 var(--green);
}

.stat-block.rejected {
  box-shadow: inset 7px 0 0 var(--rose);
}

.stat-block.rate {
  box-shadow: inset 7px 0 0 var(--cyan);
}

.panel-note {
  margin: 6px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.standards-section,
.gallery-section,
.submission-layout,
.bottom-grid {
  padding: 36px 0;
}

.standards-section {
  display: grid;
  gap: 18px;
}

.standards-intro {
  max-width: 840px;
}

.standards-intro p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.threshold-grid,
.rubric-grid,
.authority-panel,
.process-strip,
.audit-grid,
.formula-panel,
.rule-columns {
  display: grid;
  gap: 14px;
}

.authority-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.authority-panel div {
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--ink);
  background: var(--charcoal);
  color: var(--surface);
  box-shadow: inset 0 7px 0 var(--rose);
}

.authority-panel span {
  display: block;
  margin-bottom: 20px;
  color: #f9dc5c;
  font-size: 13px;
  font-weight: 850;
}

.authority-panel p {
  margin: 0;
  color: rgba(255, 253, 247, 0.78);
  line-height: 1.68;
}

.process-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  counter-reset: protocol;
}

.process-strip div {
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.84);
}

.process-strip strong {
  display: block;
  margin-bottom: 18px;
  color: var(--rose);
  font-size: 28px;
  line-height: 1;
}

.process-strip span {
  display: block;
  margin-bottom: 9px;
  font-weight: 850;
}

.process-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

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

.formula-panel > div {
  min-height: 260px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: inset 7px 0 0 var(--gold);
}

.formula-panel code {
  display: block;
  margin: 16px 0;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  background: #171717;
  color: #f9dc5c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.formula-panel p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.64;
}

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

.threshold-grid div,
.rubric-grid article,
.audit-grid article,
.rule-panel {
  border: 1px solid var(--ink);
  background: var(--surface);
}

.threshold-grid div {
  min-height: 174px;
  padding: 18px;
  box-shadow: inset 0 7px 0 var(--green);
}

.threshold-grid span,
.rubric-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.threshold-grid strong {
  display: block;
  margin: 12px 0 10px;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 0.95;
}

.threshold-grid p,
.rubric-grid p,
.rule-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

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

.rubric-grid article {
  min-height: 220px;
  padding: 18px;
}

.rubric-grid span {
  width: fit-content;
  margin-bottom: 14px;
  border: 1px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  padding: 6px 8px;
}

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

.audit-grid article {
  min-height: 210px;
  padding: clamp(18px, 3vw, 24px);
  box-shadow: inset 7px 0 0 var(--cyan);
}

.audit-grid h3 {
  margin-bottom: 14px;
}

.audit-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.64;
}

.rule-columns {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.rule-panel {
  padding: clamp(18px, 3vw, 26px);
}

.rule-panel h3 {
  margin-bottom: 12px;
}

.rule-panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.58;
}

.rule-panel.challenge {
  background: var(--charcoal);
  color: var(--surface);
  box-shadow: inset 7px 0 0 var(--rose);
}

.rule-panel.challenge p {
  color: rgba(255, 253, 247, 0.78);
  font-size: 17px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 20px;
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--ink);
  background: var(--surface);
}

.segmented-control button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 750;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control .is-active {
  background: var(--ink);
  color: var(--surface);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.art-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--surface);
  animation: rise 360ms ease both;
  animation-delay: var(--delay);
}

.art-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  border-bottom: 1px solid var(--ink);
}

.art-info {
  padding: 14px;
}

.art-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.score-chip {
  min-width: 42px;
  text-align: center;
  background: var(--green);
  color: white;
}

.submission-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
  gap: 18px;
  align-items: start;
}

.submission-form,
.review-panel,
.ledger-panel,
.market-panel {
  padding: clamp(18px, 3vw, 28px);
}

.submission-form {
  display: grid;
  gap: 15px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 118px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 167, 126, 0.16);
}

fieldset {
  margin: 0;
  padding: 15px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 234, 0.58);
}

legend {
  padding: 0 6px;
}

.checkbox-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
}

.checkbox-row input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

.split-fields,
.bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.submit-button {
  width: 100%;
  margin-top: 4px;
}

.review-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 18px;
}

.preview-art {
  position: relative;
  min-height: 250px;
  border: 1px solid var(--ink);
  background: linear-gradient(135deg, var(--charcoal), var(--cyan), var(--gold));
  background-size: cover;
  background-position: center;
}

.preview-art.has-image::before {
  display: none;
}

.review-result h2 {
  margin-bottom: 8px;
}

.review-result p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.score-bars {
  display: grid;
  gap: 12px;
}

.score-row {
  display: grid;
  gap: 7px;
}

.score-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.score-row strong {
  font-size: 13px;
}

.score-row i {
  display: block;
  height: 10px;
  border: 1px solid var(--ink);
  background: linear-gradient(90deg, var(--green) var(--score), #eee9df var(--score));
}

.gate-list {
  display: grid;
  gap: 9px;
}

.metric-panel,
.gate-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

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

.metric-panel strong {
  grid-column: 1 / -1;
}

.metric-panel span,
.gate-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.gate-item.pass {
  border-color: rgba(22, 167, 126, 0.45);
  box-shadow: inset 5px 0 0 var(--green);
}

.gate-item.fail {
  border-color: rgba(223, 78, 122, 0.45);
  box-shadow: inset 5px 0 0 var(--rose);
}

.gate-item.neutral {
  box-shadow: inset 5px 0 0 var(--cyan);
}

.bottom-grid {
  align-items: start;
  padding-bottom: 70px;
}

.ledger-list,
.market-steps {
  display: grid;
  gap: 10px;
}

.ledger-item,
.market-steps div {
  border: 1px solid var(--line);
  background: #fff;
  padding: 13px;
}

.ledger-item strong {
  font-size: 13px;
}

.ledger-item.pass strong {
  color: var(--green);
}

.ledger-item.fail strong {
  color: var(--rose);
}

.market-steps div {
  display: grid;
  gap: 5px;
}

.market-steps span {
  color: var(--muted);
  line-height: 1.55;
}

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

@media (max-width: 980px) {
  .workspace,
  .authority-panel,
  .process-strip,
  .formula-panel,
  .threshold-grid,
  .rubric-grid,
  .audit-grid,
  .rule-columns,
  .submission-layout,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .stats-panel,
  .review-panel {
    position: static;
  }

  .stats-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-note {
    grid-column: 1 / -1;
  }

  .featured-stage {
    grid-template-columns: 1fr;
  }

  .stage-copy {
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

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

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

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

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .title-row,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .workspace {
    min-height: auto;
  }

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

  .stage-art {
    min-height: 380px;
  }

  .stats-panel,
  .art-grid,
  .process-strip,
  .formula-panel,
  .rubric-grid,
  .audit-grid,
  .metric-panel,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
    padding: 0 8px;
  }
}
