/* ==========================================================================
   LRIC Maker — 平板点词版
   ========================================================================== */

:root {
  --bg: #f2ede4;
  --surface: #fbf9f4;
  --line: #e4ddcf;
  --ink: #1d1a16;
  --muted: #8d8577;
  --accent: #8c6f52;
  --accent-soft: rgba(140, 111, 82, .12);
  --hl: rgba(214, 183, 122, .34);
  --line-size: 32px;
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; color: inherit; }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px max(18px, env(safe-area-inset-left)) 12px max(18px, env(safe-area-inset-right));
  background: rgba(242, 237, 228, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .aa { font-family: var(--serif); font-size: 20px; }

.now { display: flex; flex-direction: column; min-width: 0; flex: 1; }

.now-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions { display: flex; gap: 8px; flex: none; }

/* ---------------------------------------------------------------- 搜索 */

.view { padding: 20px max(20px, env(safe-area-inset-left)) 60px max(20px, env(safe-area-inset-right)); max-width: var(--maxw); margin: 0 auto; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(50, 40, 25, .05);
}

.search-box:focus-within { border-color: rgba(140, 111, 82, .55); }

.search-icon { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; }

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 20px;
  color: var(--ink);
}

.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-box button {
  flex: none;
  padding: 13px 22px;
  border: 0;
  border-radius: 13px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  letter-spacing: .06em;
  cursor: pointer;
}

.search-box button:disabled { opacity: .45; }

.hint { margin: 12px 4px 18px; font-size: 13.5px; color: var(--muted); }

.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.pick {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: transform .1s, border-color .15s;
}

.pick:active { transform: scale(.99); border-color: rgba(140, 111, 82, .5); }

.pick-title { font-size: 19px; font-weight: 600; }
.pick-sub { grid-column: 1; font-size: 13.5px; color: var(--muted); }
.pick-tag {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.pick-tag.sync { border-color: rgba(140, 111, 82, .45); color: var(--accent); }

.pick-empty { padding: 26px 6px; color: var(--muted); font-size: 15px; line-height: 1.8; }

/* ---------------------------------------------------------------- 播放页 */

.song-head {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.cover {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .5);
}

.cover.fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent), #2c261f);
  color: rgba(255, 255, 255, .9);
  font-family: var(--serif);
  font-size: 46px;
}

.song-meta { min-width: 0; }
.song-meta h1 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.2; }
.song-meta p { margin: 4px 0 0; font-size: 15px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips span {
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  color: #5d564b;
}

/* 工具栏 */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  padding: 14px 0;
  position: sticky;
  top: 71px;
  z-index: 10;
  background: linear-gradient(var(--bg) 82%, rgba(242, 237, 228, 0));
}

