/* color and type tokens */
:root {
  --asphalt: #14161a;
  --asphalt-soft: #1d2026;
  --card: #1a1d23;
  --plate-bg: #101010;
  --plate-ink: #f4f2e8;
  --line: #2d3038;
  --accept: #6fbf73;
  --reject: #e2695c;
  --amber: #e0b04a;
  --text: #e9e8e3;
  --text-dim: #9a9da5;
  --font-display: 'Big Shoulders Text', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--asphalt);
  background-image: radial-gradient(circle at 15% 0%, #20242c 0%, var(--asphalt) 55%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}

a { color: var(--accept); }

/* decorative road line, the page signature */
.road-line {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--amber) 0px,
    var(--amber) 28px,
    transparent 28px,
    transparent 56px
  );
  z-index: 40;
}

/* navbar */
.navbar {
  border-bottom: 1px solid var(--line);
  background: rgba(20, 22, 26, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 4px;
  z-index: 30;
}

.nav-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-plate {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  background: var(--plate-ink);
  color: #111;
  padding: 3px 9px;
  border-radius: 5px;
}

.brand-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--plate-ink);
}

.nav-links {
  display: flex;
  gap: 22px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--plate-ink);
  border-bottom-color: var(--accept);
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px 40px;
}

/* header */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accept);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 18px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0 0 14px;
  color: var(--plate-ink);
}

.head-tight h1 { margin-bottom: 28px; }

h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--plate-ink);
  margin: 0 0 12px;
}

.sub {
  max-width: 54ch;
  color: var(--text-dim);
  margin: 0 0 36px;
}

/* format card */
.format-card {
  background: var(--asphalt-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 28px;
}

.format-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.format-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 10px;
}

.tag {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  padding: 5px 10px;
  border-radius: 6px;
}

.tag-l { background: rgba(111, 191, 115, 0.15); color: var(--accept); }
.tag-d { background: rgba(226, 105, 92, 0.18); color: #e8988f; }

.format-sep {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #6a6d75;
}

.alphabet-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.format-note { margin: 0; color: var(--text-dim); font-size: 14px; }
.format-note strong { color: var(--plate-ink); font-family: var(--font-mono); }
.format-note a { color: var(--amber); font-weight: 600; }

/* plate input styled like a real plate */
.plate-form {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.plate-shell {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--plate-bg);
  border: 3px solid var(--plate-ink);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.bolt {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--plate-ink);
  opacity: 0.6;
  flex-shrink: 0;
}

.plate-shell input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.08em;
  color: var(--plate-ink);
  text-transform: uppercase;
}

.plate-shell input::placeholder { color: #5c5c58; }

.plate-form button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(180deg, #7fcf82, var(--accept));
  color: #0c1a0d;
  border: none;
  border-radius: 10px;
  padding: 0 26px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(111, 191, 115, 0.25);
}

.plate-form button:hover { filter: brightness(1.06); }
.plate-form button:active { transform: translateY(1px); }

/* result hero on the dedicated hasil page */
.result-hero {
  text-align: center;
  padding: 30px 20px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  margin-bottom: 24px;
}

.stempel {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 50%;
  border: 3px double currentColor;
  transform: rotate(-8deg);
  display: inline-block;
  margin-bottom: 18px;
}

.stempel.ok { color: var(--accept); }
.stempel.no { color: var(--reject); }

.rendered-plate {
  background: var(--plate-bg);
  border: 3px solid var(--plate-ink);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 auto 18px;
  max-width: fit-content;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.rp-char { color: var(--plate-ink); }
.rp-char.bad { color: var(--reject); }

.hero-meta {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
}

/* explanation card */
.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 24px;
  margin-bottom: 22px;
}

.info-card p { color: var(--text-dim); font-size: 14px; margin: 0 0 12px; }
.info-card p:last-child { margin-bottom: 0; }

.breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.breakdown-item {
  background: var(--asphalt-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}

.breakdown-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.breakdown-value { font-size: 18px; color: var(--accept); }

.alpha-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.alpha-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--asphalt-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}

.alpha-symbol {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--amber);
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.alpha-desc { font-size: 13px; color: var(--text-dim); }

/* dedicated results page, verdict and toggle */
.hero-verdict {
  font-size: 15px;
  color: var(--text-dim);
  margin: 0;
}

.explain-toggle {
  margin-bottom: 22px;
}

.explain-toggle summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  background: var(--asphalt-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--plate-ink);
}

