﻿:root {
  --bg-main: #071f2e;
  --bg-card: rgba(8, 22, 33, 0.9);
  --bg-card-strong: rgba(6, 16, 25, 0.95);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eaf5ff;
  --muted: #a8c2d8;
  --accent: #31d0aa;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
}

a {
  color: inherit;
}

.page-entry {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 10% 20%, #20607c, #061320 62%);
  padding: 24px;
}

.entry-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.entry-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: var(--bg-card);
}

.entry-panel h1,
.preview-panel h2 {
  margin: 0 0 10px;
}

.entry-panel p,
.preview-panel p {
  margin: 0 0 14px;
  color: var(--muted);
}

label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #091521;
  font-size: 0.95rem;
}

button,
.btn-primary,
.btn-ghost {
  border: none;
  border-radius: 10px;
  padding: 11px 13px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  background: linear-gradient(90deg, #28c8a8, #2ad2dc);
  color: #042028;
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-ghost.compact {
  display: inline-block;
  width: auto;
  margin-top: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

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

.swatch {
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  width: 100%;
  aspect-ratio: 1 / 0.5;
  min-height: 0;
  padding: 0;
}

.swatch.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.preview-stage {
  position: relative;
  height: 520px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.17);
  background: linear-gradient(180deg, #0a2b3f 0%, #062033 65%, #051823 100%);
}

.preview-ground {
  position: absolute;
  inset: auto 0 0 0;
  height: 72px;
  background: repeating-linear-gradient(
    -18deg,
    rgba(255, 255, 255, 0.11),
    rgba(255, 255, 255, 0.11) 20px,
    rgba(255, 255, 255, 0.07) 20px,
    rgba(255, 255, 255, 0.07) 40px
  );
}

.preview-character {
  position: absolute;
  left: 50%;
  bottom: 42px;
  width: 300px;
  height: 300px;
  transform: translateX(-50%);
}

.preview-name {
  position: absolute;
  left: 50%;
  top: -38px;
  transform: translateX(-50%);
  max-width: 260px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.preview-character img {
  width: 100%;
  height: 100%;
  display: block;
}

.server-info {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(84, 226, 196, 0.45);
  background: linear-gradient(90deg, rgba(35, 125, 118, 0.35), rgba(15, 74, 97, 0.35));
  box-shadow: 0 10px 26px rgba(4, 18, 26, 0.3);
}

.server-pill {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: #d8fff4;
  font-weight: 700;
  font-size: 0.95rem;
}

.server-info p {
  margin: 0;
  color: #e8feff;
  font-size: 1rem;
  line-height: 1.4;
}

.page-room {
  overflow: hidden;
  background: #02111d;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 10, 16, 0.94);
  backdrop-filter: blur(4px);
}

.rotate-overlay.visible {
  display: flex;
}

.rotate-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(10, 22, 35, 0.94);
  display: grid;
  gap: 6px;
  text-align: center;
}

.rotate-card strong {
  font-size: 1.1rem;
}

.rotate-card span {
  color: #cde4f5;
}

.mobile-hud-btn {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 35;
  width: 54px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(5, 17, 28, 0.92);
  color: #dff4ff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0;
}

.room-hud {
  position: fixed;
  z-index: 30;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card-strong);
  backdrop-filter: blur(6px);
}

.room-meta {
  top: 12px;
  left: 12px;
  min-width: 220px;
}

.room-meta div {
  margin-bottom: 6px;
  color: #d7f5ff;
}

.room-missions {
  top: 12px;
  right: 12px;
  width: min(360px, 92vw);
  max-height: 70vh;
  overflow: auto;
}

.room-help {
  left: 12px;
  bottom: 14px;
  width: min(340px, 90vw);
}

.room-help p {
  margin: 0 0 5px;
  color: #d2ebfc;
}

.missions-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mission-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.mission-list.compact .mission-item {
  padding: 8px;
}

.mission-list.compact .mission-desc {
  font-size: 0.82rem;
}

.mission-item {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.mission-item.completed {
  border-color: rgba(49, 208, 170, 0.75);
  background: rgba(49, 208, 170, 0.13);
}

.mission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.mission-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.mission-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.mission-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #37c8f2, #31d0aa);
}

.action-dock {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 31;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.touch-controls {
  position: fixed;
  left: calc(12px + env(safe-area-inset-left));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 34;
  display: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-controls.visible {
  display: block;
}

.touch-joystick-base {
  width: 142px;
  height: 142px;
  border-radius: 999px;
  border: 2px solid rgba(212, 212, 212, 0.62);
  background: radial-gradient(circle at 35% 35%, rgba(170, 170, 170, 0.42), rgba(90, 90, 90, 0.38));
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.28), 0 8px 18px rgba(0, 0, 0, 0.36);
  display: flex;
  align-items: center;
  justify-content: center;
}

.touch-joystick-knob {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 2px solid rgba(232, 232, 232, 0.95);
  background: linear-gradient(180deg, rgba(206, 206, 206, 0.95), rgba(118, 118, 118, 0.95));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: translate(0, 0);
}

.action-btn {
  width: 92px;
  height: 92px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, rgba(8, 24, 37, 0.96), rgba(8, 17, 29, 0.96));
  color: #e9f5ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, border-color 120ms ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.55);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.action-btn span {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.map-btn-icon {
  border-color: rgba(76, 203, 219, 0.6);
}

.kill-btn {
  border-color: rgba(255, 91, 91, 0.58);
}

.action-toast {
  position: fixed;
  left: 50%;
  bottom: 126px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(5, 16, 26, 0.95);
  color: #f2f8ff;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.action-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

@media (max-width: 980px) {
  .page-room {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .entry-layout {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    height: 380px;
  }

  .preview-character {
    width: 220px;
    height: 220px;
  }

  .preview-name {
    max-width: 190px;
    font-size: 15px;
    top: -34px;
  }

  .server-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .room-missions {
    top: calc(38px + env(safe-area-inset-top));
    right: calc(6px + env(safe-area-inset-right));
    width: min(42vw, 220px);
    max-height: 42vh;
    display: none;
    padding: 7px;
    border-radius: 10px;
    background: rgba(6, 15, 24, 0.84);
    backdrop-filter: blur(4px);
    z-index: 33;
  }

  .page-room.show-missions .room-missions {
    display: block;
  }

  .room-missions h2 {
    font-size: 0.78rem;
    margin: 0;
  }

  .room-missions .mission-item {
    padding: 5px;
  }

  .room-missions .missions-head {
    margin-bottom: 4px;
  }

  .room-missions .mission-desc {
    font-size: 0.62rem;
    margin-bottom: 5px;
  }

  .room-meta {
    display: none;
  }

  .room-meta div {
    margin-bottom: 3px;
    font-size: 0.76rem;
  }

  .room-meta .btn-ghost.compact {
    display: none;
  }

  .mobile-hud-btn {
    display: block;
    top: calc(6px + env(safe-area-inset-top));
    right: calc(6px + env(safe-area-inset-right));
    width: 46px;
    height: 30px;
    font-size: 0.64rem;
    border-radius: 8px;
  }

  .action-dock {
    right: calc(6px + env(safe-area-inset-right));
    bottom: calc(6px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    z-index: 36;
  }

  .touch-controls {
    left: calc(8px + env(safe-area-inset-left));
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .touch-joystick-base {
    width: 96px;
    height: 96px;
    opacity: 0.86;
  }

  .touch-joystick-knob {
    width: 40px;
    height: 40px;
  }

  .action-btn {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    padding: 0;
    background: rgba(8, 17, 29, 0.74);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
  }

  .action-btn img {
    width: 18px;
    height: 18px;
  }

  .action-btn span {
    display: none;
  }

  .action-toast {
    bottom: calc(52px + env(safe-area-inset-bottom));
    width: auto;
    max-width: 82vw;
    padding: 7px 9px;
    font-size: 0.75rem;
    text-align: center;
  }

  .room-help {
    display: none;
  }

  .page-room.is-portrait .room-hud,
  .page-room.is-portrait .action-dock,
  .page-room.is-portrait .touch-controls,
  .page-room.is-portrait .mobile-hud-btn,
  .page-room.is-portrait #game {
    visibility: hidden;
    pointer-events: none;
  }
}
