:root {
  --bg: #040404;
  --glass: rgba(16, 16, 32, 0.7);
  --text: #f2f2f2;
  --accent: #ffffff;
  --background-base: radial-gradient(circle at top, #0b0b1c 0%, #030306 70%);
  --background-image: url("/static/images/background.png");
  --ui-surface-image: none;
  --ui-surface-size: cover;
  --ui-surface-repeat: no-repeat;
  font-family: "Inter", "Space Grotesk", system-ui, sans-serif;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100vh;
  background: var(--background-base);
  background-size: cover;
  color: var(--text);
  font-size: 17px;
}

#app {
  min-height: 100vh;
  height: 100vh;
}

body.mobile-blocked {
  background: #000;
}

body.mobile-blocked #app {
  display: none;
}

.mobile-blocker {
  position: fixed;
  inset: 0;
  background: #000;
  color: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
  z-index: 9999;
}

.mobile-blocker-icon {
  font-family: "Instrument Serif", serif;
  font-size: clamp(96px, 28vw, 220px);
  line-height: 1;
}

.mobile-blocker-message {
  font-family: "Instrument Serif", serif;
  font-size: clamp(18px, 4vw, 36px);
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.mobile-blocker.show-message .mobile-blocker-message {
  opacity: 1;
}

body.has-background-image {
  background: var(--background-image), var(--background-base);
  background-repeat: repeat, no-repeat;
  background-size: auto, cover;
  background-position: top left, center;
}

body.has-ui-background {
  --ui-surface-size: auto;
  --ui-surface-repeat: repeat;
}

* {
  box-sizing: border-box;
}

h1,
h2,
h3 {
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent), #0ff 50%), 0 0 24px rgba(0, 0, 0, 0.4);
  padding-left: 0.5em;
}

.hidden {
  display: none !important;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "landmarks chat inventory";
  gap: 1rem;
  padding: 1rem;
  width: 98vw;
  margin: 0 auto;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

main.has-shop {
  grid-template-columns: 260px 1fr 320px;
  grid-template-rows: minmax(0, 1fr) minmax(320px, 38vh);
  grid-template-areas:
    "landmarks shop inventory"
    "chat chat inventory";
}

main.store-focused {
  grid-template-columns: 260px 1fr 320px;
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "landmarks shop inventory";
}

main.store-focused #chat-panel {
  display: none;
}

#landmarks-panel h3 {
  padding-left: 0.75rem;
}

#landmarks-panel,
#chat-panel,
#inventory-panel {
  min-height: 0;
}

#landmarks-panel {
  grid-area: landmarks;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
}

#online-users {
  min-height: 0;
  max-height: 32vh;
  overflow-y: auto;
  padding-right: 0.15rem;
}

#shop-panel {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

main.has-shop #shop-panel {
  display: flex;
  grid-area: shop;
}

#chat-panel {
  grid-area: chat;
}

#inventory-panel {
  grid-area: inventory;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

.landmark-preview {
  margin-top: auto;
  display: flex;
  justify-content: center;
  padding: 0.85rem 1rem 1rem;
}

.landmark-preview img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  opacity: 0.68;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  margin: 0.2rem;
}

header {
  margin: 1rem auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 60px rgba(0, 0, 0, 0.55);
  width: 98vw;
}

.location-info h2 {
  margin: 0;
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 1.15rem;
}

.location-info .divider {
  opacity: 0.6;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  text-align: right;
}

.audio-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.audio-controls button {
  background: transparent;
  color: var(--text);
  border: none;
  box-shadow: none;
  border-radius: 999px;
  width: 2.6rem;
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.15rem;
  cursor: pointer;
  transition: color 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.audio-controls button.muted {
  color: rgba(255, 255, 255, 0.7);
  filter: grayscale(1);
  opacity: 0.65;
}

.audio-controls button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.user-display {
  font-weight: 700;
  font-size: 1.05rem;
}

.user-entropy {
  font-size: 0.95rem;
  opacity: 0.85;
}

.glass {
  background: var(--glass);
  background-image: var(--ui-surface-image);
  background-size: var(--ui-surface-size);
  background-blend-mode: lighten;
  background-repeat: var(--ui-surface-repeat);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 25px rgba(255, 255, 255, 0.04);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

#chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;
  width: 100%;
}

#chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  position: relative;
}

