:root {
  --bg: #f6f4fa;
  --panel: #ffffff;
  --line: #ded9ea;
  --text: #1c2b4a;
  --muted: #5f6e87;
  --brand: #5227b4;
  --brand-strong: #45209a;
  --brand-soft: #f1ebff;
  --accent: #1cc5a8;
  --accent-strong: #14af95;
  --accent-soft: #e8fbf7;
  --ok: #1a8f79;
  --ok-soft: #e7faf5;
  --warn: #c58c0a;
  --warn-soft: #fff7df;
  --shadow: 0 14px 34px rgba(57, 36, 110, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fbf9ff 0%, var(--bg) 100%);
}

img, svg { max-width: 100%; }
a { color: var(--brand); }
button, input, textarea, select {
  font: inherit;
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 244, 250, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(222, 217, 234, 0.85);
}

.site-header .inner,
.hero,
.two-col,
.footer-grid {
  display: grid;
  gap: 1rem;
}

.site-header .inner {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0.9rem 0;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.brand-mark {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(57, 36, 110, 0.10));
  border-radius: 14px;
  background: transparent;
  flex: 0 0 auto;
}
.brand h1 {
  margin: 0;
  font-size: 1.1rem;
}
.brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}
.hero-logo {
  display: block;
  width: min(100%, 460px);
  height: auto;
  margin-bottom: 1rem;
}

.nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero {
  grid-template-columns: 1.3fr 0.9fr;
  padding: 2.2rem 0 1.4rem;
  align-items: center;
}
.hero-card,
.card,
.panel,
.stat,
.route-button,
.note-box,
.sample-card,
.edge-row,
.output-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card,
.card,
.panel,
.note-box,
.output-box {
  padding: 1.2rem;
}
.hero-card h2 {
  margin-top: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.15;
}
.hero-card p,
.lead,
.muted {
  color: var(--muted);
}
.lead {
  font-size: 1.05rem;
}
.badges {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1rem 0 0;
}
.badge {
  background: var(--brand-soft);
  color: var(--brand-strong);
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 0.92rem;
}

.hero-aside {
  display: grid;
  gap: 1rem;
}
.info-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}
.info-list li { margin-bottom: 0.55rem; }

.main {
  padding-bottom: 3rem;
}

.cards-grid,
.samples-grid,
.stats-grid,
.questions-grid {
  display: grid;
  gap: 1rem;
}
.cards-grid,
.samples-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.questions-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card h3,
.panel h3,
.sample-card h3,
.section-title {
  margin-top: 0;
}
.section {
  margin-top: 1.8rem;
}

.btn,
.btn-ghost,
.btn-linklike {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 12px;
  padding: 0.78rem 1rem;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.btn:hover,
.btn-ghost:hover,
.route-button:hover,
.sample-card:hover {
  transform: translateY(-1px);
}
.btn:active,
.btn-ghost:active,
.route-button:active {
  transform: translateY(0);
}
.btn {
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 28px rgba(82, 39, 180, 0.22);
}
.btn.secondary {
  background: var(--accent);
}
.btn.warn {
  background: #90650f;
}
.btn-ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn[disabled],
.btn-ghost[disabled],
.route-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.two-col {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}

.route-list {
  display: grid;
  gap: 0.8rem;
}
.route-button {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.95rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.15s ease;
}
.route-button .route-label {
  font-weight: 700;
}
.route-button .route-meta {
  color: var(--muted);
  font-size: 0.93rem;
}
.route-button.active {
  border-color: var(--brand);
}

.progress-wrap {
  overflow: hidden;
  border-radius: 999px;
  background: #ece6fb;
  height: 10px;
}
.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  transition: width 0.15s linear;
}
.progress-bar.running {
  animation: progress-run var(--travel-duration, 900ms) linear forwards;
}
@keyframes progress-run {
  from { width: 0; }
  to { width: 100%; }
}

.status {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--brand-soft) 0%, #f7f4ff 100%);
  color: var(--brand-strong);
}
.status.success {
  background: var(--ok-soft);
  color: var(--ok);
}
.status.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.8rem;
  align-items: start;
}
.kv dt {
  font-weight: 700;
}
.kv dd {
  margin: 0;
  color: var(--muted);
}

.stat {
  padding: 1rem;
}
.stat .label {
  color: var(--muted);
  font-size: 0.92rem;
}
.stat .value {
  font-size: 1.5rem;
  margin-top: 0.35rem;
  font-weight: 800;
}

.history-list,
.visited-list,
.validation-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}
.history-list li,
.visited-list li,
.validation-list li { margin-bottom: 0.45rem; }

.note-box textarea,
.question-box textarea,
textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #fcfdff;
}
.note-box textarea,
.question-box textarea {
  min-height: 120px;
  resize: vertical;
}
.question-box {
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.question-box h4 {
  margin: 0 0 0.5rem;
}
.small {
  font-size: 0.92rem;
}

.sample-card {
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}
.sample-card .meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}
.field {
  display: grid;
  gap: 0.4rem;
}
.field label {
  font-weight: 700;
}
.edge-list {
  display: grid;
  gap: 0.8rem;
}
.edge-row {
  padding: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr 140px auto;
  gap: 0.7rem;
  align-items: end;
}
.edge-row .field { margin: 0; }

