:root {
  --bg: #0d0b08;
  --fg: #e8b86d;
  --gutter: #5a3e1a;
  --accent: #f4c842;
  --cursor: #e8b86d;
  --dim: #3a2a0f;
  --glow: rgba(232, 184, 109, 0.12);
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

body {
  padding: 0;
  text-shadow: 0 0 3px var(--glow), 0 0 8px rgba(232, 184, 109, 0.04);
}

.buffer {
  position: relative;
  padding: 0 0 2em 9ch;
  min-height: calc(100vh - 2em);
}

.gutter {
  position: absolute;
  left: 0;
  top: 0;
  width: 7ch;
  text-align: right;
  color: var(--gutter);
  font: inherit;
  line-height: inherit;
  padding: 0 1ch 0 0;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
  user-select: none;
}

.gutter .tide {
  color: var(--gutter);
}

#cursor {
  position: absolute;
  top: 0;
  width: 1ch;
  height: 1.6em;
  background: var(--cursor);
  box-shadow: 0 0 4px var(--cursor), 0 0 10px rgba(232, 184, 109, 0.25);
  pointer-events: none;
  animation: blink 1s step-end infinite;
  z-index: 10;
}

@keyframes blink {
  50% { opacity: 0; }
}

#crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#crt-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.5) 100%);
}

#crt-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.12) 2px,
    rgba(0,0,0,0.12) 4px
  );
}

.tmux-bar {
  background: #1a120a;
  color: var(--fg);
  font-family: "Fira Code", monospace;
  font-size: 18px;
  line-height: 1.3;
  padding: 0 0 0 9ch;
  display: flex;
  align-items: stretch;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #3a2a0f;
}

.tmux-session {
  color: #0d0b08;
  background: var(--fg);
  padding: 0.3em 0.4em;
  margin-right: 0.4em;
  font-weight: 700;
  font-size: 0.9em;
  display: flex;
  align-items: center;
}

.tmux-win {
  color: var(--fg);
  text-decoration: none;
  padding: 0.3em 0.6em;
  border-right: 1px solid rgba(232, 184, 109, 0.1);
  white-space: nowrap;
  font-size: 0.85em;
  display: flex;
  align-items: center;
}

.tmux-win:hover {
  background: rgba(232, 184, 109, 0.08);
}

.tmux-win.active {
  background: var(--fg);
  color: #0d0b08;
}

.tmux-right {
  margin-left: auto;
  color: #8a6a2a;
  font-size: 0.8em;
  display: flex;
  align-items: center;
  padding: 0 0.8em 0 0;
}

h1, h2, h3, h4, h5, h6 {
  font-size: 1em;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}

h2 { margin-top: 1lh; }

.whoami-grid {
  display: flex;
  gap: 2em;
  align-items: flex-start;
}

.whoami-text {
  flex: 1;
  min-width: 0;
}

.whoami-art {
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1.1;
  background: none !important;
  border: none !important;
  padding: 0;
  margin: 0;
  color: var(--gutter);
}

h1::before, h2::before {
  content: '> ';
  color: var(--accent);
}

p {
  margin: 0;
}

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

a:hover {
  opacity: 0.85;
  text-shadow: 0 0 6px rgba(244, 200, 66, 0.25);
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  margin: 0;
}

strong {
  font-weight: 700;
}

.tag {
  color: var(--gutter);
  font-size: 0.85em;
}

.org {
  color: var(--accent);
  font-weight: 700;
}

section ul, .whoami-text {
  padding-left: 3ch;
}

section li {
  margin-bottom: 1lh;
}

.date {
  color: var(--gutter);
  margin-bottom: 1lh;
}

article header {
  margin-bottom: 1lh;
}

code {
  background: #1a120a;
  padding: 0.1em 0.3em;
  border-radius: 2px;
  font-size: 0.9em;
  color: var(--fg);
}

pre {
  background: #1a120a;
  padding: 1em;
  overflow-x: auto;
  margin: 1lh 0;
  border-radius: 3px;
  border: 1px solid #3a2a0f;
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--gutter);
  padding-left: 1em;
  margin: 1lh 0;
  color: #8a6a2a;
}

@media (max-width: 720px) {
  html { font-size: 15px; }
  .gutter, #cursor { display: none; }
  .buffer { padding: 0.2em 0 0 1em; }
  .tmux-bar {
    font-size: 14px;
    flex-wrap: wrap;
    padding: 0 0 0 1em;
    gap: 0.2em;
  }
  .tmux-win { padding: 0.3em 0.5em; }
  .tmux-session { font-size: 0.85em; }
  .tmux-right { font-size: 0.75em; }
  #hint { display: none; }
  .whoami-grid { flex-direction: column; }
  .whoami-art { font-size: 6px; max-width: 100%; }
}

hr {
  border: none;
  border-top: 1px solid #3a2a0f;
  margin: 1lh 0;
}

img {
  max-width: 100%;
  opacity: 0.85;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

#hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.6em;
  background: #1a120a;
  color: var(--gutter);
  font-size: 14px;
  line-height: 1.6em;
  padding: 0 1ch;
  font-family: "Fira Code", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid #3a2a0f;
  z-index: 30;
  pointer-events: none;
  transition: color 0.15s;
}

#hint.active {
  color: var(--fg);
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

#modal.modal-hidden {
  display: none;
}

#modal-box {
  background: var(--bg);
  border: 1px solid var(--gutter);
  padding: 1.5em 2em;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 0 20px rgba(232, 184, 109, 0.08), inset 0 0 30px rgba(0,0,0,0.5);
}

.modal-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 1lh;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-section {
  margin-bottom: 1lh;
}

.modal-section-title {
  color: var(--accent);
  margin-bottom: 0.5lh;
}

.modal-row {
  line-height: 1.8;
  color: var(--fg);
}

.modal-key {
  color: var(--accent);
  font-weight: 700;
  display: inline-block;
  min-width: 9ch;
}

.modal-footer {
  text-align: center;
  color: var(--gutter);
  margin-top: 1lh;
  animation: blink 1s step-end infinite;
}

@media (max-width: 720px) {
  #modal-box {
    padding: 1em;
    font-size: 14px;
  }
  .modal-key {
    min-width: 7ch;
  }
}