#chat-window,
#inventory {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 65%, rgba(255, 255, 255, 0.25))
    rgba(255, 255, 255, 0.05);
}

#chat-window::-webkit-scrollbar,
#inventory::-webkit-scrollbar {
  width: 10px;
}

#chat-window::-webkit-scrollbar-track,
#inventory::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

#chat-window::-webkit-scrollbar-thumb,
#inventory::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 65%, rgba(255, 255, 255, 0.24));
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.message.me {
  background: color-mix(in srgb, rgba(255, 255, 255, 0.04) 97%, var(--accent) 3%);
  border-color: rgba(255, 255, 255, 0.11);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.typing-indicator {
  padding: 0.25rem 1rem;
  font-size: 0.92rem;
  opacity: 0.85;
  color: color-mix(in srgb, var(--accent), #fff 35%);
  min-height: 1.5rem;
}

.typing-indicator.hidden {
  display: block !important;
  visibility: hidden;
}

.typing-indicator strong {
  color: var(--text);
}

.message {
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  opacity: 1;
  transition: background-color 0.25s ease;
}

.message-enter {
  opacity: 1;
}

.message-visible {
  opacity: 1;
}

.message-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.message-name-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.message .timestamp {
  opacity: 0.7;
  font-size: 0.85rem;
}

.message p {
  margin: 0.35rem 0 0;
}

.message.shadow-message p,
.message.shadow-message .shadow-echo {
  font-family: serif;
  font-weight: 400;
}

.message.shadow-message strong.shadow-name {
  pointer-events: none;
  text-decoration: none;
  letter-spacing: 0.08em;
}

.message.shadow-message p strong {
  font-weight: 400;
  letter-spacing: normal;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
}

.chat-validation {
  padding: 0 1rem 0.5rem;
  color: color-mix(in srgb, var(--accent), #ffffff 35%);
  font-size: 0.92rem;
  opacity: 0.9;
}

#chat-input {
  flex: 1;
  display: flex;
  align-items: center;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 3.25rem;
}

#chat-input::placeholder {
  line-height: 1.6;
}

#send-btn {
  width: 3.25rem;
  min-width: 3.25rem;
  padding: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#send-btn .send-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 1.15rem;
  position: relative;
  z-index: 1;
}

#send-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--cooldown-progress, 0) * 100%);
  background: var(--accent);
  opacity: 0.4;
  transition: height 120ms linear;
  pointer-events: none;
}

