:root {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
  }
}

.theme-switcher-host {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.account-indicator {
  display: inline-flex;
  min-height: 52px;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--border, var(--dl-border, rgba(128,128,128,0.28)));
  border-radius: 9px;
  background: var(--bg-surface, var(--dl-bg-2, Canvas));
  color: var(--text-primary, var(--dl-text, CanvasText));
  font-size: 14px;
  line-height: 1;
  box-sizing: border-box;
}

.account-indicator__role {
  flex: 0 0 auto;
  color: var(--accent, var(--dl-accent, Highlight));
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
}

.account-indicator__role--viewer { color: #46c98c; }
.account-indicator__role--guest { color: #f29a4a; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .account-indicator__role--viewer { color: #0b6f49; }
  :root:not([data-theme]) .account-indicator__role--guest { color: #a94700; }
}

:root[data-theme="light"] .account-indicator__role--viewer { color: #0b6f49; }
:root[data-theme="light"] .account-indicator__role--guest { color: #a94700; }
.account-indicator__identity {
  max-width: 220px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}
.account-indicator button.account-indicator__identity { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.account-indicator button.account-indicator__identity:hover { color: var(--accent); text-decoration: underline; }
.account-indicator button.account-indicator__identity:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.live-profile-dialog { width: min(340px, calc(100vw - 24px)); padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-lg); }
.live-profile-dialog::backdrop { background: rgba(3,6,12,.7); }
.live-profile-dialog h2 { margin: 0 0 14px; font-size: 20px; }
.live-profile-preview { position: relative; display: grid; place-items: center; width: 112px; height: 112px; margin: 0 auto 16px; overflow: hidden; border-radius: 50%; background: var(--accent-muted); color: var(--accent); font-size: 34px; font-weight: 800; }
.live-profile-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.live-profile-pick { position: relative; display: block; width: fit-content; margin: 0 auto 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-weight: 700; }
.live-profile-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-profile-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.live-profile-dialog p { font-size: 13px; color: var(--text-secondary); }
.live-profile-actions { display: flex; justify-content: flex-end; gap: 8px; }
.live-profile-actions button { min-height: 36px; padding: 5px 12px; }

.account-indicator__logout {
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--border, var(--dl-border, rgba(128,128,128,0.28)));
  border-radius: 9px;
  background: var(--bg-surface, var(--dl-bg-2, Canvas));
  color: var(--text-secondary, var(--dl-text-2, CanvasText));
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.account-indicator__logout:hover {
  border-color: var(--border-strong, var(--dl-border-strong, Highlight));
  background: var(--bg-hover, var(--dl-bg-card-hover, color-mix(in srgb, CanvasText 8%, Canvas)));
  color: var(--text-primary, var(--dl-text, CanvasText));
}

.account-indicator__logout:focus-visible {
  outline: 2px solid var(--accent, var(--dl-accent, Highlight));
  outline-offset: 1px;
}

.account-indicator__logout:disabled {
  cursor: wait;
  opacity: .65;
}

.theme-switcher-host--floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border, var(--dl-border, rgba(128,128,128,0.28)));
  border-radius: 9px;
  background: var(--bg-surface, var(--dl-bg-2, Canvas));
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.16));
}

.theme-switcher__option {
  min-height: 44px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, var(--dl-text-2, CanvasText));
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.theme-switcher__option:hover {
  background: var(--bg-hover, var(--dl-bg-card-hover, color-mix(in srgb, CanvasText 8%, Canvas)));
  color: var(--text-primary, var(--dl-text, CanvasText));
}

.theme-switcher__option:focus-visible {
  outline: 2px solid var(--accent, var(--dl-accent, Highlight));
  outline-offset: 1px;
}

.theme-switcher__option[aria-pressed="true"] {
  background: var(--accent-muted, var(--dl-gradient-subtle, color-mix(in srgb, Highlight 15%, Canvas)));
  color: var(--accent, var(--dl-accent, Highlight));
}

.theme-switcher__option svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.theme-switcher--compact .theme-switcher__option {
  width: 44px;
  padding: 5px;
}

.theme-switcher--compact .theme-switcher__option span {
  display: none;
}

@media (max-width: 680px) {
  .account-indicator__identity { max-width: 112px; }
  .theme-switcher:not(.theme-switcher--wide) .theme-switcher__option {
    width: 44px;
    padding: 5px;
  }

  .theme-switcher:not(.theme-switcher--wide) .theme-switcher__option span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switcher__option {
    transition: none;
  }
}

.account-indicator__manage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  box-sizing: border-box;
  text-decoration: none;
}

.mobile-account-menu { display: none; }

