/* 온에어 네온 테마 — 심야 보라검정 바탕, 네온 핑크·시안·앰버 3색.
   글로우는 상태 배지·LP·전광판에만 집중하고 목록은 조용하게 유지한다. */

:root {
  color-scheme: dark;
  --bg: #0d0716;
  --panel: #17102a;
  --panel-2: #1f1636;
  --ink: #f4efff;
  --mist: #8f84b8;
  --dim: #6f63a8;
  --pink: #ff3da6;
  --cyan: #3df2e0;
  --amber: #f2ff3d;
  --violet: #7b3dff;
  --line: #2a2046;
  /* rgba() 글로우에 쓰는 액센트 성분 — 모드 테마가 통째로 바뀔 수 있게 토큰화 */
  --accent-rgb: 255, 61, 166;
  --amber-rgb: 242, 255, 61;
  --display: "Avenir Next Condensed", "Arial Narrow", "Apple SD Gothic Neo", "Pretendard", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

/* display 속성을 가진 클래스가 hidden 속성을 이기지 못하게 전역으로 고정한다 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(123, 61, 255, 0.22) 0%, transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(var(--accent-rgb), 0.1) 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  /* 한국어 단어 중간에서 줄이 바뀌지 않게 한다 */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 전광판이 화면 하단에 고정되는 페이지는 본문 끝 여백으로 겹침을 막는다 */
body.with-board { padding-bottom: 3.4rem; }

/* 노래방 모드 — 레이아웃은 그대로, 액센트만 블루·그린 네온으로 스왑 */
body.mode-karaoke {
  --pink: #3d8bff;
  --amber: #4dff9d;
  --accent-rgb: 61, 139, 255;
  --amber-rgb: 77, 255, 157;
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(61, 139, 255, 0.22) 0%, transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(61, 242, 224, 0.1) 0%, transparent 50%),
    var(--bg);
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.8rem 1.25rem 4rem;
}

a { color: var(--cyan); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* --- 공통 헤더 --- */

.kicker {
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--mist);
  font-weight: 700;
}

.kicker a { color: inherit; text-decoration: none; }

.title {
  font-family: var(--display);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0.25rem 0 0.2rem;
  text-shadow: -2px 0 rgba(var(--accent-rgb), 0.7), 2px 0 rgba(61, 242, 224, 0.7);
}

.sub { color: var(--mist); font-size: 0.88rem; margin: 0; }

/* --- 상태 배지 --- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1.5px solid var(--mist);
  color: var(--mist);
  border-radius: 6px;
  padding: 0.42rem 0.9rem;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
  margin-top: 0.4rem;
}

.status-badge i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }

.status-badge.running {
  border-color: var(--pink);
  color: var(--pink);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.45), inset 0 0 10px rgba(var(--accent-rgb), 0.16);
  text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7);
  animation: badge-breathe 2.6s ease-in-out infinite;
}

.status-badge.running i { box-shadow: 0 0 10px var(--pink); }

.status-badge.queued { border-color: var(--cyan); color: var(--cyan); }
.status-badge.canceling { border-color: var(--amber); color: var(--amber); }
.status-badge.done { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 14px rgba(var(--amber-rgb), 0.3); }
.status-badge.failed { border-color: var(--pink); color: var(--pink); }

@keyframes badge-breathe {
  50% { box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.65), inset 0 0 14px rgba(var(--accent-rgb), 0.28); }
}

/* --- LP 턴테이블 --- */

.deck {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 1.8rem 0 1.4rem;
  flex-wrap: wrap;
}

.turntable { position: relative; width: 200px; height: 200px; flex: none; }

.vinyl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, #120c1f 0 1.5px, #1c142e 1.5px 3.5px);
  box-shadow: 0 0 0 2px rgba(61, 242, 224, 0.5), 0 0 26px rgba(var(--accent-rgb), 0.35), 0 0 56px rgba(123, 61, 255, 0.28);
}

.vinyl.spinning { animation: vinyl-spin 3.6s linear infinite; }

.vinyl::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(244, 239, 255, 0.07) 55deg, transparent 80deg,
                             transparent 200deg, rgba(244, 239, 255, 0.05) 225deg, transparent 250deg);
}

.vinyl-label {
  position: absolute;
  inset: 33%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.4rem;
  background: conic-gradient(from 140deg, var(--pink), var(--violet), var(--pink));
  color: var(--bg);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  overflow: hidden;
}

.spindle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink);
  z-index: 2;
}

