* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #151916;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6f3e8;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #151916;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(16, 20, 17, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.panel {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(246, 243, 232, 0.18);
  background: rgba(15, 20, 16, 0.78);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.panel__eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0b45b;
}

.panel__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.panel__meta,
.panel__note {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(246, 243, 232, 0.68);
}

.panel__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(246, 243, 232, 0.9);
}

.panel__note {
  margin: 0;
}

.panel__source {
  justify-self: start;
  color: #7dd6c2;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.panel__source:hover {
  color: #f6f3e8;
}

.panel__actions,
.chat-form,
.club-ai-form {
  display: flex;
  gap: 8px;
}

.panel-button {
  min-height: 32px;
  padding: 0 12px;
  border: 2px solid rgba(246, 243, 232, 0.28);
  border-radius: 0;
  background: rgba(35, 48, 40, 0.92);
  color: #f6f3e8;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.panel-button--primary {
  border-color: rgba(240, 180, 91, 0.78);
  background: #f0b45b;
  color: #172018;
}

.landmark-panel {
  left: 16px;
  top: 102px;
  width: min(310px, calc(100vw - 32px));
}

.landmark-photo {
  height: 118px;
  border: 2px solid rgba(246, 243, 232, 0.16);
  background-color: rgba(8, 12, 10, 0.72);
  background-repeat: no-repeat;
  image-rendering: auto;
}

.landmark-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.landmark-list__item,
.presence {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 2px solid rgba(246, 243, 232, 0.14);
  border-radius: 0;
  background: rgba(30, 41, 34, 0.78);
  color: #f6f3e8;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.landmark-list__item span,
.presence span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.landmark-list__item small,
.presence small {
  color: rgba(246, 243, 232, 0.58);
  font-size: 10px;
}

.landmark-list__item.is-active {
  border-color: rgba(240, 180, 91, 0.86);
  background: rgba(68, 55, 32, 0.92);
}

.social-panel {
  right: 16px;
  bottom: 18px;
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100vh - 216px);
  overflow: auto;
}

.ai-panel {
  right: 16px;
  top: 218px;
  width: min(330px, calc(100vw - 32px));
}

.ai-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-actions .panel-button {
  padding: 0 6px;
}

.club-ai-form input {
  min-width: 0;
  flex: 1;
  height: 32px;
  padding: 0 9px;
  border: 2px solid rgba(246, 243, 232, 0.18);
  border-radius: 0;
  background: rgba(8, 12, 10, 0.5);
  color: #f6f3e8;
  font: inherit;
  font-size: 12px;
}

.club-ai-form input::placeholder {
  color: rgba(246, 243, 232, 0.46);
}

.ai-output {
  min-height: 104px;
  max-height: 176px;
  overflow: auto;
  padding: 10px;
  border: 2px solid rgba(246, 243, 232, 0.12);
  background: rgba(8, 12, 10, 0.42);
  color: rgba(246, 243, 232, 0.9);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.presence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.presence {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.presence small {
  grid-column: 2;
}

.presence__dot {
  width: 10px;
  height: 10px;
  background: var(--presence-color);
  box-shadow: 0 0 0 2px rgba(246, 243, 232, 0.2);
}

.activity-card,
.chat-log {
  border: 2px solid rgba(246, 243, 232, 0.12);
  background: rgba(8, 12, 10, 0.42);
}

.activity-card {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.activity-card strong {
  color: #f0b45b;
  font-size: 13px;
}

.activity-card span,
.activity-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.chat-log {
  display: grid;
  gap: 6px;
  max-height: 128px;
  overflow: auto;
  padding: 8px;
}

.chat-message {
  display: grid;
  gap: 2px;
}

.chat-message strong {
  color: #7ee091;
  font-size: 11px;
}

.chat-message span {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(246, 243, 232, 0.86);
}

.chat-form input {
  min-width: 0;
  flex: 1;
  border: 2px solid rgba(246, 243, 232, 0.18);
  border-radius: 0;
  background: rgba(8, 12, 10, 0.72);
  color: #f6f3e8;
  font: inherit;
  font-size: 12px;
  padding: 0 10px;
}

.chat-form input::placeholder {
  color: rgba(246, 243, 232, 0.42);
}

.minimap {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 8px;
  padding: 10px 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(16, 20, 17, 0.74);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.minimap__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(246, 243, 232, 0.78);
}

#minimap {
  display: block;
  width: 220px;
  height: 140px;
  border-radius: 8px;
  background: rgba(10, 14, 11, 0.72);
  cursor: crosshair;
}

.brand {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.status {
  min-width: 180px;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(246, 243, 232, 0.78);
}

.joystick {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 6;
  width: 144px;
  height: 144px;
  background: url("../assets/ui/joystick/joystick-base.png") center / contain no-repeat;
  filter: drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.22));
  touch-action: none;
  user-select: none;
}

.joystick__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 68px;
  background: url("../assets/ui/joystick/joystick-knob.png") center / contain no-repeat;
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, 0.28));
  transform: translate(-50%, -50%);
}

@media (min-width: 760px) {
  .joystick {
    left: 28px;
    bottom: 28px;
    width: 150px;
    height: 150px;
  }

  .joystick__knob {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 759px) {
  .minimap {
    top: 14px;
    right: 14px;
    padding: 8px 8px 10px;
  }

  #minimap {
    width: 168px;
    height: 108px;
  }

  .landmark-panel {
    top: auto;
    bottom: 184px;
    max-height: 42vh;
    overflow: auto;
  }

  .social-panel {
    left: 14px;
    right: auto;
    top: 78px;
    bottom: auto;
    width: min(190px, calc(100vw - 210px));
    max-height: 190px;
    padding: 10px;
    overflow: hidden;
  }

  .social-panel .panel__title,
  .social-panel .activity-card,
  .social-panel .chat-log,
  .social-panel .chat-form {
    display: none;
  }

  .presence-list {
    grid-template-columns: 1fr;
  }

  .ai-panel {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: auto;
    gap: 8px;
    padding: 10px;
  }

  .ai-panel .panel__eyebrow,
  .ai-panel .panel__meta,
  .ai-panel .ai-actions,
  .ai-panel #shareAiButton {
    display: none;
  }

  .ai-panel .panel__title {
    font-size: 15px;
  }

  .ai-output {
    min-height: 54px;
    max-height: 96px;
    padding: 8px;
  }

  .club-ai-form input {
    height: 34px;
  }
}
