:root {
  color-scheme: light;
  --sky: #9fd3ff;
  --ink: #1b1b1b;
}

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

html,
body {
  height: 100%;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  background: var(--sky);
  color: var(--ink);
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 10px 12px;
  border-radius: 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#hud .title {
  font-weight: 600;
  letter-spacing: 0.5px;
}

#hud .hint {
  font-size: 12px;
  opacity: 0.7;
}

.time-display {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  opacity: 0.85;
}

.health-bar {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.health-heart {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.health-heart.filled {
  background: #ff5a5a;
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 6px rgba(255, 90, 90, 0.6);
}

#side-panels {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  z-index: 5;
}

#player-list {
  position: fixed;
  top: 96px;
  left: 16px;
  margin-top: 8px;
  background: rgba(20, 20, 20, 0.7);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 160px;
  max-width: 220px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#branch-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 140px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branch-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.55);
}

.branch-current {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

#branch-port {
  font-size: 11px;
  opacity: 0.6;
}

#branch-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.branch-create {
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.branch-create:hover {
  background: rgba(0, 0, 0, 0.04);
}

#branch-create {
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

#branch-create:hover {
  background: rgba(0, 0, 0, 0.04);
}

.branch-link {
  font-size: 12px;
  color: #1b1b1b;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.branch-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.branch-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.branch-merge {
  font-size: 11px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #1b1b1b;
  color: #fff;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
}

.branch-merge:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.branch-status {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.6);
  min-height: 14px;
}

#task-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  width: min(260px, 44vw);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#branch-panel,
#task-panel {
  position: relative;
  top: auto;
  right: auto;
}

.task-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.55);
}

.feedback-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.5);
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.feedback-header button {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
  font-size: 11px;
}

.feedback-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.feedback-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6ecf8c;
  margin-top: 4px;
  flex: 0 0 auto;
}

.feedback-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.feedback-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.5);
  gap: 8px;
}

.feedback-message {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.8);
  white-space: pre-wrap;
  word-break: break-word;
}


.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4c4c4;
}

.task-status.pending {
  background: #c4c4c4;
}

.task-status.in_progress {
  background: #ffb74d;
}

.task-status.done {
  background: #6ecf8c;
}

.task-feedback {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#task-feedback-input {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  resize: vertical;
}

#task-feedback-send {
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  background: #1b1b1b;
  color: white;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

#task-feedback-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#task-feedback-status {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.6);
  min-height: 14px;
}

#player-list .player-title {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.player-entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.player-self {
  font-size: 11px;
  opacity: 0.6;
  margin-left: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 25;
}

.banner.hidden {
  display: none;
}

.banner-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  padding: 18px 24px;
  min-width: 260px;
  text-align: center;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
}

.modal-branch {
  min-width: 360px;
  gap: 14px;
}

.modal-branch textarea {
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  min-height: 180px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions button {
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #1b1b1b;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.modal-actions button#branch-cancel {
  background: rgba(255, 255, 255, 0.9);
  color: #1b1b1b;
}

.banner-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.banner-text {
  font-size: 14px;
  opacity: 0.7;
}

.modal-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 20px 24px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.interaction-prompt {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.8);
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: 0.4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  z-index: 12;
}

.interaction-prompt.hidden {
  display: none;
}

.dialogue-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

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

.dialogue-card {
  width: min(520px, 90vw);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.dialogue-speaker {
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

.dialogue-text {
  font-size: 14px;
  line-height: 1.5;
  color: #1b1b1b;
}

.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-choice {
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.dialogue-choice:hover {
  background: rgba(0, 0, 0, 0.04);
}

.dialogue-close {
  align-self: flex-end;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #1b1b1b;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.dialogue-empty {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
}

#name-input {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

#name-save {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: #1b1b1b;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

#inventory {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(20, 20, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}


.inventory-slot {
  width: 68px;
  height: 72px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.inventory-slot.filled {
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.4);
}

.inventory-slot.selected {
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.inventory-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.inventory-count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