.explain-toggle summary::-webkit-details-marker { display: none; }
.explain-toggle summary::after { content: "  \25BE"; color: var(--accept); }
.explain-toggle[open] summary::after { content: "  \25B4"; }
.explain-toggle summary:hover { border-color: var(--accept); }
.explain-toggle > *:not(summary) { margin-top: 18px; }

.diagram-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 16px 0 18px;
}

/* DFA diagram */
.diagram-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--asphalt-soft);
}

.diagram-svg {
  width: 100%;
  min-width: 900px;
  height: auto;
  display: block;
}

.edge path {
  stroke: #3a3d45;
  stroke-width: 2;
}

.edge.active path {
  stroke: var(--accept);
  stroke-width: 3;
}

.edge.trap-edge path {
  stroke: var(--reject);
  stroke-width: 2.5;
}

.edge-label {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: #6a6d75;
  text-anchor: middle;
}

.edge.active .edge-label { fill: var(--accept); font-weight: 600; }

.node .ring-inner {
  fill: var(--card);
  stroke: var(--line);
  stroke-width: 2;
}

.node .ring-outer {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

.node.active .ring-inner { fill: rgba(111, 191, 115, 0.15); stroke: var(--accept); }
.node.active .ring-outer { stroke: var(--accept); }

.node.trap .ring-inner { stroke: var(--reject); stroke-dasharray: 4 3; }
.node.trap.active .ring-inner { fill: rgba(226, 105, 92, 0.18); stroke: var(--reject); stroke-dasharray: none; }

.node.final .ring-inner { stroke-width: 3.5; }

.node-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text-dim);
  text-anchor: middle;
}

.node.active .node-label { fill: var(--plate-ink); }

.diagram-note {
  font-size: 12px;
  color: #6a6d75;
  margin-top: 12px;
}

.hasil-actions {
  text-align: center;
  margin: 8px 0 20px;
}

/* about page */
.formula {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--amber);
  background: var(--asphalt-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 8px 0 16px;
  text-align: center;
}

.formula-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 14px;
}

.formula-list li { margin-bottom: 6px; }
.formula-list .mono { color: var(--plate-ink); }

.plate-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 16px 0 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.legend-swatch {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.swatch-green { background: var(--accept); border-radius: 50%; border-color: var(--accept); }
.swatch-gray { background: #4a4d56; border-radius: 50%; border-color: #4a4d56; }
.swatch-double { background: transparent; border: 2px double var(--accept); border-radius: 50%; }
.swatch-trap { background: transparent; border: 2px dashed var(--reject); border-radius: 50%; }

.swatch-black { background: #111; }
.swatch-red { background: #8f2c22; }
.swatch-yellow { background: #d9b23c; }
.swatch-blue { background: linear-gradient(90deg, #eee 50%, #2c5aa0 50%); }

.legend-note {
  font-size: 12px;
  color: #6a6d75;
  margin: 4px 0 0;
}

.state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.state-table th,
.state-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}

.state-table th {
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.state-table td.mono { color: var(--plate-ink); }
.state-table tr:last-child td { border-bottom: none; }

.flow-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 14px;
}

.flow-list li { margin-bottom: 8px; }

.cta-button {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  background: var(--accept);
  color: #0c1a0d;
  border-radius: 8px;
  padding: 12px 26px;
  text-decoration: none;
}

.cta-button:hover { filter: brightness(1.08); }

/* shared */
.mono { font-family: var(--font-mono); color: var(--plate-ink); }
.mono.hl { color: var(--amber); }

.trace-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.trace-row {
  display: grid;
  grid-template-columns: 32px 90px 70px 70px 1fr;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.trace-row:last-child { border-bottom: none; }

.trace-head {
  background: var(--asphalt-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.trace-row.bad { background: rgba(226, 105, 92, 0.08); }

/* footer */
.foot {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.foot p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #6a6d75;
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

@media (max-width: 520px) {
  h1 { font-size: 30px; }
  .trace-row { grid-template-columns: 24px 70px 55px 55px 1fr; font-size: 12px; }
  .plate-legend { grid-template-columns: 1fr; }
  .diagram-legend { grid-template-columns: 1fr; }
  .breakdown { grid-template-columns: 1fr; }
}
