/* SeaView (씨뷰) - 광안리 바다멍 온라인 해변 스타일시트 (초미니멀 모바일 퍼스트 + 외부 웹폰트 제로) */
:root {
  --glass-bg: rgba(14, 21, 40, 0.52);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-hover: rgba(255, 255, 255, 0.14);
  --accent-gold: #ffe082;
  --text-main: #f8fafc;
  --text-sub: rgba(248, 250, 252, 0.78);
  --font-sans: 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0d1326;
  font-family: var(--font-sans);
  color: var(--text-main);
}

#worldCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  cursor: grab;
  touch-action: none;
}

#worldCanvas:active {
  cursor: grabbing;
}

#overlayCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  pointer-events: none;
  z-index: 5;
}

.hidden {
  display: none !important;
}

/* --- 바다멍 감상 모드 (UI 숨기기 트랜지션) --- */
.ui-chrome {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

body.cinema-mode .ui-chrome {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.cinema-mode .hud-top {
  transform: translateY(-12px);
}

body.cinema-mode .action-dock {
  transform: translateX(-50%) translateY(18px);
}

.cinema-restore-btn {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: calc(14px + var(--safe-right));
  z-index: 35;
  background: rgba(14, 21, 40, 0.46);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: background 0.18s ease, opacity 0.18s ease;
}

.cinema-restore-btn:hover,
.cinema-restore-btn:active {
  background: rgba(14, 21, 40, 0.78);
}

/* --- 상단 1줄 초미니멀 HUD --- */
.hud-top {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: calc(14px + var(--safe-left));
  right: calc(14px + var(--safe-right));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.hud-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.hud-center-chips {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.glass-panel {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 6px 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.location-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  min-width: 0;
  white-space: nowrap;
}

.brand-mark {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--accent-gold);
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.location-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  flex-shrink: 0;
}

.visitor-text {
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64dfdf;
  box-shadow: 0 0 8px #64dfdf;
  display: inline-block;
  flex-shrink: 0;
}

.divider {
  opacity: 0.35;
  flex-shrink: 0;
}

.util-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.pill-btn:hover {
  background: var(--glass-hover);
  color: #fff;
}

.pill-btn:active {
  transform: scale(0.95);
}

.pill-btn.active {
  background: rgba(255, 224, 130, 0.22);
  border-color: rgba(255, 224, 130, 0.58);
  color: var(--accent-gold);
}

.volume-slider {
  width: 64px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* --- 정원 배너 & 상태 토스트 --- */
.wait-banner {
  background: rgba(230, 57, 70, 0.86);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  max-width: 92vw;
}

.toast-msg {
  position: fixed;
  bottom: calc(102px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 120;
  background: rgba(14, 21, 40, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  max-width: calc(100vw - 28px);
  text-align: center;
  line-height: 1.35;
}

.toast-msg.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- 하단 힐링 액션 독 (4종) --- */
.action-dock {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 7px;
  padding: 7px 10px;
  border-radius: 24px;
  background: rgba(14, 21, 40, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
  width: min(372px, calc(100vw - 22px));
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 7px 6px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.action-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.18);
}

.action-btn.active {
  background: rgba(255, 224, 130, 0.24);
  border-color: rgba(255, 224, 130, 0.72);
  color: var(--accent-gold);
}

.action-icon {
  font-size: 19px;
  line-height: 1.1;
}

.action-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.control-hint {
  position: fixed;
  bottom: calc(4px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.46);
  pointer-events: none;
  white-space: nowrap;
}

/* --- 통합 해변 설정 모달 (모바일 바텀시트 겸용) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 15, 30, 0.56);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.modal-card {
  width: 100%;
  max-width: 404px;
  max-height: calc(90dvh - 16px);
  overflow-y: auto;
  background: rgba(18, 27, 50, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 20px 20px 22px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.5);
}

.modal-sheet-handle {
  display: none;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 auto 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 17.5px;
  font-weight: 700;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sub);
  font-size: 14px;
  cursor: pointer;
}

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.time-chip {
  padding: 10px 4px !important;
  font-size: 12.5px !important;
  text-align: center;
  white-space: nowrap;
}

.name-row {
  display: flex;
  gap: 8px;
}

/* iOS Safari 포커스 자동 줌 버그 방지를 위해 반드시 16px 이상 유지 */
.text-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 11px 13px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.dice-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0 14px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.dice-btn:active {
  transform: scale(0.96);
}

.gender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:active {
  transform: scale(0.97);
}

.chip-btn.selected,
.chip-btn.active {
  background: rgba(255, 224, 130, 0.22);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.save-btn {
  width: 100%;
  margin-top: 6px;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd166, #f4845f);
  color: #1b1f2a;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.save-btn:active {
  transform: scale(0.98);
}

/* --- 개발자 한마디 & 피드백 영역 --- */
.dev-note-section {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.dev-note-text {
  font-size: 12px;
  line-height: 1.55;
  color: rgba(248, 250, 252, 0.66);
  margin-bottom: 10px;
  word-break: keep-all;
}

.feedback-row {
  display: flex;
  gap: 7px;
}

.feedback-input {
  padding: 9px 12px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.feedback-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
  font-size: 13px;
}

.feedback-btn {
  background: rgba(255, 224, 130, 0.16);
  border-color: rgba(255, 224, 130, 0.42);
  color: var(--accent-gold);
}

.feedback-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.feedback-status {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--accent-gold);
}

.feedback-status.error {
  color: #ff8fa3;
}

/* =========================================================
   모바일 세로형(스마트폰) 최적화 (<= 760px)
   ========================================================= */
@media (max-width: 760px) {
  .hide-mobile,
  .hide-sm {
    display: none !important;
  }

  .hud-top {
    top: calc(8px + var(--safe-top));
    left: calc(10px + var(--safe-left));
    right: calc(10px + var(--safe-right));
  }

  .location-pill {
    padding: 7px 12px;
    gap: 6px;
  }

  .brand-mark {
    font-size: 13px;
    padding-right: 6px;
  }

  .location-title {
    font-size: 12.5px;
  }

  .visitor-text {
    font-size: 11.5px;
  }

  .util-bar {
    padding: 3px 5px;
    gap: 2px;
  }

  .icon-pill {
    padding: 6px 9px;
    font-size: 13px;
  }

  .control-hint {
    display: none;
  }

  .action-dock {
    bottom: calc(10px + var(--safe-bottom));
    padding: 6px 8px;
    gap: 6px;
    border-radius: 22px;
  }

  .toast-msg {
    bottom: calc(88px + var(--safe-bottom));
    font-size: 12px;
    padding: 8px 14px;
  }

  /* 모바일 바텀시트 스타일 모달 */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    padding: 12px 20px calc(22px + var(--safe-bottom));
  }

  .modal-sheet-handle {
    display: block;
  }
}

/* 초소형 모바일 폭 대응 (<= 430px: 아이콘 중심 상단 우측 유틸바) */
@media (max-width: 430px) {
  .hide-xs {
    display: none !important;
  }

  .icon-pill {
    min-width: 34px;
    min-height: 32px;
    padding: 5px 8px;
  }
}

/* =========================================================
   모바일 가로모드(Landscape) 파노라마 최적화
   ========================================================= */
@media (max-height: 520px) and (orientation: landscape) {
  .hide-mobile,
  .hide-sm,
  .hide-xs,
  .control-hint {
    display: none !important;
  }

  .hud-top {
    top: calc(6px + var(--safe-top));
  }

  .action-dock {
    bottom: calc(8px + var(--safe-bottom));
    padding: 5px 8px;
    width: min(360px, calc(100vw - 24px));
  }

  .action-btn {
    min-height: 44px;
    padding: 4px 5px;
    flex-direction: row;
    gap: 4px;
  }

  .action-icon {
    font-size: 16px;
  }

  .action-label {
    font-size: 11px;
  }

  .toast-msg {
    bottom: calc(66px + var(--safe-bottom));
  }
}