.command-hints {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blackjack-panel {
  margin: 0 1rem 1rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 80% 0%, rgba(0, 255, 204, 0.1), rgba(0, 0, 0, 0)),
    rgba(255, 255, 255, 0.03);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.blackjack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.blackjack-header h3 {
  margin: 0 0 0.25rem;
}

.blackjack-header p {
  margin: 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

.blackjack-edge {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.blackjack-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.blackjack-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

#blackjack-bet {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  min-width: 180px;
}

.blackjack-result {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.blackjack-hands {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.blackjack-hand {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.blackjack-hand strong {
  display: block;
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}

.blackjack-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blackjack-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  width: 64px;
  height: 88px;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #fdfdfd, #f1f1f6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.blackjack-card.face-down {
  background: linear-gradient(135deg, #0d1224, #131a2c);
  color: #c9d1ff;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04), 0 10px 18px rgba(0, 0, 0, 0.35);
  align-items: center;
  justify-content: center;
}

.blackjack-card .blackjack-rank {
  font-size: 1.25rem;
}

.blackjack-card .blackjack-suit {
  font-size: 1.05rem;
  align-self: flex-end;
}

.blackjack-card.red-suit {
  color: #d43b62;
}

.blackjack-card.black-suit {
  color: #0e1624;
}

.blackjack-outcome {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.command-pill {
  padding: 0.35rem 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: #050505;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent), #0ff 35%));
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: var(--accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent), #0ff 40%));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.auth-panel {
  position: fixed;
  inset: 0;
  background-color: #000;
  background-image: url("/static/images/background.png");
  background-repeat: repeat;
  background-position: top center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 1rem;
  overflow: hidden;
}

.auth-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 65%, rgba(0, 0, 0, 0.95) 100%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(460px, 92vw);
  padding: 3rem 2.5rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-card.splash {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.prologue-card {
  background: rgba(8, 7, 16, 0.75);
  border-radius: 16px;
  color: #f2f1eb;
  width: min(700px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.prologue-prose {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.8;
  text-align: left;
  min-height: 14rem;
  border-left: 2px solid color-mix(in srgb, var(--accent), #fff 30%);
  padding-left: 1.5rem;
  position: relative;
  white-space: pre-wrap;
}


.typewriter-caret {
  display: inline-block;
  width: 2px;
  height: 1.4em;
  margin-left: 4px;
  background: color-mix(in srgb, var(--accent), #fff 30%);
  animation: blink 1s steps(2, start) infinite;
  vertical-align: bottom;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.prologue-chat {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
  text-align: left;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.prologue-chat.visible {
  opacity: 1;
}

.prologue-chat label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.prologue-chat textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  padding: 0.85rem 1rem;
  resize: vertical;
  min-height: 80px;
  font-family: "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
}

.prologue-chat button {
  align-self: flex-end;
  width: auto;
}

.auth-title {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-size: clamp(2.2rem, 4vw, 3rem);
  letter-spacing: 0.18em;
  color: #f5f5f5;
  margin: 0;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 255, 255, 0.2);
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
}

.auth-title-line {
  display: inline-block;
  width: min(22ch, 100%);
  text-align: center;
}

.auth-title-line.secondary {
  font-size: 1.7em;
}

.auth-card input,
.auth-card button {
  width: 100%;
}

.rules {
  padding: 0 1rem 1rem 1rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.landmark-item,
.inventory-item,
.shop-item,
.user-pill {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0.65rem;
  margin-bottom: 0.5em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.2em;
  margin-right: 0.2em;
}

.user-pill-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.landmark-item {
  color: rgba(242, 242, 242, 0.7);
}

.inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
}

.inventory-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.25rem;
  border-radius: 8px;
  margin-right: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.inventory-actions,
.shop-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.shop-actions {
  width: 100%;
  justify-content: flex-start;
}

.shop-actions button {
  flex: 1;
}

.inventory-label {
  text-align: left;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.inventory-qty {
  min-width: 2.75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

#inventory { 
  overflow-y: auto;
}

#shop {
  overflow-y: auto;
}

#inventory.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

#inventory.store-grid .inventory-item {
  margin-bottom: 0;
}

.landmark-item.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.landmark-item.child-landmark {
  margin-left: 0.75rem;
}

.landmark-item.locked {
  color: rgba(242, 242, 242, 0.5);
}

.landmark-item.locked .lock-indicator {
  opacity: 0.65;
}

.landmark-item button,
.shop-item button {
  padding: 0.5rem 1rem;
}

.panel-section {
  margin-bottom: 0;
}

#inventory-section,
#shop-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.65));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.dialog-backdrop.hidden {
  display: none;
}

.dialog-window {
  width: min(540px, 90vw);
  border-radius: 10px;
  background: #f4f7ff;
  color: #020202;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 0 2px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.dialog-titlebar {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent), #1a1a1a 35%));
  color: #0c0c0c;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}

.dialog-titlebar .dialog-close {
  background: linear-gradient(145deg, #f05, #e1e8ff);
  color: #050505;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-weight: 900;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.dialog-body {
  padding: 1.25rem;
  font-size: 0.98rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 255, 0.96));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #0b0b15;
}

.dialog-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.dialog-option-button {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: linear-gradient(180deg, #f9f9ff, #eef2ff);
  color: #060606;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.dialog-option-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.dialog-option-button:active {
  transform: translateY(1px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18) inset;
}

.dialog-input-wrap {
  padding: 0 1.25rem 1rem;
}

.dialog-input-wrap input {
  width: 100%;
  padding: 0.85rem 0.9rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  color: #060606;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dialog-input-wrap select {
  width: 100%;
  padding: 0.85rem 0.9rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  color: #060606;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-top: 0.5rem;
}

.dialog-actions {
  padding: 0.75rem 1.25rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent);
}

.dialog-actions button {
  min-width: 120px;
  border-radius: 10px;
}

#shop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}

.shop-item {
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 0.65rem;
  padding: 0.9rem 1rem 1rem;
  height: 100%;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.shop-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.shop-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.shop-icon {
  font-size: 1.9rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.08));
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.shop-name {
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
}

.shop-price {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.95;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  width: fit-content;
}

.shop-description {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.4;
  color: rgba(242, 242, 242, 0.82);
}

.full-width {
  width: 100%;
}

.user-pill {
  cursor: pointer;
}

.npc-pill {
  align-items: center;
  gap: 0.4rem;
}

.npc-pill strong {
  font-weight: 800;
}

.npc-indicator {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.npc-dialog-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.7));
  backdrop-filter: blur(6px);
  z-index: 20;
  overflow: auto;
}

.npc-dialog {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: stretch;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "IBM Plex Mono", "Roboto Mono", "SFMono-Regular", ui-monospace, monospace;
  max-height: min(640px, calc(100vh - clamp(2.5rem, 6vw, 5rem)));
  height: min(640px, calc(100vh - clamp(2.5rem, 6vw, 5rem)));
  max-width: min(1040px, 100%);
  width: min(92vw, 1040px);
  margin: auto;
}

@media (max-width: 960px) {
  .npc-dialog {
    grid-template-columns: 1fr;
    max-height: 90vh;
  }
}

.npc-visual {
  position: relative;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35) inset, 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.npc-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  mix-blend-mode: darken;
  animation: npc-flicker 0.132s steps(8, jump-end) infinite;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.45));
}

@keyframes npc-flicker {
  0% {
    opacity: 1;
  }
  87.5% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.npc-location-label {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.npc-dialog-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.npc-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.npc-dialog-body {
  min-height: 120px;
  max-height: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  overflow-y: auto;
}

.npc-dialog-body p {
  margin: 0;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.npc-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.npc-action {
  background: #ffffff;
  border: 1px solid #0d0d0d;
  padding: 1.2rem 1.1rem;
  border-radius: 12px;
  color: #050505;
  cursor: pointer;
  font-family: "Space Grotesk", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  min-height: 3.2rem;
}

.npc-action:hover {
  transform: translateY(-1px);
  border-color: #1f1f1f;
  background: #f7f7f7;
}

.npc-action.primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, #ffffff 85%), #ffffff);
  border-color: color-mix(in srgb, var(--accent) 40%, #0d0d0d 60%);
  color: #070707;
  font-weight: 800;
}

.npc-action.selected {
  box-shadow: none;
  background: #efefef;
  border-color: #1f1f1f;
}

body.npc-locked #landmarks-panel,
body.npc-locked #inventory-panel,
body.npc-locked #shop-section,
body.npc-locked header {
  pointer-events: none;
  opacity: 0.6;
}

.clickable-name {
  cursor: pointer;
}

.equipped-icons {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.25rem;
  font-size: 0.95em;
  vertical-align: middle;
}

.message-header .equipped-icons {
  align-items: center;
}

.user-pill .equipped-icons {
  margin-left: 0.4rem;
}

.equipped-icon {
  line-height: 1;
}

#user-modal .user-modal-window {
  width: min(360px, 92vw);
  border-radius: 12px;
  background: #0d0d19;
  color: #f5f5ff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.user-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-modal-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.user-modal-title small {
  opacity: 0.7;
}

.user-modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-modal-section {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-modal-section h4 {
  margin: 0 0 0.35rem;
}

#user-modal-equipment {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#user-modal-equipment li {
  opacity: 0.9;
}

.user-modal-window button {
  width: 100%;
}

.user-modal-admin-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#user-modal-ban-duration {
  flex: 1;
}

#user-modal-ban,
#user-modal-unban,
#user-modal-kick,
#user-modal-info {
  flex: 1;
}

.user-modal-admin-info {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}

.item-viewer-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(3, 4, 10, 0.8), rgba(0, 0, 0, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 12;
  backdrop-filter: blur(6px) saturate(120%);
}

.item-viewer-backdrop.hidden {
  display: none;
}

.item-viewer-surface {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(245, 245, 255, 0.96));
  color: #0b0b15;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.12);
  max-width: min(960px, 94vw);
  max-height: 90vh;
  overflow: hidden;
  padding: 1rem;
}

.style-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.photo-card img,
.drawing-sheet img,
.book-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.photo-card img {
  max-height: 70vh;
}

.photo-description,
.drawing-meta {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  color: #0d0d15;
}

.photo-description {
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0.9;
}

.drawing-card {
  gap: 0.5rem;
}

.drawing-sheet {
  background: #fdfcf8;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 0.75rem;
  aspect-ratio: 8.5 / 11;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.drawing-sheet img {
  object-fit: contain;
  background: linear-gradient(135deg, #fefefe, #f7f7f7);
}

.drawing-title {
  font-weight: 800;
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
}

.book-viewer {
  background: radial-gradient(circle at 50% 20%, #f5f0e7, #e3d6c3 65%, #d1c5b3);
  border-radius: 14px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.08);
  padding: 1.2rem;
  min-width: min(840px, 90vw);
  font-family: "Space Grotesk", system-ui, sans-serif;
  --book-cover-color: #808080;
}

.book-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.book-color-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #21160f;
}

.book-color-label input[type="color"] {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: #f8f6f3;
  cursor: pointer;
}

.book-spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: 0.75rem;
}

.book-spread.single {
  grid-template-columns: 1fr;
}

.book-page {
  position: relative;
  background: linear-gradient(135deg, #fefaf3, #f1e7d8);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.9rem 1rem;
  width: 100%;
  min-height: 320px;
  aspect-ratio: 11 / 17;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 10px 30px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  cursor: pointer;
}

.book-page.cover {
  background: linear-gradient(
      140deg,
      color-mix(in srgb, var(--book-cover-color), #0e0a08 20%),
      color-mix(in srgb, var(--book-cover-color), #120e0c 45%),
      color-mix(in srgb, #0d0d0d, var(--book-cover-color) 25%)
    ),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 55%);
  color: #fdfbf6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 0 32px rgba(0, 0, 0, 0.35),
    0 10px 30px rgba(0, 0, 0, 0.4);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.book-page.cover::before {
  content: "";
  position: absolute;
  inset: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  opacity: 0.8;
}

.book-page.cover-front {
  background: linear-gradient(
      125deg,
      color-mix(in srgb, var(--book-cover-color), #130c0a 35%),
      color-mix(in srgb, var(--book-cover-color), #000000 60%),
      color-mix(in srgb, var(--book-cover-color), #050505 80%)
    ),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.16), transparent 50%);
}

.book-page.cover-back {
  background: linear-gradient(
      135deg,
      color-mix(in srgb, var(--book-cover-color), #0c0f17 18%),
      color-mix(in srgb, #0c0c0c, var(--book-cover-color) 25%),
      color-mix(in srgb, #020202, var(--book-cover-color) 5%)
    );
  color: #f3efe7;
}

.book-page h4 {
  margin: 0;
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.6rem;
  line-height: 1.1;
  text-align: center;
}

.book-page.cover {
  align-items: center;
}

.book-page.cover h4 {
  margin-top: 24%;
  font-size: 2.3rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, #fdfbf6 70%, var(--book-cover-color) 30%);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5),
    0 -2px 3px rgba(0, 0, 0, 0.32),
    0 10px 16px rgba(0, 0, 0, 0.4);
}

.book-page p {
  margin: 0;
  line-height: 1.55;
  font-size: 0.98rem;
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0.01em;
}

.book-stack-hint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
      -90deg,
      rgba(0, 0, 0, 0.05) 0px,
      rgba(0, 0, 0, 0.05) 3px,
      transparent 3px,
      transparent 6px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.35) 0px,
      rgba(255, 255, 255, 0.35) 4px,
      transparent 4px,
      transparent 8px
    );
  opacity: 0.28;
  border-radius: 10px;
}

.book-page.placeholder {
  background: linear-gradient(135deg, #f5f1e9, #e9e0d4);
  border-style: dashed;
  opacity: 0.8;
}

.book-empty {
  grid-column: span 2;
  text-align: center;
  padding: 1rem;
  opacity: 0.8;
}

@media (max-width: 960px) {
  main {
    grid-template-columns: 1fr;
  }
  aside {
    order: 2;
  }
  #chat-panel {
    order: 1;
  }
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .user-info {
    align-items: flex-start;
    text-align: left;
  }
  main {
    padding: 0.75rem;
  }
  .auth-card {
    padding: 1.5rem;
  }
}
:root {
  --bg: #040404;
}