/* SunoFM.link：黑白點陣玻璃
   全部是無彩色。亮色與暗色的差別只在最上面兩組變數；收音機機身永遠是黑的。 */

@font-face {
  font-family: "Doto";
  src: url("/fonts/doto-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;

  --bg: #dedede;
  --paper: #ffffff;
  --paper-2: #f1f1f1;
  --ink: #000000;
  --ink-soft: #595959;
  --line: #d4d4d4;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --grid: rgba(0, 0, 0, 0.1);

  /* 玻璃：放在頁面上的按鈕 */
  --gl-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.55));
  --gl-ring: rgba(0, 0, 0, 0.12);
  --gl-top: #ffffff;
  --gl-bot: rgba(0, 0, 0, 0.08);
  --gl-drop: rgba(0, 0, 0, 0.3);
  --gl-ink: #000000;

  --seg-track: #e8e8e8;
  --seg-on: #ffffff;
  --seg-on-ink: #000000;
  --seg-on-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 12px -6px rgba(0, 0, 0, 0.25);
  --toast-bg: rgba(0, 0, 0, 0.78);
  --toast-ink: #ffffff;
  --btn-edge: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(255, 255, 255, 0.06);

  --font-body: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --font-dot: "Doto", ui-monospace, "SF Mono", Menlo, monospace;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

  --bg: #0a0a0a;
  --paper: #141414;
  --paper-2: #1e1e1e;
  --ink: #ffffff;
  --ink-soft: #a8a8a8;
  --line: #2b2b2b;
  --danger: #ff8a80;
  --on-danger: #000000;
  --grid: rgba(255, 255, 255, 0.07);

  --gl-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.05));
  --gl-ring: rgba(255, 255, 255, 0.16);
  --gl-top: rgba(255, 255, 255, 0.34);
  --gl-bot: rgba(0, 0, 0, 0.55);
  --gl-drop: rgba(0, 0, 0, 0.9);
  --gl-ink: #ffffff;

  --seg-track: #0a0a0a;
  --tabs-fill: linear-gradient(180deg, rgba(46, 46, 46, 0.92), rgba(22, 22, 22, 0.9));
  --seg-on: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.1));
  --seg-on-ink: #ffffff;
  --seg-on-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  --toast-bg: rgba(255, 255, 255, 0.16);
  --btn-edge: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 1.6px) 0 0 / 16px 16px, var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.device :focus-visible { outline-color: #fff; }

.app { max-width: 440px; min-height: 100dvh; margin: 0 auto; position: relative; }

main { padding: 4px 16px calc(100px + env(safe-area-inset-bottom)); }

/* 最上方的中英文切換：小小字 */
.langbar { display: flex; justify-content: center; align-items: center; gap: 2px; padding: 8px 16px 0; font-size: 11px; line-height: 1; color: var(--ink-soft); }
.langbar button {
  min-width: 36px;
  min-height: 28px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.langbar button[aria-pressed="true"] { color: var(--ink); font-weight: 800; text-decoration: underline; text-underline-offset: 4px; }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

/* ───────── 玻璃：浮在內容上的按鈕共用外觀 ─────────
   做法：半透明漸層填色 + 背景模糊與提亮 + 頂緣高光 + 底緣暗邊 + 一圈細環 + 往下的陰影 */

.icon-btn,
.round-btn,
.random-btn,
.chip-btn,
.btn.ghost,
.tabs,
#toast {
  isolation: isolate;
  background: var(--gl-fill);
  color: var(--gl-ink);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 0 0 1px var(--gl-ring),
    inset 0 1.5px 0 var(--gl-top),
    inset 0 -1.5px 0 var(--gl-bot),
    0 10px 22px -12px var(--gl-drop);
}

.icon-btn,
.round-btn,
.random-btn,
.chip-btn,
.btn {
  transition: transform 0.14s cubic-bezier(0.3, 0.9, 0.3, 1.2), box-shadow 0.2s, background-color 0.2s, color 0.2s;
}
@media (hover: hover) {
  .icon-btn:hover,
  .round-btn:hover,
  .random-btn:hover,
  .chip-btn:hover { transform: translateY(-1px); }
}
.icon-btn:active,
.round-btn:active,
.random-btn:active,
.chip-btn:active,
.btn:active { transform: scale(0.95); }

/* ───────── 底部分頁：浮在畫面下方的玻璃膠囊 ───────── */

.tabs {
  /* 分頁列會蓋在各種內容上，底色比一般玻璃實一點，標籤才讀得清楚 */
  --gl-fill: var(--tabs-fill, linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 244, 244, 0.9)));
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 372px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  z-index: 10;
}