@media (max-width: 680px) {
  .header .header-right { flex: 0 0 auto; }
  .theme-switcher-host--account-menu { flex-wrap: nowrap; gap: 6px; }
  /* 계정 메뉴와 같은 줄의 채팅·알림 버튼도 44px로 줄여 좁은 화면에서 제목 자리를 남긴다. */
  .theme-switcher-host--account-menu .live-navigation > * { width: 44px; min-width: 44px; padding-inline: 0; }
  .theme-switcher-host--account-menu > .theme-switcher,
  .theme-switcher-host--account-menu > .account-indicator,
  .theme-switcher-host--account-menu > .account-indicator__logout { display: none; }
  .theme-switcher-host--account-menu .mobile-account-menu { display: block; position: relative; margin: 0; padding: 0; border: 0; }
  .theme-switcher-host--account-menu .mobile-account-menu > summary {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 52px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg-surface); color: var(--text-primary);
    cursor: pointer; list-style: none;
  }
  .theme-switcher-host--account-menu .mobile-account-menu > summary::-webkit-details-marker { display: none; }
  .theme-switcher-host--account-menu .mobile-account-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .theme-switcher-host--account-menu .mobile-account-menu__panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 101;
    display: flex; flex-direction: column; gap: 10px;
    width: min(300px, calc(100vw - 20px)); box-sizing: border-box;
    padding: 14px; border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-surface); box-shadow: var(--shadow-lg);
  }
  .theme-switcher-host--account-menu .mobile-account-menu__account { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
  .theme-switcher-host--account-menu .mobile-account-menu__identity { max-width: 100%; padding: 0; border: 0; background: none; color: var(--text-primary); font: inherit; font-size: 14px; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
  .theme-switcher-host--account-menu button.mobile-account-menu__identity { cursor: pointer; }
  .theme-switcher-host--account-menu .mobile-account-menu__panel .theme-switcher-host { justify-content: stretch; }
  .theme-switcher-host--account-menu .mobile-account-menu__panel .theme-switcher { width: 100%; box-sizing: border-box; }
  .theme-switcher-host--account-menu .mobile-account-menu__panel .theme-switcher__option { flex: 1 1 0; min-width: 0; padding: 5px 3px; }
  .theme-switcher-host--account-menu .mobile-account-menu__action {
    display: flex; align-items: center; width: 100%; min-height: 44px; box-sizing: border-box;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px;
    background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 14px;
    text-align: left; text-decoration: none; cursor: pointer;
  }
  .theme-switcher-host--account-menu .mobile-account-menu__action:focus-visible,
  .theme-switcher-host--account-menu .mobile-account-menu__identity:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .media-header .media-theme.theme-switcher-host--account-menu { display: flex !important; }
  .pv-header .pv-header-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 430px) {
  .media-header .media-title { display: none; }
  .media-header .media-home span { display: none; }
}

@media (max-width: 300px) {
  .media-header .media-nav a[aria-current="page"] { display: none; }
}

.live-navigation{display:flex;align-items:center;gap:6px}.live-navigation a[aria-current=page]{background:var(--bg-hover);color:var(--text-primary)}
.live-navigation .live-navigation__chat{position:relative}.live-navigation__chat svg{width:22px;height:22px;flex:none}.live-chat-unread{position:absolute;top:-7px;right:-7px;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:20px;height:20px;padding:0 4px;border:2px solid var(--bg-surface);border-radius:999px;background:#e54040;color:#fff;font-size:10px;font-weight:800;line-height:1}.live-chat-unread[hidden]{display:none}
.live-chat-unread.is-observed{background:#facc15;color:#1f2937}
.live-chat-notice{position:fixed;right:16px;bottom:max(16px,env(safe-area-inset-bottom));z-index:1200;display:flex;align-items:center;gap:10px;max-width:calc(100vw - 32px);padding:7px 8px 7px 15px;border:1px solid var(--border,rgba(128,128,128,.3));border-radius:13px;background:var(--bg-surface,Canvas);color:var(--text-primary,CanvasText);box-shadow:0 10px 28px rgba(0,0,0,.18);font-size:14px;font-weight:700}.live-chat-notice a{color:inherit;text-decoration:none;padding:8px 2px}.live-chat-notice a:focus-visible,.live-chat-notice button:focus-visible{outline:2px solid var(--accent,#2563eb);outline-offset:2px}.live-chat-notice button{border:0;background:transparent;color:var(--text-secondary,inherit);font-size:21px;line-height:1;cursor:pointer;padding:7px}.live-chat-notice.is-entering{animation:live-chat-notice-in .22s ease-out both}@keyframes live-chat-notice-in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.live-chat-notice.is-entering{animation:none}}
