:root {
  --bg: #000000;
  --text: #1199ff;
  --glow: rgba(17, 153, 255, 0.55);
  --border: rgba(17, 153, 255, 0.58);
  --hover-bg: rgba(0, 136, 255, 0.08);
  --scroll-thumb: rgba(0, 136, 255, 0.4);
  --shadow-a: 0 0 8px var(--glow);
  --shadow-b: 0 0 18px rgba(17, 153, 255, 0.35);
}

:root[data-scheme='day'] {
  --bg: #f3f7ff;
  --text: #0a3f8a;
  --glow: rgba(10, 63, 138, 0.16);
  --border: rgba(10, 63, 138, 0.36);
  --hover-bg: rgba(10, 63, 138, 0.08);
  --scroll-thumb: rgba(10, 63, 138, 0.35);
  --shadow-a: 0 0 2px var(--glow);
  --shadow-b: 0 0 6px rgba(10, 63, 138, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Consolas, Menlo, Monaco, monospace;
  text-shadow: var(--shadow-a), var(--shadow-b);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  scrollbar-width: none;
  overflow: hidden;
}

body::-webkit-scrollbar,
.terminal-screen::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.terminal-screen {
  scrollbar-width: none;
}

.terminal {
  width: min(900px, 94vw);
  height: min(680px, 92vh);
  border: 1px solid var(--border);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    radial-gradient(circle at top left, rgba(17, 153, 255, 0.08), transparent 42%),
    radial-gradient(circle at bottom right, rgba(17, 153, 255, 0.06), transparent 38%),
    var(--bg);
  overflow: hidden;
}

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

.prompt {
  text-align: center;
  margin: auto;
  width: min(460px, 100%);
}

.access-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

input,
button,
select,
textarea {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0;
  font: inherit;
  padding: 0.45rem 0.6rem;
  outline: none;
  text-shadow: inherit;
}

button,
.option {
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:hover,
.option:hover,
.nav-link:hover {
  background: var(--hover-bg);
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.hero-copy,
.language-panel,
.postlude {
  border: 1px solid var(--border);
  padding: 1rem;
  background: linear-gradient(180deg, rgba(17, 153, 255, 0.04), transparent 28%);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.hero-kicker,
.gate-label {
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  opacity: 0.74;
}

.hero-title {
  margin: 0 0 0.35rem;
  letter-spacing: 0.16em;
  font-size: 0.82rem;
  opacity: 0.78;
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.hero-line {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.08;
  min-height: 4.6em;
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.hero-title.is-decomposing,
.hero-line.is-decomposing {
  opacity: 0.18;
  filter: blur(6px);
  transform: translateY(6px) skewX(-8deg);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.listen-button[disabled] {
  opacity: 0.45;
  border-style: dashed;
}

.hero-note,
.language-intro {
  opacity: 0.76;
}

.language-panel {
  overflow: auto;
}

.option,
.nav-link {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  user-select: none;
}

.language-option {
  font-family: 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans JP', 'Noto Sans KR', 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.25;
  text-shadow: none;
  text-align: left;
  unicode-bidi: plaintext;
}

.language-option.is-rtl {
  text-align: right;
}

.terminal-screen {
  border: 1px solid var(--border);
  padding: 0.85rem;
  flex: 1;
  overflow: hidden;
  line-height: 1.45;
  min-height: 0;
}

.terminal-screen h1,
.terminal-screen h2,
.terminal-screen h3,
.terminal-screen h4,
.terminal-screen h5,
.terminal-screen h6 {
  margin-bottom: 0.6rem;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  gap: 0.75rem;
}

.status {
  min-height: 1.2rem;
}

.editor-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
}

.EasyMDEContainer {
  height: 100%;
}

.EasyMDEContainer .CodeMirror,
.EasyMDEContainer .editor-toolbar,
.EasyMDEContainer .editor-preview {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-radius: 0 !important;
}

.EasyMDEContainer .CodeMirror {
  height: 100% !important;
  min-height: 320px;
  overflow: auto !important;
  scrollbar-width: auto;
}

.EasyMDEContainer .CodeMirror::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.EasyMDEContainer .CodeMirror::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
}

.EasyMDEContainer .editor-toolbar button {
  color: var(--text) !important;
}

.scheme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 30;
  min-width: 88px;
}

.gate-prompt {
  margin: auto;
  width: min(620px, 100%);
}

.postlude {
  margin: auto 0;
}


.terminal-screen.is-rtl {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  font-family: 'Noto Naskh Arabic', 'Amiri', 'Tahoma', 'Arial', sans-serif;
}

.terminal-screen.is-rtl h1,
.terminal-screen.is-rtl h2,
.terminal-screen.is-rtl h3,
.terminal-screen.is-rtl h4,
.terminal-screen.is-rtl h5,
.terminal-screen.is-rtl h6,
.terminal-screen.is-rtl p,
.terminal-screen.is-rtl li,
.terminal-screen.is-rtl blockquote {
  direction: rtl;
  unicode-bidi: plaintext;
}

.EasyMDEContainer[dir='rtl'] .CodeMirror,
.EasyMDEContainer[dir='rtl'] .CodeMirror pre {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

@media (max-width: 860px) {
  body {
    align-items: stretch;
  }

  .terminal {
    width: 100vw;
    height: 100vh;
    border: 0;
    padding: 1rem;
  }

  .hero-shell {
    grid-template-columns: 1fr;
  }

  .hero-line {
    min-height: 3.2em;
  }
}