/* 톤암 각도가 진행률: JS가 --arm-angle을 갱신한다 */
.tonearm {
  position: absolute;
  right: -14px;
  top: -10px;
  width: 114px;
  height: 114px;
  pointer-events: none;
  transform: rotate(var(--arm-angle, 8deg));
  transform-origin: 86% 14%;
  transition: transform 0.6s ease;
}

.tonearm::before {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 4px;
  height: 98px;
  background: linear-gradient(180deg, var(--cyan), rgba(61, 242, 224, 0.35));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(61, 242, 224, 0.5);
}

.tonearm::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -4px;
  width: 15px;
  height: 25px;
  background: var(--cyan);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(61, 242, 224, 0.65);
}

.pivot {
  position: absolute;
  right: -4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--cyan);
}

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

/* --- 진행 수치 --- */

.readout { flex: 1; min-width: 210px; }

.bignum {
  font-family: var(--display);
  font-weight: 800;
  font-size: 3.2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(123, 61, 255, 0.6);
}

.bignum small { font-size: 1.35rem; color: var(--mist); text-shadow: none; }

.readout-label {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--mist);
  font-weight: 700;
  margin-top: 0.3rem;
}

/* --- 안내·오류 --- */

.notice {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(var(--amber-rgb), 0.45);
  border-radius: 10px;
  background: rgba(var(--amber-rgb), 0.06);
  color: var(--ink);
  font-size: 0.88rem;
  white-space: pre-line;
}

.error { color: var(--pink); font-weight: 700; font-size: 0.9rem; }

.muted { color: var(--mist); font-size: 0.85rem; }

/* --- 결과 링크 --- */

.result h3, .track-section h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 1.8rem 0 0.7rem;
}

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.7rem; }

.links a {
  display: inline-block;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.72rem 1.5rem;
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

.links a:hover { box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.6); }

/* --- 곡 목록 (차트) --- */

.chart { list-style: none; margin: 0; padding: 0; }

.chart li {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* 인라인 링크 수정 폼이 줄을 바꿔 들어올 공간 */
  gap: 0.6rem 0.95rem;
  padding: 0.52rem 0;
  border-top: 1px solid var(--line);
}

.rank {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 2.8rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--pink), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex: none;
}

.chart li.dim .rank { background: none; color: var(--dim); }

.song { flex: 1; min-width: 0; }
.song strong { display: block; font-size: 0.94rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song span { color: var(--mist); font-size: 0.79rem; }

.thumb-link { flex: none; line-height: 0; border-radius: 6px; }
.thumb {
  display: block;
  width: 71px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  flex: none;
}
.thumb-link:hover .thumb { border-color: var(--cyan); box-shadow: 0 0 10px rgba(61, 242, 224, 0.35); }
.chart li.dim .thumb, span.thumb.placeholder { opacity: 0.55; }

@media (max-width: 420px) {
  .thumb, span.thumb.placeholder { width: 56px; height: 32px; }
}

.badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
  flex: none;
}

.badge.mv { background: var(--pink); color: var(--bg); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5); }
.badge.audio { border: 1px solid var(--cyan); color: var(--cyan); }
.badge.wait { border: 1px solid var(--line); color: var(--mist); }
.badge.fail { border: 1px solid var(--pink); color: var(--pink); opacity: 0.8; }

/* --- LED 전광판 (뷰포트 하단 고정) --- */

.board {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: #050308;
  border-top: 2px solid #241a3e;
  overflow: hidden;
}

.board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* 도트 피치가 글자 획보다 굵으면 가독성이 죽는다 — 3px 셀 + 옅은 마스크로 질감만 남긴다 */
  background: radial-gradient(circle at 50% 50%, transparent 0 38%, rgba(5, 3, 8, 0.6) 46%) 0 0 / 3px 3px;
}

.board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 30%, transparent 78%, rgba(0, 0, 0, 0.35) 100%);
}

.board p {
  display: inline-block;
  margin: 0;
  padding: 0.55rem 0 0.45rem;
  padding-left: 100%;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.16em;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(var(--amber-rgb), 0.7), 0 0 18px rgba(var(--amber-rgb), 0.35);
  animation: board-roll 16s linear infinite;
}

@keyframes board-roll { to { transform: translateX(-100%); } }

/* --- 첫 페이지 --- */

.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.hero-copy { flex: 1; min-width: 0; }

.hero .lead { color: var(--mist); font-size: 0.95rem; margin: 0.7rem 0 0; max-width: 46ch; }

.hero-visual { flex: none; position: relative; }

.hero-visual .turntable { width: 168px; height: 168px; }

