html, body { margin: 0; height: 100%; background: #07070d; overflow: hidden; overscroll-behavior: none; }
body { color: #d4d6e4; }

#app { display: flex; flex-direction: column; align-items: center; height: 100%; padding-top: 8px; box-sizing: border-box; }

#pic {
  display: block; flex: none;
  width: 960px; height: 600px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #000;
  box-shadow: 0 0 0 1px #23233a, 0 0 24px #000;
}

#gameport {
  position: relative; flex: 1 1 auto; width: 960px; min-height: 160px;
  margin: 8px 0 8px; background: #07070d;
}

#loadingpane { color: #7a7a9a; font: italic 16px Georgia, serif; }

.WindowFrame { background: #07070d; }

/* status line: Infocom reverse-video bar */
.GridWindow {
  background: #c9ccdf; color: #10101c;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 15px; line-height: 1.25;
  padding: 0;
}
.GridWindow .Style_normal, .GridWindow .Style_input { color: #10101c; }

.BufferWindow {
  background: #07070d;
  color: #d4d6e4;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px; line-height: 1.45;
  padding: 8px 14px;
  scrollbar-color: #2b2b44 #07070d;
}

.Style_emphasized { font-style: italic; color: #eceefa; }
.Style_header, .BufferWindow .Style_header { font-weight: bold; color: #ffe27a; font-size: 1em; }
.Style_subheader { font-weight: bold; color: #ffe27a; }
.Style_alert { font-weight: bold; color: #ff7a5a; }
.Style_preformatted { font-family: "Courier Prime", "Courier New", Courier, monospace; }
.Style_input { color: #8fd18f; font-weight: normal; }

.Input { color: #8fd18f; caret-color: #ffe27a; }
/* The input field must sit on the prompt's baseline in the prompt's font (glkote.css sets its own font, size, weight). */
.BufferWindow .Input {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px; line-height: 1.45; font-weight: normal;
  height: 1.45em; vertical-align: baseline;
}
.MorePrompt { background: #2b2b44; color: #ffe27a; font-family: Georgia, serif; cursor: pointer; pointer-events: auto; }
.PreviousMark { background: #2b2b44; }

#errorpane { background: #5a1c14; color: #fbd; border-bottom: 3px solid #a33; }

/* save/restore dialog */
/* the dialog covers the whole window (GlkOte puts it inside the text pane, below the picture, out of reach) */
#dialog_screen { position: fixed; inset: 0; width: auto; height: auto; background: #000; opacity: 0.6; z-index: 200; }
#dialog_frame { position: fixed; inset: 0; width: auto; height: auto; z-index: 201;
  display: flex; align-items: center; justify-content: center; pointer-events: none; }
#dialog_frame #dialog { position: static; margin: 0; max-height: calc(100vh - 32px); overflow: auto; pointer-events: auto; }
#dialog { background: #141424; color: #d4d6e4; border: 2px solid #3a3a5a; border-radius: 4px; font-family: Georgia, serif; }
#dialog input, #dialog select { background: #07070d; color: #ffe27a; border: 1px solid #3a3a5a; }
#dialog button { background: #2b2b44; color: #ffe27a; border: 1px solid #3a3a5a; padding: 2px 10px; }

#debug {
  position: fixed; top: 8px; right: 8px; z-index: 100;
  background: rgba(10, 10, 20, 0.92); color: #c4c6d8;
  border: 1px solid #3a3a5a; padding: 8px 10px; max-width: 360px; box-sizing: border-box;
  overflow-wrap: anywhere;
  font: 12px/1.45 Menlo, Consolas, monospace;
}
#debug b { color: #ffe27a; font-weight: normal; }
#debug > div { margin-bottom: 2px; }
#debug .hint { color: #5a5a7a; margin-top: 2px; }

/* Z-machine reverse video (see play.js) */
.BufferWindow .Style_blockquote { background: #c9ccdf; color: #10101c; }
.GridWindow .Style_blockquote { background: #c9ccdf; color: #10101c; display: inline-block; vertical-align: top; }

/* multiple choice (play.html?choices): the commands of this state as buttons; the command line hides meanwhile */
#choices { flex: none; display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; margin-bottom: 8px; }
#choices[hidden] { display: none; }
#choices button {
  font: 15px "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; color: #d4d6e4; background: #141424;
  border: 1px solid #3a3a5a; border-radius: 3px; padding: 3px 10px; cursor: pointer;
}
#choices button:hover { background: #2b2b44; color: #ffe27a; }
#choices button.go { color: #ffe27a; border-color: #6a6a3a; }
#choices button.quiet { color: #6a6a8a; border-style: dashed; }
#choices button.verb { color: #ffe27a; }
#choices select {
  font: 15px "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; color: #d4d6e4; background: #141424;
  border: 1px solid #3a3a5a; border-radius: 3px; padding: 3px 6px;
}
#choices button:disabled { opacity: 0.35; cursor: default; }
#choices .note { color: #7a7a9a; font: italic 14px Georgia, serif; padding: 4px; }
body.choosing .BufferWindow .Input { visibility: hidden; }

/* about (the i button) */
#info-button {
  position: fixed; top: 8px; left: 8px; z-index: 100; width: 28px; height: 28px; border-radius: 50%;
  background: #141424; color: #ffe27a; border: 1px solid #3a3a5a; cursor: pointer;
  font: italic bold 16px Georgia, serif;
}
#info-button:hover { background: #2b2b44; }
#info { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; }
#info[hidden] { display: none; }
#info .box {
  max-width: 560px; margin: 16px; padding: 20px 26px; background: #141424; color: #d4d6e4;
  border: 2px solid #3a3a5a; border-radius: 4px; font: 17px/1.5 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
#info h2 { margin: 0 0 10px; color: #ffe27a; font-weight: normal; font-size: 22px; }
#info p { margin: 0 0 12px; }
#info a { color: #ffe27a; }
#info .close, #info .new-game { float: right; margin-left: 8px; background: #2b2b44; color: #ffe27a; border: 1px solid #3a3a5a; padding: 3px 12px; cursor: pointer; font: 15px Georgia, serif; }

/* phones: room above the picture for the i button, a smaller command bar */
@media (max-width: 679px) {
  #info-button { top: 14px; left: 14px; width: 26px; height: 26px; opacity: 0.85; }
  .BufferWindow { font-size: 16px; padding: 6px 8px; }
  .BufferWindow .Input { font-size: 16px; }
  #choices button, #choices select { font-size: 14px; }
  .MorePrompt { font-size: 12px; padding: 1px 6px; border-radius: 8px; opacity: 0.9; }
  /* the walkthrough's bar: back, a wide next and play on one row (where a thumb finds them every time), the chapter
     and the count below */
  #choices.walkbar { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "back next auto" "chapter chapter count"; }
  #choices.walkbar .back { grid-area: back; }
  #choices.walkbar .next { grid-area: next; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; }
  #choices.walkbar .auto { grid-area: auto; }
  #choices.walkbar .chapter { grid-area: chapter; }
  #choices.walkbar .count { grid-area: count; text-align: right; }
}

/* touch screens: the page's own command line under the text (play.js #command); GlkOte's stays hidden */
#command { flex: none; display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 12px;
  background: #141424; border: 1px solid #3a3a5a; border-radius: 4px; box-sizing: border-box; }
#command[hidden] { display: none; }
#command span { color: #d4d6e4; font: 16px "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
#command input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #8fd18f; caret-color: #ffe27a;
  font: 16px "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; padding: 2px 0; }
/* GlkOte's prompt line (and the blank line before it) only shows once a command is sent */
body.own-command .BufferWindow .BufferLine:has(.Input),
body.own-command .BufferWindow .BufferLine.BlankPara:has(+ .BufferLine .Input) { display: none; }

/* resuming a saved game (autosave in play.js) */
#resuming { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 250; padding: 10px 18px;
  background: rgba(20, 20, 36, 0.95); color: #ffe27a; border: 1px solid #3a3a5a; border-radius: 4px;
  font: italic 16px Georgia, serif; }
body.replaying #app { visibility: hidden; }