.preview-shell {
  min-height: 300px;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffefe 0%, #f8f6fd 100%);
}
.graph-preview {
  width: 100%;
  height: 100%;
  min-height: 280px;
}
.graph-preview text {
  font-size: 13px;
  fill: #1d2a38;
}
.graph-preview .node {
  fill: #ffffff;
  stroke: var(--brand);
  stroke-width: 2;
}
.graph-preview .node.start {
  fill: #f2ecff;
}
.graph-preview .node.goal {
  fill: #e8fbf7;
  stroke: var(--accent-strong);
}
.graph-preview .edge {
  stroke: #6f7894;
  stroke-width: 2;
}
.graph-preview .edge-label {
  fill: #5f6e87;
  font-size: 12px;
}

.output-box code,
.inline-code {
  display: block;
  padding: 0.85rem;
  border-radius: 12px;
  overflow-wrap: anywhere;
  background: #f7f3ff;
  border: 1px solid var(--line);
}

.footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding: 1.2rem 0 2rem;
}
.footer-grid {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.footer p { margin: 0.25rem 0; color: var(--muted); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .hero,
  .two-col,
  .site-header .inner,
  .footer-grid,
  .edge-row {
    grid-template-columns: 1fr;
  }
  .nav {
    justify-content: flex-start;
  }
}


.gate-shell {
  max-width: 720px;
  margin: 2rem auto 0;
}
.gate-panel {
  padding: 1.4rem;
}
.gate-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.hidden-by-gate {
  display: none !important;
}


a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(28, 197, 168, 0.28);
  outline-offset: 2px;
}

.hero-card,
.panel,
.card,
.output-box,
.note-box,
.question-box,
.edge-row,
.route-button,
.stat {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.96) 100%);
}

.route-button.active,
.graph-mode-row .mode-btn.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
}

.site-header .nav .btn-ghost[href="./odlweb"] {
  border-color: rgba(82, 39, 180, 0.18);
}


.graph-builder-card {
  padding: 1.2rem;
}
.graph-builder-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.graph-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}
.board-shell {
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  overflow: hidden;
}
.graph-board {
  width: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}
.board-bg {
  fill: #fbf9ff;
  stroke: #ddd4f5;
  stroke-width: 2;
  stroke-dasharray: 8 8;
}
.board-edge {
  stroke: #243755;
  stroke-width: 3;
  stroke-linecap: round;
}
.board-edge-group {
  cursor: pointer;
}
.board-edge-label {
  fill: #47617f;
  font-size: 14px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 6;
  stroke-linejoin: round;
}
.board-node {
  cursor: pointer;
}
.board-node circle {
  fill: #ffffff;
  stroke: #4d6480;
  stroke-width: 3;
  transition: transform 0.15s ease, fill 0.2s ease, stroke 0.2s ease;
}
.board-node text {
  fill: #1d2a38;
  font-weight: 700;
  pointer-events: none;
}
.board-node.start circle {
  fill: #efe8ff;
  stroke: var(--brand);
}
.board-node.goal circle {
  fill: #e8fbf7;
  stroke: var(--accent-strong);
}
.board-node.selected circle {
  stroke: var(--brand);
  stroke-width: 4;
}
.board-node.connect-source circle {
  fill: var(--brand-soft);
  stroke: var(--brand);
}
.board-placeholder {
  fill: var(--muted);
  font-size: 18px;
}
.board-panel {
  display: grid;
  gap: 1rem;
}
.subtle-panel {
  padding: 1rem;
}
.subtle-panel h4 {
  margin: 0 0 0.4rem;
}
.selected-node-line {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
}
.compact-row .btn-ghost,
.compact-row .btn {
  padding: 0.62rem 0.8rem;
}
.compact-list {
  padding-left: 1.05rem;
}
.graph-mode-row .mode-btn.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: rgba(39, 93, 173, 0.25);
  box-shadow: inset 0 0 0 1px rgba(39, 93, 173, 0.1);
}
.validation-list li {
  margin-bottom: 0.45rem;
}

@media (max-width: 900px) {
  .graph-builder-grid,
  .two-col,
  .hero {
    grid-template-columns: 1fr;
  }
}


.qr-share-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(220px, 280px) 1fr;
  align-items: start;
}
.qr-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfdff;
}
.qr-preview {
  min-height: 220px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f3ff 100%);
  border: 1px dashed var(--line);
  padding: 0.9rem;
}
.qr-preview svg {
  display: block;
  width: min(100%, 220px);
  height: auto;
}
.qr-preview.empty {
  color: var(--muted);
  text-align: center;
}
.graph-board {
  min-height: 440px;
}
@media (max-width: 860px) {
  .qr-share-grid {
    grid-template-columns: 1fr;
  }
}