.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.tabs a > span:first-child { display: grid; place-items: center; }
.tabs a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
}

/* ───────── 收音機本體：黑色機身，整面是 ASCII 訊號圖樣 ───────── */

.device {
  /* 機身永遠是黑的，所以玻璃一律用「白色玻璃」 */
  --gl-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  --gl-ring: rgba(255, 255, 255, 0.2);
  --gl-top: rgba(255, 255, 255, 0.5);
  --gl-bot: rgba(0, 0, 0, 0.6);
  --gl-drop: rgba(0, 0, 0, 0.9);
  --gl-ink: #ffffff;

  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 14px;
  border-radius: 34px;
  background: radial-gradient(120% 55% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 60%), #000;
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.3),
    0 30px 40px -26px rgba(0, 0, 0, 0.75);
}
.device > * { position: relative; }

.device > .sigil {
  position: absolute;
  inset: 0;
  z-index: -1;
  margin: 0;
  overflow: hidden;
  font: 9px/9px var(--font-mono);
  letter-spacing: 0;
  white-space: pre;
  color: rgba(255, 255, 255, 0.36);
  pointer-events: none;
  user-select: none;
}

.device-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-left: 6px; }
.grille { display: none; }
.brand {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
}

/* 螢幕：純黑、點陣格、白色發光的點陣字 */

.lcd {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 4px 12px;
  padding: 16px 16px 14px;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.84);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 3px 14px rgba(0, 0, 0, 0.9);
}
.lcd::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.11) 0.9px, transparent 1.3px) 0 0 / 4px 4px;
  pointer-events: none;
}
.lcd > * { position: relative; }

.lcd-freq {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-dot);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.4);
}
.lcd-freq .num { font-size: clamp(40px, 13.4vw, 56px); letter-spacing: 0.01em; min-width: 4.9ch; }
.lcd-freq .unit { font-size: clamp(18px, 5.8vw, 24px); }

.lcd-count { font-size: 12px; text-align: right; color: rgba(255, 255, 255, 0.72); padding-bottom: 6px; }

.lcd-info { grid-column: 1 / -1; min-width: 0; margin-top: 4px; }
.lcd-name { font-weight: 800; font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.lcd-by { font-size: 13px; color: rgba(255, 255, 255, 0.72); }

.lcd.is-tuning .lcd-freq,
.lcd.is-tuning .lcd-name { opacity: 0.7; }

/* 轉盤：純黑底，刻度加一根粗短的指針 */

.dial {
  position: relative;
  height: 60px;
  margin-top: 12px;
  border-radius: 20px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 3px 12px rgba(0, 0, 0, 0.9);
}
.dial-track { position: absolute; inset: 0 22px; }

.tick { position: absolute; bottom: 24px; width: 1px; height: 7px; background: rgba(255, 255, 255, 0.4); }
.tick.major { height: 13px; background: #fff; }

.dial-label {
  position: absolute;
  bottom: 8px;
  transform: translateX(-50%);
  font-size: 11px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.78);
}

.needle {
  position: absolute;
  top: 12px;
  bottom: 22px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
  pointer-events: none;
  transition: left 0.75s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.lcd.is-tuning + .dial .needle { animation: needle-blink 0.3s steps(2, jump-none) infinite; }
@keyframes needle-blink { 50% { opacity: 0.35; } }

.controls { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; margin-top: 6px; }

.round-btn { display: grid; place-items: center; height: 56px; border: 0; border-radius: 50%; }

/* 主按鈕：磨砂白玻璃 */
.random-btn {
  --gl-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.7));
  --gl-ring: rgba(0, 0, 0, 0.1);
  --gl-top: #ffffff;
  --gl-bot: rgba(0, 0, 0, 0.28);
  --gl-ink: #000000;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
}
.random-btn svg { transition: transform 0.5s cubic-bezier(0.3, 0.9, 0.3, 1); }
.random-btn.spin svg { transform: rotate(360deg); }

/* ───────── 紙面區塊（播放器、歌單、後台） ───────── */

