:root {
  color-scheme: dark;
  --ink: #d7ffe4;
  --muted: #89aa94;
  --paper: #07110d;
  --panel: #0c1812;
  --line: #345642;
  --accent: #9cff71;
  --accent-ink: #07110d;
  --danger: #ffb7ad;
  --year-mark: #8bbfa0;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(7, 17, 13, .91), rgba(7, 17, 13, .97)),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(156, 255, 113, .04) 3px 4px),
    var(--paper);
}

body[data-room="gothic"] {
  --ink: #f0dfef; --muted: #ae91ad; --paper: #110914; --panel: #1a0f20;
  --line: #654b69; --accent: #e9b7de; --accent-ink: #160c19;
}
body[data-room="y2k"] {
  --ink: #e5f7ff; --muted: #8cb1c4; --paper: #07111b; --panel: #0b1b2a;
  --line: #3e637b; --accent: #d7ff42; --accent-ink: #101806;
}
body[data-room="midnight"] {
  --ink: #f2e6bb; --muted: #b2a36e; --paper: #100e08; --panel: #1b180d;
  --line: #6d6033; --accent: #ffd75e; --accent-ink: #181204;
}
body[data-room="mall"] {
  --ink: #e5eee0; --muted: #99ad92; --paper: #07110e; --panel: #0c1d17;
  --line: #426852; --accent: #dce78c; --accent-ink: #131707;
}

