:root {
  --bg-outer: #E4E2D4;
  --bg-window: #FBF9E6;
  --bg-header: #D8EEEE;
  --bg-footer: #F4F2DC;
  --border: #265860;
  --ink: #141616;
  --ink-muted: #5A6665;
  --ink-eof: #7E8884;
  --accent-red: #8F241E;
  --accent-teal: #265860;

  --font-mono: "Courier New", Courier, "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  --gutter-width: 230px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-outer);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.5;
  padding: clamp(8px, 1.5vmin, 16px);
}

.window {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  background-color: var(--bg-window);
  border: 1px solid var(--border);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
}

/* Top Window Tag Bar */
.tag-bar {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tag-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.logo-mark {
  width: 66px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}

.brand-tag {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  min-width: 0;
}

.brand-tag .slash {
  color: var(--accent-teal);
  font-weight: 400;
}

.brand-name,
.brand-sub {
  white-space: nowrap;
}

.tag-meta {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Shared 2-column tabular grid for all content rows and buffer space */
.grid-row {
  display: grid;
  grid-template-columns: var(--gutter-width) 1fr;
  border-bottom: 1px solid var(--border);
}

.cell-gutter {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-red);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.cell-main {
  padding: 20px 32px;
}

/* Row 00: Main Statement (Headline + Lead) */
.row-premise .cell-gutter {
  padding-top: 28px;
}

.row-premise .cell-main {
  padding-top: 24px;
  padding-bottom: 28px;
}

.headline {
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 2vw, 1.4375rem);
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink);
  margin-bottom: 16px;
}

.headline span {
  display: block;
}

.lead {
  font-size: 0.9375rem;
  line-height: 1.52;
  color: var(--ink);
  max-width: 64ch;
}

/* Rows 01, 02, 03, 04 */
.axioms {
  display: flex;
  flex-direction: column;
}

.axiom-text {
  font-size: 0.9375rem;
  line-height: 1.48;
  color: var(--ink);
  max-width: 66ch;
}

/* Open Buffer Space (Absorbs remaining viewport height above footer) */
.buffer-space {
  display: grid;
  grid-template-columns: var(--gutter-width) 1fr;
  min-height: 36px;
}

.buffer-space .cell-gutter {
  padding-top: 18px;
  padding-bottom: 18px;
  color: var(--ink-eof);
  font-weight: 400;
  font-size: 0.9375rem;
  user-select: none;
}

.buffer-space .cell-main {
  padding-top: 18px;
  padding-bottom: 18px;
}

.prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-teal);
  font-weight: 700;
  user-select: none;
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 15px;
  background-color: var(--accent-teal);
  animation: cursor-blink 1.1s steps(1) infinite;
}

.term-line {
  line-height: 1.5;
  user-select: none;
}

.prompt-sign {
  color: var(--accent-teal);
  font-weight: 700;
}

.term-cmd {
  color: var(--ink-muted);
}

.term-output {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
}

.term-output:not(:empty) {
  margin: 4px 0 6px 0;
}

.term-output a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.term-output a:hover,
.term-output a:focus-visible {
  color: var(--accent-red);
  text-decoration-color: var(--accent-red);
}

@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}

/* Bottom Status Bar */
.status-bar {
  background-color: var(--bg-footer);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 24px;
  font-size: 0.8125rem;
  color: var(--ink);
}

.nowrap {
  display: inline-block;
  white-space: nowrap;
}

.obf-trap {
  display: none !important;
  visibility: hidden !important;
  speak: never;
}

.mail-field .sep::before {
  content: " [";
}

.mail-field .sep::after {
  content: "] ";
}

.status-right a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.status-right a:hover,
.status-right a:focus-visible {
  color: var(--accent-red);
  text-decoration-color: var(--accent-red);
}

/* Tablet & Mobile Responsive Collapse (<= 740px) */
@media (max-width: 740px) {
  body {
    padding: 0;
  }

  .window {
    border-left: 0;
    border-right: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .tag-bar {
    padding: 8px 16px;
    gap: 12px;
  }

  .tag-left {
    gap: 12px;
  }

  .grid-row {
    grid-template-columns: 1fr;
  }

  .cell-gutter {
    border-right: 0;
    padding: 14px 16px 2px 16px;
  }

  .cell-main {
    padding: 2px 16px 16px 16px;
  }

  .row-premise .cell-gutter {
    padding-top: 18px;
  }

  .row-premise .cell-main {
    padding-top: 4px;
    padding-bottom: 20px;
  }

  .headline span {
    display: inline;
  }

  .buffer-space {
    grid-template-columns: 1fr;
  }

  .buffer-space .cell-gutter {
    border-right: 0;
    padding: 12px 16px;
  }

  .status-bar {
    padding: 10px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .status-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .status-sep {
    display: none;
  }
}

@media print {
  body {
    background: #FFFFFF;
    padding: 0;
  }

  .window {
    min-height: auto;
    border: 1px solid #000000;
  }
}
