/* 사랑살롱: 3D 화면 위에 반투명한 작은 알약 모양 UI만 얹는다 */
:root {
  --glass: rgba(24, 20, 18, 0.48);
  --glass-strong: rgba(24, 20, 18, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f6efe3;
  --dim: rgba(246, 239, 227, 0.6);
  --gold: #f2d38a;
  --red: #e0283c;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1029;
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 아이폰에서 단추를 빠르게 두 번 눌러도 화면이 확대되지 않게 */
html, body, button, input, .sheet, .hud { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
.dim { color: var(--dim); }

.hud { position: fixed; z-index: 2; transition: opacity 0.4s; }
body:not(.in) .hud { opacity: 0; pointer-events: none; }
.pill {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 7px 14px;
}

.top-left { top: max(14px, env(safe-area-inset-top)); left: 14px; display: flex; gap: 10px; align-items: center; }
.top-right { top: max(14px, env(safe-area-inset-top)); right: 14px; display: flex; gap: 8px; }
#threads b { color: #ffb3bb; font-weight: 600; }
.top-right .pill { font-size: 13px; }
#sound.off { color: var(--dim); text-decoration: line-through; }
#now-playing { top: calc(max(14px, env(safe-area-inset-top)) + 46px); left: 50%; transform: translateX(-50%); font-size: 13px; white-space: nowrap; }

/* 낮/밤 바: 하루를 왼쪽(0시)→오른쪽(24시)으로 펼친 띠 위를 해·달이 지나간다 */
/* 감정표현 줄과 같은 바닥선·같은 높이로 왼쪽 아래 구석에 */
.bottom-left {
  left: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  height: 54px;
  width: 200px;
  border-radius: 20px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#daybar { position: relative; height: 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25); }
#daybar-icon {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255, 220, 150, 0.9));
  transition: left 1s linear;
}
/* 위: 시간대(왼쪽)와 시각(오른쪽), 아래: 해·달이 미끄러지는 띠 */
.dayrow { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; font-size: 12px; line-height: 1; }
#day-period { color: var(--dim); }
#day-clock { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: 0.02em; }
#daytime.scrubbing #day-clock { color: var(--gold); }
/* 시계를 끌어서 다른 시각을 미리 볼 수 있다 */
#daytime { cursor: grab; touch-action: none; user-select: none; }
#daytime.scrubbing { cursor: grabbing; }
#daytime.scrubbing #daybar-icon { transition: none; }

/* 감정표현 */
.dock {
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  height: 54px; /* 왼쪽 낮밤 시계와 같은 높이 */
  padding: 6px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dock button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}
.dock button:hover, .dock button:active { background: rgba(255, 255, 255, 0.1); }
.dock .wide { color: var(--gold); border-left: 1px solid var(--line); border-radius: 0 14px 14px 0; margin-left: 4px; }
.dock .wide:disabled { color: rgba(246, 239, 227, 0.3); cursor: default; background: transparent; }

/* 음악 부스 */
.panel {
  right: 14px;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 76px);
  border-radius: 16px;
  padding: 12px;
  width: 230px;
  background: var(--glass-strong);
}
.panel-title { font-weight: 600; margin-bottom: 8px; }
.panel-title .dim { display: block; font-weight: 400; font-size: 11px; }
#booth-tracks { display: grid; gap: 6px; margin-bottom: 8px; }
.panel button {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}
.panel button.on { border-color: var(--gold); color: var(--gold); }
.panel button:disabled { opacity: 0.4; cursor: default; }

/* 위 왼쪽 알약 안의 단추들 */
.bare { border: 0; background: transparent; padding: 0; color: inherit; font: inherit; }
.top-left .bare:hover { color: var(--gold); }
#exit { font-size: 16px; line-height: 1; padding-right: 2px; }

/* 메뉴 창 (사랑채 고르기·함께 있는 사람·설정) */
.sheet {
  position: fixed;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100% - 32px));
  max-height: min(560px, calc(100% - 120px));
  overflow-y: auto;
  padding: 18px;
  border-radius: 22px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.sheet[hidden] { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 16px; }
.close { font-size: 15px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.small { font-size: 12px; }
.sheet p { margin: 10px 0; }

#room-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#room-list button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
#room-list button span { display: block; font-size: 12px; color: var(--dim); }
#room-list button.on { border-color: var(--gold); color: var(--gold); }
#room-list button:disabled { opacity: 0.4; cursor: default; }

#people-list { display: grid; gap: 4px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.person i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.person .me { margin-left: auto; font-size: 11px; color: var(--gold); }

.channel { padding: 10px 12px; margin-top: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.channel-head, .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.channel-head .dim { font-size: 11px; }
.row { margin: 14px 2px; }
.channel input { width: 100%; margin-top: 8px; accent-color: var(--gold); }
.toggle { flex: none; position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, 0.18); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.2s; }
.toggle.on { background: var(--gold); }
.toggle.on::after { left: 21px; }
details { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; color: var(--dim); font-size: 13px; }
details ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; }

/* 대문 열고 닫기 단추: 감정표현 줄 바로 위 가운데 */
#gate-btn {
  left: 50%;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 80px);
  transform: translateX(-50%);
  padding: 9px 18px;
  font-size: 14px;
  color: var(--gold);
  background: var(--glass-strong);
}
#gate-btn[hidden] { display: none; }