.tool {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 104px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.tool span { font-size: 15.5px; font-weight: 600; }
.tool small { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tool.on { border-color: transparent; background: var(--ink); color: #fff; }
.tool.on small { color: rgba(255, 255, 255, .7); }
.tool.spaced { flex-direction: row; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.tool.spaced .fontsize { font-size: 17px; font-variant-numeric: tabular-nums; min-width: 28px; }
.tool.spaced small { margin: 0; }

.mini {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* 歌词 */

.lyrics {
  padding: 8px 0 40px;
  font-family: var(--serif);
  font-size: var(--line-size);
}

.line {
  padding: 3px 0 12px;
  border-radius: 10px;
  transition: background .2s;
}

.line .en {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.42;
  color: #000;
}

.line .ts {
  display: inline-block;
  min-width: 64px;
  margin-right: 10px;
  font-family: var(--mono, ui-monospace, Consolas, monospace);
  font-size: .55em;
  color: var(--muted);
  vertical-align: .25em;
  font-variant-numeric: tabular-nums;
}

.line .zh {
  margin-top: 4px;
  font-size: .62em;
  line-height: 1.5;
  color: #4a443a;
  font-family: var(--sans);
}

.line.reading { background: var(--hl); }

/* 单词 */

.w {
  display: inline;
  padding: 0 1px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
  word-break: keep-all;
}

.w:active, .w.active { background: var(--hl); }
.w.seen { text-decoration: underline dotted rgba(140, 111, 82, .75); text-underline-offset: 6px; }
.w.space { cursor: pointer; }

/* 中文歌词没有可点的词 */

.lang-zh .w { cursor: default; text-decoration: none !important; }
.zh-note { margin: 4px 4px 16px; font-size: 13.5px; color: var(--muted); }

/* --------------------------------------------------------------- 释义面板 */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(30, 26, 20, .28);
  backdrop-filter: blur(2px);
}

.sheet-card {
  width: min(760px, 100%);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: #fffdf9;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .45);
  animation: rise .18s ease-out;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.sheet-grip {
  width: 44px;
  height: 5px;
  margin: 10px auto 4px;
  border-radius: 3px;
  background: #ddd5c6;
}

.sheet-body { overflow-y: auto; padding: 10px 26px 20px; -webkit-overflow-scrolling: touch; }

.w-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }

.w-word {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.15;
  word-break: break-word;
}

.w-phon { font-family: var(--sans); font-size: 17px; color: var(--muted); padding-top: 14px; }
.w-phon em { font-style: normal; margin-left: 8px; opacity: .8; }

.spk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 58px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 13.5px;
  cursor: pointer;
}

.spk:active, .spk.playing { background: var(--accent-soft); border-color: rgba(140, 111, 82, .5); }
.spk svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.w-spk { margin-left: auto; display: flex; gap: 8px; }

.w-defs { margin: 16px 0 0; padding: 0; list-style: none; }

.w-defs li {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  font-size: 20px;
  line-height: 1.55;
  border-top: 1px solid #f0ebe1;
}

.w-defs li:first-child { border-top: 0; padding-top: 2px; }

.w-defs .pos {
  flex: none;
  min-width: 42px;
  padding-top: 4px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--accent);
  text-transform: lowercase;
}

.w-en { margin: 10px 0 0; font-size: 15px; line-height: 1.6; color: #55504a; }
.w-en b { color: var(--accent); font-weight: 600; margin-right: 6px; }

.w-ex { margin: 14px 0 0; padding: 12px 14px; background: #f7f3ea; border-radius: 12px; font-size: 15px; line-height: 1.6; }
.w-ex .ex-en { color: #2c2823; }
.w-ex .ex-zh { color: var(--muted); margin-top: 2px; }

.w-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.w-tags span { padding: 3px 9px; border-radius: 14px; background: #f1ece2; font-size: 11.5px; color: #6b6357; }

.w-loading { padding: 18px 0; color: var(--muted); font-size: 15px; }
.w-error { padding: 14px 0; color: #a8512f; font-size: 15px; }

.w-line {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #e2dacb;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.w-line .line-text { flex: 1; min-width: 200px; font-family: var(--serif); font-size: 17px; line-height: 1.5; color: #3a352e; }
.w-line .line-tr { margin-top: 4px; font-family: var(--sans); font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- 提示 */

/* ------------------------------------------------------------ 账号与我的 */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(38, 32, 24, .45);
  backdrop-filter: blur(4px);
}

.auth-card {
  width: min(440px, 100%);
  padding: 30px 28px 22px;
  background: #fffdf9;
  border-radius: 20px;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .5);
}

.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(140, 111, 82, .45);
  color: var(--accent);
  font-size: 17px;
}
.auth-brand h1 { margin: 0; font-family: var(--serif); font-size: 22px; letter-spacing: .14em; font-weight: 600; }
.auth-sub { margin: 12px 0 18px; font-size: 14px; line-height: 1.6; color: var(--muted); }

.auth-field { display: block; margin-bottom: 12px; }
.auth-field span { display: block; font-size: 12px; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.auth-field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 17px;
  color: var(--ink);
}
.auth-field input:focus { outline: none; border-color: rgba(140, 111, 82, .55); }

.auth-error { min-height: 20px; margin: 2px 0 10px; font-size: 13.5px; color: #a8512f; }

.auth-submit {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  letter-spacing: .08em;
  cursor: pointer;
}
.auth-submit:disabled { opacity: .5; }

.auth-switch { margin: 14px 0 0; text-align: center; }
.auth-switch button { border: 0; background: none; color: var(--accent); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth-note { margin: 8px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.auth-link { color: var(--accent); }

.user-btn span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.icon-btn.user-btn { padding: 0; }

.mine-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.mine-tabs button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
}
.mine-tabs button.on { background: var(--ink); border-color: transparent; color: #fff; }

.mine-stat { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.mine-empty { padding: 26px 12px; font-size: 15px; line-height: 1.8; color: var(--muted); }
.mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mine-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.mine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.mine-word { font-family: var(--serif); font-size: 20px; }
.mine-row.marked .mine-word { text-decoration: line-through; text-decoration-color: rgba(47, 122, 79, .5); }
.mine-short { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-count { font-size: 12px; color: var(--muted); }
.mark-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.mark-btn.on { color: #2f7a4f; border-color: rgba(47, 122, 79, .4); }

.chip-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(140, 111, 82, .45);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}
.chip-btn.on { background: rgba(47, 122, 79, .12); border-color: rgba(47, 122, 79, .4); color: #2f7a4f; }


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: 80vw;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(25, 23, 19, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet ~ .toast { bottom: calc(76vh + 12px); }

/* ------------------------------------------------------------ 宽屏/横屏 */

@media (min-width: 900px) {
  .lyrics { column-count: 1; }
  .song-meta h1 { font-size: 30px; }
}

@media (orientation: landscape) and (min-width: 760px) {
  .view.player { max-width: 1080px; }
  .sheet-card { max-height: 78vh; }
}

@media (max-width: 560px) {
  .pick-title { font-size: 17px; }
  .tool { min-width: 0; padding: 9px 12px; }
  .tool.spaced { margin-left: 0; }
  .topbar { padding-top: 10px; padding-bottom: 10px; }
}

.mine-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.mine-search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; }
.mine-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.mine-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.mine-group { margin-bottom: 16px; }
.mine-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.mine-cover {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 9px;
  object-fit: cover;
  background: #ece6da;
}
.mine-cover.placeholder { display: grid; place-items: center; color: var(--muted); font-family: var(--serif); font-size: 18px; }
.mine-group-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mine-group-count { font-size: 13px; color: var(--muted); flex: none; }
.mine-item-word { font-family: var(--serif); font-size: 20px; }