:root {
  color-scheme: dark;
  --bg: #14120f;
  --panel: #221e18;
  --ink: #f3ead8;
  --muted: #b7ab96;
  --line: #3c3428;
  --accent: #e0b15a;
  --here: #f3ead8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 Georgia, "Iowan Old Style", serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

nav { display: flex; gap: 8px; }

button, input {
  font: inherit;
  color: inherit;
}

.tab, #command button, .choice, .exit, .thing, #picture-button {
  border: 1px solid var(--line);
  background: #2b261f;
  border-radius: 10px;
}

.tab.on, .choice {
  background: var(--accent);
  color: #241c10;
  border-color: var(--accent);
}

.tab, #command button, .choice {
  min-height: 44px;
  padding: 8px 14px;
}

main, #map-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#picture-wrap {
  margin: 0;
  background: #0c0b09;
}

#picture-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #0c0b09;
  position: relative;
  height: 34dvh;
}

#picture {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: none;
}

#picture.show { display: block; }

#picture-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

#picture.show + #picture-empty { display: none; }

#room-title {
  padding: 8px 12px 0;
  font-weight: bold;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 0;
}

.exit, .thing, .choice {
  min-height: 44px;
  text-align: left;
}

.thing {
  flex: 1 1 100%;
  padding: 8px 12px;
}

#log {
  flex: 1;
  overflow: auto;
  margin: 8px 12px;
  padding: 8px 0;
  white-space: pre-wrap;
  border-top: 1px solid var(--line);
}

#log .me { color: var(--muted); }

#command {
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}

#line {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c0b09;
  font-size: 16px;
}

#map-screen { padding: 8px; }

#map {
  width: 100%;
  height: 100%;
  min-height: 240px;
  touch-action: manipulation;
}

#map-empty {
  color: var(--muted);
  margin: 12px;
}

.hidden { display: none !important; }

body.playing #picture-wrap,
body.playing #exits,
body.playing #things { display: flex; }

body:not(.playing) #picture-wrap,
body:not(.playing) #exits,
body:not(.playing) #things,
body:not(.playing) #actions { display: none; }