.sticker {
  position: absolute;
  right: -12px;
  top: -10px;
  transform: rotate(7deg);
  background: var(--amber);
  color: #241a00;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

form { display: flex; gap: 0.6rem; }

label.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mist);
  margin-bottom: 0.45rem;
}

input[type="url"] {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 0.78rem 0.95rem;
  font-size: 0.95rem;
}

input[type="url"]::placeholder { color: var(--dim); }

input[type="url"]:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(61, 242, 224, 0.3);
}

button[type="submit"] {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: 0.78rem 1.5rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

button[type="submit"]:hover { box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.6); }
button[type="submit"]:disabled { opacity: 0.6; cursor: progress; }

.cf-turnstile { margin-top: 0.8rem; }

/* --- 모드 토글 (알약형 세그먼트) --- */

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 1.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mode-option {
  border: none;
  background: transparent;
  color: var(--mist);
  font-family: var(--body);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
}

.mode-option.active {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
}

/* --- 곡별 링크 수정 (고스트·프라이머리 버튼은 위 버튼 체계와 동일) --- */

.edit-btn {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mist);
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.edit-btn:hover { color: var(--cyan); border-color: var(--cyan); }

.badge.edited-badge { background: var(--amber); color: #241a00; }

.id-editor {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.1rem 0 0.3rem;
}

.id-editor input {
  flex: 1;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.id-editor input:focus { outline: none; border-color: var(--cyan); }

.id-editor button {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
}

.id-editor button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mist);
}

.id-editor button.ghost:hover { color: var(--cyan); border-color: var(--cyan); }

.editor-error { color: var(--pink); font-size: 0.78rem; font-weight: 700; }

/* --- 중단 버튼 (고스트 계열, 위험 액션이라 핑크) --- */

.cancel-area { margin-top: 0.9rem; font-size: 0.82rem; color: var(--mist); }

.cancel-btn {
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  background: transparent;
  color: var(--pink);
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.cancel-btn:hover { box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.35); }

.cancel-btn.solid { background: var(--pink); color: var(--bg); border-color: var(--pink); }

.cancel-confirm { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.05rem 1.1rem;
}

.step-no {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.steps strong { display: block; font-size: 0.92rem; margin: 0.3rem 0 0.2rem; }
.steps p { margin: 0; color: var(--mist); font-size: 0.82rem; line-height: 1.55; }

.notes { margin-top: 2rem; }

.notes h2 {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--mist);
  margin: 0 0 0.5rem;
}

.notes ul { margin: 0; padding-left: 1.1rem; color: var(--mist); font-size: 0.86rem; }
.notes li { margin-bottom: 0.25rem; }

/* --- 푸터 --- */

.site-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 3.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--mist);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.footer-icon { display: block; flex: none; }

.footer-nav { margin-left: auto; display: flex; gap: 1.1rem; }

.footer-copy, .footer-nav a { color: var(--mist); text-decoration: none; }

.footer-copy:hover, .footer-copy:focus-visible,
.footer-nav a:hover, .footer-nav a:focus-visible { color: var(--cyan); text-decoration: underline; }

/* --- 반응형·모션 --- */

/* 넓은 화면에서는 폭을 넓히고 곡 목록을 두 단으로 흘려 세로 스크롤을 줄인다. */
@media (min-width: 1100px) {
  .wrap { max-width: 1080px; padding: 3.4rem 2rem 4.5rem; }

  .title { font-size: clamp(2.2rem, 4vw, 3rem); }
  .hero { gap: 3rem; }
  .hero .lead { font-size: 1rem; max-width: 52ch; }
  .hero-visual .turntable { width: 200px; height: 200px; }

  .steps { gap: 1.1rem; }
  .steps li { padding: 1.15rem 1.3rem 1.25rem; }

  .deck { gap: 2.8rem; margin: 2.2rem 0 1.6rem; }
  .turntable { width: 230px; height: 230px; }
  .bignum { font-size: 3.6rem; }

  .chart {
    columns: 2;
    column-gap: 2.6rem;
  }
  /* 한 곡이 두 단에 걸쳐 잘리지 않게 한다. 인라인 수정 폼이 열려도 마찬가지다. */
  .chart li { break-inside: avoid; }
}

@media (max-width: 640px) {
  .hero { flex-direction: column-reverse; text-align: center; }
  .hero .lead { max-width: none; }
  .hero-visual { margin-top: 0.4rem; }
  .steps { grid-template-columns: 1fr; }
  form { flex-direction: column; }
  .deck { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .vinyl.spinning { animation: none; }
  .status-badge.running { animation: none; }
  .board p { animation: none; padding-left: 0.8rem; }
  .tonearm { transition: none; }
}
