:root {
  --bg: #090d16;
  --surface: rgba(15, 23, 42, 0.9);
  --surface-solid: #0f172a;
  --surface-deep: #060a12;
  --border: rgba(51, 65, 85, 0.85);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --sky: #38bdf8;
  --sky-strong: #0ea5e9;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 48%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.break-all {
  word-break: break-all;
}

.center-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 12px;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(56, 189, 248, 0.22);
  border-top-color: var(--sky);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-narrow {
  max-width: 370px;
}

.card-warn {
  border-color: rgba(251, 191, 36, 0.45);
}

.icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.title-lg {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.title-md {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.desc-sm {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #cbd5e1;
}

.muted-label {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.guide-box {
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-box p {
  margin: 0;
}

.guide-title {
  font-weight: 800;
  color: var(--sky);
}

.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.sm {
  height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  font-size: 12px;
}

.btn.icon-only {
  width: 34px;
  padding: 0;
}

.btn.full {
  width: 100%;
}

.btn-primary {
  background: var(--sky);
  color: #06101e;
}

.btn-primary:hover:not(:disabled) {
  background: #7dd3fc;
}

.btn-dark {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.btn-dark:hover:not(:disabled) {
  background: #334155;
}

.btn-outline-sky {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.38);
  color: #7dd3fc;
}

.btn-outline-sky.active {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.48);
  color: #fde68a;
}

.pin-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 4px 0;
}

.pin-dots span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-deep);
  border: 2px solid #334155;
  transition: all 0.14s ease;
}

.pin-dots span.filled {
  background: var(--sky);
  border-color: #bae6fd;
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.65);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.key-btn {
  height: 54px;
  border-radius: 15px;
  border: 1px solid #334155;
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease;
}

.key-btn:active {
  transform: scale(0.95);
  background: #334155;
}

.key-btn.key-muted {
  background: var(--surface-deep);
  border-color: #1e293b;
  font-size: 13px;
  color: #94a3b8;
}

.foot-note {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.alert-error {
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.42);
  color: #fda4af;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 12px;
  line-height: 1.45;
}

.page-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  padding: 10px 14px;
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-texts {
  min-width: 0;
}

.brand-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pill-emerald {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: 800;
}

.pill-sky {
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}

.lobby-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.tab-btn {
  height: 38px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dropzone {
  border: 2px dashed #334155;
  border-radius: 16px;
  background: var(--surface-deep);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragging,
.dropzone:hover {
  border-color: var(--sky);
  background: rgba(56, 189, 248, 0.08);
}

.dropzone.ready {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.06);
}

.drop-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.drop-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
}

.drop-sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.drop-hint {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--sky);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.section-label {
  font-size: 12px;
  font-weight: 800;
  color: #cbd5e1;
}

.warn-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
}

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

@media (max-width: 480px) {
  .core-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.core-btn {
  padding: 10px 11px;
  border-radius: 13px;
  background: var(--surface-deep);
  border: 1px solid #1e293b;
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.core-btn.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--sky);
  color: #ffffff;
}

.core-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 900;
}

.core-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.core-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-row-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .field-row-2,
  .btn-row-2 {
    grid-template-columns: 1fr;
  }
}

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: var(--surface-deep);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.text-input:focus {
  border-color: var(--sky);
}

.field-help {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--sky);
}

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

.list-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  min-width: 0;
}

.badge-chip {
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 800;
}

.muted-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-mini-danger {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.btn-mini-danger:hover {
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 560px) {
  .item-grid {
    grid-template-columns: 1fr;
  }
}

.saved-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--surface-deep);
  border: 1px solid #1e293b;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.saved-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(30, 41, 59, 0.65);
}

.saved-card.busy {
  opacity: 0.65;
  pointer-events: none;
}

.saved-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.play-pill {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.saved-info {
  min-width: 0;
}

.saved-name {
  margin: 0;
  font-size: 12.5px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-meta {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-del-item {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: #0f172a;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-del-item:hover {
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

.player-shell {
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  background: var(--bg);
}

.player-bar {
  height: 48px;
  padding: 0 10px;
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.player-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

@media (max-width: 440px) {
  .hide-xs {
    display: none;
  }
}

.alert-banner {
  padding: 7px 12px;
  background: rgba(244, 63, 94, 0.16);
  border-bottom: 1px solid rgba(244, 63, 94, 0.38);
  color: #fecdd3;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.player-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

#player-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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