:root {
  --bg-primary: #050505;
  --bg-secondary: rgba(18, 18, 18, 0.9);
  --bg-panel: rgba(20, 20, 20, 0.92);
  --bg-panel-soft: rgba(255, 255, 255, 0.035);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(74, 144, 226, 0.36);
  --text-main: #f5f5f5;
  --text-dim: #8d939d;
  --accent-blue: #4a90e2;
  --accent-silver: #c6ccd5;
  --accent-glow: rgba(74, 144, 226, 0.16);
  --shadow-strong: 0 24px 70px rgba(0, 0, 0, 0.48);
  --radius-lg: 18px;
  --radius-md: 12px;
  --terminal-width: 108ch;
  --terminal-height: 42rem;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.thinkcur-body {
  min-height: 100vh;
  color: var(--text-main);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(74, 144, 226, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(182, 188, 198, 0.09), transparent 20%),
    linear-gradient(180deg, #050505 0%, #090909 32%, #111111 100%);
}

button,
input {
  font: inherit;
}

.thinkcur-page {
  position: relative;
  min-height: 100vh;
}

.terminal-wrap {
  min-height: 100vh;
  padding: 32px 20px;
  overflow-x: auto;
}

.terminal-shell {
  position: relative;
  width: min(100%, calc(var(--terminal-width) + 2rem));
  min-width: var(--terminal-width);
  margin: 0 auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    var(--bg-secondary);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(12px);
  transition: filter 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.terminal-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

.thinkcur-page[data-gate-state="locked"] .terminal-shell {
  filter: blur(4px);
  transform: scale(0.995);
  opacity: 0.82;
}

.terminal-stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: var(--terminal-height);
}

.thinkcur-surface {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012)),
    rgba(22, 22, 22, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

.thinkcur-surface::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  pointer-events: none;
}

.ticker-bar {
  margin: 16px 16px 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  color: var(--accent-silver);
  font: 700 0.85rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    rgba(20, 20, 20, 0.94);
}

.terminal-grid {
  display: grid;
  grid-template-columns: 0.92fr 1.16fr 0.92fr;
  gap: 12px;
  padding: 0 16px;
  min-height: 0;
}

.terminal-column {
  display: flex;
  flex-direction: column;
  min-height: 29rem;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.014)),
    rgba(16, 16, 16, 0.94);
}

.panel-title,
.stack-title,
.command-label,
.gate-kicker {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--accent-silver);
  font: 700 0.76rem/1.2 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-body,
.stack-body {
  margin: 0;
  padding: 14px;
  min-height: 0;
  color: var(--text-main);
  font: 0.86rem/1.52 var(--mono);
  white-space: pre;
}

.terminal-column-dc .panel-body {
  color: #dbe4ef;
}

.stack-panels {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  height: 100%;
}

.stack-panel {
  border-radius: 10px;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(18, 18, 18, 0.92);
}

.stack-title {
  padding-top: 10px;
  padding-bottom: 9px;
  font-size: 0.7rem;
}

.stack-body {
  padding-top: 12px;
  font-size: 0.77rem;
  line-height: 1.45;
}

.command-line {
  margin: 12px 16px 16px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.016)),
    rgba(14, 14, 14, 0.94);
}

.command-label {
  border-bottom: 1px solid var(--border-color);
}

.command-entry {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  min-height: 3.5rem;
  color: var(--text-main);
  font: 0.9rem/1.4 var(--mono);
}

.command-prompt {
  flex: 0 0 auto;
}

.command-entry-input {
  flex: 1 1 72rem;
  min-width: 48rem;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-blue);
  caret-color: var(--accent-blue);
  font: inherit;
}

.command-entry-input:focus {
  border-color: rgba(74, 144, 226, 0.42);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 0.14rem rgba(74, 144, 226, 0.14);
}

.command-status {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--accent-blue);
  text-align: right;
}

.command-status.is-error {
  color: #f29a9a;
}

.command-status.is-success {
  color: var(--accent-blue);
}

.gate-layer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(2, 3, 5, 0.38);
}

.thinkcur-page[data-gate-state="open"] .gate-layer {
  display: none;
}

.gate-card {
  width: min(32rem, 100%);
  max-height: min(46rem, calc(100dvh - 40px));
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    rgba(20, 20, 20, 0.96);
}

.gate-kicker {
  color: var(--accent-blue);
}

.gate-card h1,
.gate-form,
.verify-output {
  padding-left: 22px;
  padding-right: 22px;
}

.gate-card h1 {
  margin: 0;
  padding-top: 18px;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.gate-copy {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
}

.gate-copy-stack {
  margin: 10px 22px 0;
  padding-right: 8px;
  max-height: min(13rem, 28dvh);
  overflow-y: auto;
}

.gate-copy-stack .gate-copy + .gate-copy {
  padding-top: 10px;
}

.gate-form {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 8px;
}

.gate-form.is-hidden {
  display: none;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--accent-silver);
  font: 0.76rem/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-panel-soft);
  color: var(--text-main);
  outline: none;
}

.field input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 0.18rem var(--accent-glow);
}

.gate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gate-button {
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  cursor: pointer;
}

.gate-button-primary {
  border-color: rgba(74, 144, 226, 0.7);
  background: linear-gradient(135deg, #5ba0f0, var(--accent-blue));
  color: #fff;
  font-weight: 700;
}

.verify-output {
  padding-top: 10px;
  padding-bottom: 22px;
  color: var(--accent-silver);
  font: 0.82rem/1.55 var(--mono);
}

@media (max-width: 760px) {
  .terminal-wrap {
    padding: 14px 10px;
  }

  .command-entry {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .command-entry-input,
  .command-status {
    width: 100%;
  }

  .command-status {
    text-align: left;
  }

  .gate-layer {
    align-items: flex-end;
  }

  .gate-card h1 {
    font-size: 1.6rem;
  }
}