body[data-year="1992"] { --year-mark: #d7d7d7; }
body:is([data-year="1997"], [data-year="1998"]) { --year-mark: #80aaff; }
body:is([data-year="2001"], [data-year="2002"], [data-year="2003"]) { --year-mark: #ffd75e; }
body:is([data-year="2006"], [data-year="2007"]) { --year-mark: #70d7ed; }
body[data-year="2012"] { --year-mark: #d4a6ff; }
body[data-year="2017"] { --year-mark: #b8b9ff; }
body[data-year="2020"] { --year-mark: #8ee2b0; }
body[data-year="2022"] { --year-mark: #c9b5ff; }
body[data-year="2026"] { --year-mark: #f3f3f3; }

a { color: inherit; }
button, input, summary { font: inherit; }
button, summary { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 8px 11px;
  color: var(--accent-ink);
  background: var(--accent);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.mud-shell {
  width: min(880px, calc(100% - 24px));
  margin: 0 auto;
  padding: clamp(12px, 3vw, 30px) 0;
}

.site-header,
.room-directory,
.terminal,
.live-panel,
.no-script {
  border: 1px solid var(--line);
  background: var(--panel);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 15px;
}
.site-header p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.site-header code { color: var(--accent); }
.wordmark { color: var(--accent); font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.return-link { max-width: 170px; font-size: .72rem; line-height: 1.45; text-align: right; }

.room-directory {
  display: flex;
  align-items: stretch;
  margin-top: 8px;
  background: var(--paper);
}
.directory-label {
  display: grid;
  place-items: center;
  padding: 8px 11px;
  color: var(--muted);
  border-right: 1px solid var(--line);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.room-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 1; min-width: 0; }
.room-link {
  min-width: 0;
  min-height: 42px;
  padding: 6px 5px;
  color: var(--ink);
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  font-size: .67rem;
  line-height: 1.3;
}
.room-link:last-child { border-right: 0; }
.room-link:hover { color: var(--accent); background: rgba(255, 255, 255, .035); }
.room-link[aria-current="location"] { color: var(--accent-ink); background: var(--accent); font-weight: 700; }
.room-number { display: block; margin-bottom: 2px; opacity: .65; }

.terminal { margin-top: 8px; overflow: hidden; background: var(--paper); }
.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: .73rem;
}
.terminal-bar p { margin: 0; }
.terminal-bar span, .current-exits > span { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.terminal-bar strong { display: block; margin-top: 3px; color: var(--accent); font-size: .86rem; }
.current-exits { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
#exit-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }

.exit-button, .inline-exit {
  min-height: 31px;
  padding: 5px 7px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: transparent;
  font-size: .68rem;
}
.exit-button:hover, .inline-exit:hover { color: var(--accent-ink); background: var(--accent); }
.exit-button b { color: var(--accent); font-weight: 400; }
.exit-button:hover b { color: inherit; }
.inline-exit:disabled { cursor: default; opacity: .55; }

.transcript {
  height: clamp(350px, 52svh, 540px);
  overflow-y: auto;
  padding: 16px;
  scrollbar-color: var(--line) var(--panel);
}
.entry { margin: 0 0 15px; font-size: .83rem; line-height: 1.58; overflow-wrap: anywhere; }
.entry p { margin: 3px 0; }
.entry-command { color: var(--muted); }
.entry-command::before { content: "> "; color: var(--accent); }
.entry-label { color: var(--accent); font-weight: 700; }
.entry-detail, .entry-note { color: var(--muted); }
.entry-note { font-size: .74rem; }
.entry-error { color: var(--danger); }
.entry ul { margin: 6px 0 0; padding-left: 21px; }
.entry li { margin: 3px 0; }
.entry-exits { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.command-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.command-form label { color: var(--accent); font-weight: 700; }
.command-form input {
  min-width: 0;
  min-height: 40px;
  padding: 7px 9px;
  color: var(--ink);
  caret-color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
}
.command-form input::placeholder { color: var(--muted); opacity: .8; }
.command-form button, .live-link {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  background: var(--accent);
  font-weight: 700;
}
.command-form button:hover, .live-link:hover { filter: brightness(1.08); }
.command-hint { margin: 0; padding: 0 11px 10px; color: var(--muted); background: var(--panel); font-size: .68rem; line-height: 1.45; }
kbd { padding: 1px 4px; color: var(--accent); border: 1px solid var(--line); background: var(--paper); font: inherit; }

.live-panel { margin-top: 8px; }
.live-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px;
}
.live-panel h2 { margin: 0; color: var(--accent); font-size: .86rem; text-transform: uppercase; letter-spacing: .06em; }
.live-panel header p { margin: 4px 0 0; color: var(--muted); font-size: .71rem; }
.live-link { display: inline-flex; align-items: center; font-size: .7rem; line-height: 1.35; text-align: center; }
.embed-details, .rules { padding: 11px 13px; border-top: 1px solid var(--line); }
.embed-details summary, .rules summary { font-size: .73rem; text-decoration: underline; }
.provider-status, .rules p { margin: 9px 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.provider-frame { width: 100%; height: clamp(480px, 68svh, 680px); overflow: hidden; color: #17202a; background: #fff; }
.provider-frame:empty { display: none; }
.provider-frame iframe { display: block; width: 100% !important; height: 100% !important; border: 0; }
.provider-message { margin: 0 !important; padding: 15px; color: #21313a !important; background: #fff; font-size: .8rem !important; }
.provider-message a { color: #174f70; }

.mud-footer { padding: 10px 3px 0; color: var(--year-mark); font-size: .68rem; text-align: right; }
.no-script { margin-top: 8px; padding: 18px; }
.no-script h1 { margin-top: 0; font-size: .9rem; }
.no-script p, .no-script li { font-size: .78rem; line-height: 1.5; }
.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; }

@media (max-width: 650px) {
  .mud-shell { width: calc(100% - 14px); padding: 7px 0 16px; }
  .site-header { align-items: flex-start; gap: 14px; }
  .site-header p { font-size: .7rem; }
  .return-link { max-width: 110px; }
  .room-directory { display: block; }
  .directory-label { display: block; border-right: 0; border-bottom: 1px solid var(--line); }
  .room-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-link { border-bottom: 1px solid var(--line); }
  .room-link:nth-child(even) { border-right: 0; }
  .room-link:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .terminal-bar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .current-exits { align-items: flex-start; flex-direction: column; }
  #exit-buttons { justify-content: flex-start; }
  .transcript { min-height: 350px; height: 50svh; padding: 13px; }
  .live-panel > header { align-items: stretch; flex-direction: column; gap: 10px; }
  .live-link { justify-content: center; }
  .provider-frame { min-height: 430px; height: 65svh; }
}

@media (max-width: 390px) {
  .command-form { grid-template-columns: auto minmax(0, 1fr); }
  .command-form button { grid-column: 2; }
}