.sheet {
  margin-top: 14px;
  padding: 16px;
  border-radius: 26px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet h2 { font-size: 18px; font-weight: 800; line-height: 1.3; }

.now-title { font-weight: 800; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.now-note { color: var(--ink-soft); font-size: 13px; }

.frame { position: relative; height: 232px; margin-top: 10px; overflow: hidden; border-radius: 18px; background: #000; }
.frame::before {
  content: attr(data-loading);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #bdbdbd;
  font-size: 13px;
}
/* color-scheme: normal → 暗色主題下，載入中的內嵌頁面不會被補上一層白底 */
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; color-scheme: normal; opacity: 0; transition: opacity 0.3s; }
.frame.is-ready iframe { opacity: 1; }

.player-ctl { display: grid; grid-template-columns: 1fr 52px 1fr; gap: 8px; margin-top: 12px; }
.player-ctl .chip-btn { justify-content: center; padding: 0 10px; min-width: 0; }
.player-ctl .chip-btn:nth-child(2) { padding: 0; }
.suno-link { display: flex; width: 100%; justify-content: center; margin-top: 8px; }
/* 創作者設定的外部連結，最多三個，排成一列 */
.ext-links { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
.ext-links .chip-btn { justify-content: center; min-width: 0; padding: 0 10px; }
.ext-links .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ext-links .chip-btn svg { flex: none; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.chip-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px -8px rgba(0, 0, 0, 0.6);
}

/* 歌單：正在播的那一首整列反白 */

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

.trow {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 2px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s, color 0.25s;
}
.trow:last-child { border-bottom: 0; }

.trow .rank {
  text-align: center;
  font-family: var(--font-dot);
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  color: var(--ink-soft);
}

.trow .pick { display: block; min-width: 0; padding: 11px 6px; border: 0; border-radius: 12px; background: none; text-align: left; }
.trow .pick .t { display: block; font-weight: 500; overflow-wrap: anywhere; }
.trow .pick .n { display: block; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }

.trow.is-active { background: var(--ink); color: var(--paper); border-radius: 16px; border-bottom-color: transparent; }
.trow.is-active .rank { color: var(--paper); }
.trow.is-active .pick .t { font-weight: 800; }
.trow.is-active .pick .n { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.trow.is-active :focus-visible { outline-color: var(--paper); }

.heart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  opacity: 0.62;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.2s;
}
.heart[aria-pressed="true"] { opacity: 1; }
.heart[aria-pressed="true"] svg { fill: currentColor; }
.heart svg { transition: transform 0.18s cubic-bezier(0.3, 0.9, 0.3, 1.6); }
.heart:active svg { transform: scale(1.35); }

/* 所有電台 */

.stations summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}
.stations summary::-webkit-details-marker { display: none; }
.stations summary svg { transition: transform 0.25s; }
.stations[open] summary svg { transform: rotate(180deg); }

.srow {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.srow:last-child { border-bottom: 0; }
.srow .f { font-family: var(--font-dot); font-weight: 700; font-size: 26px; line-height: 1; }
.srow .nm { font-weight: 500; overflow-wrap: anywhere; }
.srow .by { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.srow .cnt { font-size: 12px; color: var(--ink-soft); }
.srow[aria-current="true"] { background: var(--ink); color: var(--paper); border-radius: 16px; border-bottom-color: transparent; }
.srow[aria-current="true"] .nm { font-weight: 800; }
.srow[aria-current="true"] .by,
.srow[aria-current="true"] .cnt { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.srow[aria-current="true"]:focus-visible { outline-color: var(--ink); }

/* 空狀態 */

.empty { padding: 30px 12px; text-align: center; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--ink-soft); margin-bottom: 16px; }

/* ───────── 按鈕與表單 ───────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-decoration: none;
  box-shadow: var(--btn-edge), 0 10px 20px -12px rgba(0, 0, 0, 0.7);
}
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn.ghost { color: var(--gl-ink); font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.block { width: 100%; }

.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > label, .field > .lab { font-size: 13px; font-weight: 700; }
.field .hint { font-size: 12px; color: var(--ink-soft); }

.input, textarea.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-2);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--ink-soft); opacity: 0.85; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:hover { border-color: var(--ink-soft); }
.input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 16%, transparent); }

.error {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 12%, var(--paper));
  color: var(--danger);
  font-size: 14px;
}

/* 切換器：像影片 2 的 Result / Process，選中的是浮起來的一顆膠囊 */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--seg-track);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 6px rgba(0, 0, 0, 0.08);
}
.seg button {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-on-ink); font-weight: 800; box-shadow: var(--seg-on-shadow); }

/* ───────── 頁面標題與後台 ───────── */

.page-title { font-size: 36px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; margin: 14px 2px 8px; text-align: center; }
/* text-wrap: balance 讓兩行長度接近，不會落單一個字 */
.page-sub .cl { display: inline-block; }
.page-sub { margin: 0 auto 10px; color: var(--ink-soft); font-size: 14px; max-width: 21em; text-align: center; text-wrap: balance; }

/* 小字：免責聲明、感謝 */
.legal { margin: 18px auto 0; max-width: 24em; color: var(--ink-soft); font-size: 11.5px; line-height: 1.7; text-align: center; text-wrap: balance; }
.powered { display: grid; justify-items: center; gap: 8px; margin-top: 26px; color: var(--ink-soft); font-size: 11.5px; letter-spacing: 0.08em; }
.powered img { display: block; width: 150px; height: auto; }
/* Logo 是白色透明底：亮色主題反白成黑色 */
:root:not([data-theme="dark"]) .powered img { filter: invert(1); }
.coffee { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--ink-soft); }
.coffee a { color: var(--ink-soft); }

