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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: 'Georgia', serif;
  color: #f0f0f0;
}

#background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1a2e;
  transition: background-image 0.5s ease;
}

#characters {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#characters img {
  position: absolute;
  bottom: 200px;
  height: 360px;
  transition: opacity 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

#characters img[data-position="left"] {
  left: 20%;
  transform: translateX(-50%);
}

#characters img[data-position="center"] {
  left: 50%;
  transform: translateX(-50%);
}

#characters img[data-position="right"] {
  left: 80%;
  transform: translateX(-50%);
}

#toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

#toolbar button,
#toolbar select,
#toolbar a {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f0f0f0;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-family: 'Georgia', serif;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

#toolbar button:hover:not(:disabled),
#toolbar select:hover,
#toolbar a:hover {
  background: rgba(255, 255, 255, 0.25);
}

#toolbar a {
  text-decoration: none;
  display: inline-block;
}

#vol-down,
#vol-up,
#vol-mute {
  padding: 6px 10px;
}

#toolbar button:disabled {
  opacity: 0.4;
  cursor: default;
}

#text-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  padding: 24px 32px;
  min-height: 100px;
  max-height: 35vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

#text-box.has-pending {
  cursor: pointer;
}

#resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  background: transparent;
}

#resize-handle:hover,
#resize-handle.active {
  background: rgba(255, 255, 255, 0.2);
}

#story-text {
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 16px;
  position: relative;
  min-height: 0;
  overflow-y: auto;
}

#story-text p {
  white-space: pre-line;
}

.end-marker {
  text-align: center;
  font-style: italic;
  opacity: 0.7;
  margin-top: 12px;
}

.next-indicator {
  display: block;
  text-align: right;
  margin-top: 8px;
  font-size: 0.9rem;
  opacity: 0.7;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.2; }
}

#choices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#choices button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f0f0f0;
  padding: 10px 20px;
  font-size: 1rem;
  font-family: 'Georgia', serif;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

#choices button:hover {
  background: rgba(255, 255, 255, 0.25);
}