/* ☰ 메뉴 (휴대폰 전용) */
.mobile-only { display: none; }
.menu-list { display: grid; gap: 6px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  font-size: 14px;
}
.menu-item.static { border: 0; background: transparent; color: var(--dim); }
.menu-item.static b { color: #ffb3bb; margin-left: auto; }
.menu-section { margin: 18px 2px 8px; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; border-top: 1px solid var(--line); padding-top: 14px; }
#menu-people { display: grid; gap: 4px; }
.menu-item.exit { width: 100%; margin-top: 18px; justify-content: center; color: var(--dim); }

/* 알림 */
#toasts {
  position: fixed;
  z-index: 3;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  justify-items: center;
  pointer-events: none;
}
.toast { background: var(--glass-strong); border-radius: 999px; padding: 8px 16px; font-size: 13px; transition: opacity 0.6s; white-space: nowrap; }
.toast.out { opacity: 0; }

/* 입장 화면 */
#intro {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(10, 8, 20, 0.25), rgba(10, 8, 20, 0.65));
}
#intro[hidden] { display: none; }
.card {
  width: min(360px, 100%);
  text-align: center;
  padding: 28px 24px 20px;
  border-radius: 24px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: 0.08em; font-weight: 600; }
.card p { margin: 0 0 18px; color: var(--dim); }
.card .label { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
#genders { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
#genders button { border: 0; border-radius: 999px; padding: 6px 18px; background: transparent; color: var(--dim); }
#genders button.on { background: var(--gold); color: #2a1f12; font-weight: 600; }
#swatches { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
/* 휴대폰 브라우저가 단추에 넣는 기본 여백·모양을 없애고, 줄어들지 않는 정원(正圓)으로 */
#swatches button {
  flex: none;
  width: 28px;
  height: 28px;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
#swatches button.on { border-color: #1a1512; outline-color: var(--gold); }
#enter {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  background: var(--gold);
  color: #2a1f12;
  font-weight: 700;
  font-size: 15px;
}
.card .hint { margin: 14px 0 0; font-size: 11px; }

@media (max-width: 560px) {
  /* 휴대폰: 감정표현 줄과 낮밤 시계를 화면 폭 그대로 한 장의 카드로 붙인다
     (위 얇은 띠: 시간대 ━━해·달━━ 시각 / 아래: 감정표현 단추) */
  .dock { left: 12px; right: 12px; transform: none; height: 46px; padding: 5px; border-top: 0; border-radius: 0 0 18px 18px; }
  .dock button { flex: 1; padding: 0 2px; font-size: 12px; }
  .dock .wide { flex: 1.1; }
  .bottom-left {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 46px);
    height: 30px;
    padding: 0 14px;
    border-radius: 18px 18px 0 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .dayrow { display: contents; font-size: 11px; }
  #day-period { order: 0; font-size: 11px; white-space: nowrap; }
  #daybar { order: 1; flex: 1; height: 8px; }
  #day-clock { order: 2; font-size: 11px; }
  #now-playing { top: calc(max(14px, env(safe-area-inset-top)) + 46px); }
  .panel { left: 14px; right: auto; width: auto; max-width: calc(100% - 28px); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 126px); }
  /* 휴대폰 윗줄: 왼쪽엔 사랑채·인원 하나, 오른쪽엔 시야와 ☰ 만. 나머지는 ☰ 안으로 */
  .top-left { gap: 8px; font-size: 13px; }
  .top-left > b, #exit, #threads, #sound, #settings-btn { display: none; }
  .mobile-only { display: inline-flex; }
  #gate-btn { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 86px); } /* 아래 카드 바로 위 가운데 */
  .top-right { gap: 6px; }
}