.me-head { display: flex; align-items: center; gap: 14px; }
.me-head .lcd-chip {
  position: relative;
  flex: none;
  padding: 11px 12px 9px;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  color: #fff;
  font-family: var(--font-dot);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 1px var(--line);
}
.me-head .who { flex: 1; min-width: 0; }
.me-head .who strong { display: block; font-size: 19px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.me-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* 三個頻道的切換列 */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.slots button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 6px;
  border: 0;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  min-width: 0;
}
.slots button .f { font-family: var(--font-dot); font-weight: 700; font-size: 20px; line-height: 1; }
.slots button .n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.slots button[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.slots button.add { border: 1.5px dashed var(--ink-soft); background: none; box-shadow: none; align-content: center; font-size: 13px; font-weight: 700; }

.link-rows { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: 40% 1fr; gap: 8px; }
.link-row .input { min-width: 0; padding: 10px 12px; }

.edit-list { list-style: none; margin: 0; padding: 0; }
.erow {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 4px 6px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.erow:last-child { border-bottom: 0; }
.erow .grip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: grab;
  touch-action: none;
}
.erow .grip[aria-disabled="true"] { opacity: 0.25; cursor: not-allowed; }
.erow .lead { display: grid; justify-items: center; gap: 2px; }
.erow .rk { font-family: var(--font-dot); font-weight: 700; font-size: 15px; line-height: 1; color: var(--ink); }
.erow .fields { display: grid; gap: 6px; min-width: 0; }
.erow .input { min-height: 40px; padding: 6px 12px; }
.erow .note-input { font-size: 13px; }
.erow .side { display: grid; justify-items: end; gap: 2px; font-size: 12px; color: var(--ink-soft); }
.erow .stat { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.erow .del {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
}
.erow .del:hover, .erow .del.sure { color: var(--danger); }
.erow .del.sure { font-weight: 800; }
.sortable-ghost { opacity: 0.3; }
.sortable-chosen { border-radius: 16px; box-shadow: 0 16px 28px -14px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--ink); }

/* 訊號紋理選擇：每格是該紋理的字元樣本 */
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swatch {
  position: relative;
  display: grid;
  place-items: start center;
  height: 80px;
  padding: 10px 4px 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #000;
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 0.2s;
}
.swatch .sample { font: 10px/11px var(--font-mono); white-space: pre; letter-spacing: 0.1em; }
.swatch::after {
  content: attr(aria-label);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 0 6px;
  background: linear-gradient(180deg, transparent, #000 60%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switch input { width: 22px; height: 22px; accent-color: var(--ink); }

.results { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-soft); }
.results li { padding: 4px 0; overflow-wrap: anywhere; }
.results .bad { color: var(--danger); }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* ───────── 排行 ───────── */

.rrow {
  display: grid;
  grid-template-columns: 34px 48px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  text-decoration: none;
  color: inherit;
}
.rrow:last-child { border-bottom: 0; }
.rrow .rank { text-align: center; font-family: var(--font-dot); font-weight: 700; font-size: 20px; line-height: 1; color: var(--ink-soft); }
.rrow:nth-child(-n + 3) .rank { color: var(--ink); font-size: 26px; }
.rrow .art {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #000 center / cover;
  color: #fff;
  font-family: var(--font-dot);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 0 1px var(--line);
}
.rrow .tt { min-width: 0; }
.rrow .tt strong { display: block; font-weight: 700; overflow-wrap: anywhere; line-height: 1.4; }
.rrow .tt span { display: block; font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.rrow .score { display: grid; justify-items: end; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rrow .score b { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--ink); }

/* ───────── 提示訊息 ───────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: min(400px, calc(100% - 32px));
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-ink, var(--ink));
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--danger); color: var(--on-danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
