/* ── Japanese Ruby (furigana) Styles ──────────────────────────────────────── */
ruby {
  ruby-align: center;
}

rt {
  font-size: 0.55em;
  color: #9ca3af; /* gray-400 */
  letter-spacing: 0.05em;
}

/* ── Custom scrollbar ─────────────────────────────────────────────────────── */
.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
}
.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
  background: #374151; /* gray-700 */
  border-radius: 2px;
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: #4b5563; /* gray-600 */
}

/* ── Lyric line hover / selected ─────────────────────────────────────────── */
.lyric-line:hover {
  background-color: #1a1a2e;
}

body.theme-light .lyric-line:hover {
  background-color: rgba(15, 23, 42, 0.06) !important;
}

.lyric-line.selected {
  border-color: rgba(244, 244, 245, 0.22);
  background-color: rgba(244, 244, 245, 0.04);
}

.lyric-line {
  opacity: 0.42;
  scroll-margin-top: 6rem;
  transition: opacity 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.lyric-line.active-line,
.lyric-line.selected,
.lyric-line:hover {
  opacity: 1;
}

.miraa-line {
  border-left: 2px solid transparent;
}

.miraa-line .line-jp {
  color: #f9fafb;
}

.miraa-line .line-kana {
  color: #93c5fd;
}

.miraa-line .line-romaji {
  color: #7b7f87;
}

.miraa-line.active-line {
  border-left-color: rgba(244, 244, 245, 0.92);
  background-color: rgba(244, 244, 245, 0.06);
}

.miraa-line.selected {
  border-left-color: rgba(244, 244, 245, 0.4);
  background-color: rgba(244, 244, 245, 0.04);
}

.lesson-focus-card {
  min-height: 14rem;
}

.line-context-strip {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.line-context-item {
  border: 0;
  background: transparent;
  color: #777b84;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.line-context-item:hover {
  color: #d4d4d8;
}

.line-context-item-active {
  color: #f4f4f5;
  font-size: 1.12rem;
  font-weight: 600;
  transform: scale(1.01);
}

#lyrics-study-shell {
  background-color: #111317;
}

#lyrics-list {
  position: relative;
}

#lyrics-list .lyric-line-wrap {
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.lyric-line-detail {
  margin-top: 0.45rem;
}

.lesson-inline-focus {
  box-shadow: none;
}

.lyric-line-wrap.detail-open {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.25rem 0.2rem;
}

#lesson-focus-shell {
  background-color: #111317;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#inline-line-card {
  background-color: #111317;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-radius: 1.25rem;
  padding: 1.1rem 1.15rem;
}

.inline-analysis-block {
  display: grid;
  gap: 0.3rem;
}

.inline-analysis-label {
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #71717a;
}

.inline-analysis-value,
.lesson-note-copy {
  font-family: 'Plus Jakarta Sans', 'Noto Sans JP', sans-serif;
  font-size: 0.94rem;
  line-height: 1.68;
  font-weight: 500;
  color: #e5e7eb;
  text-wrap: pretty;
}

.lesson-note-copy-body {
  max-width: 56ch;
}

.lesson-note-copy-example {
  font-size: 0.78rem;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: #94a3b8;
}

.lesson-secondary-stack details summary {
  list-style: none;
}

.lesson-secondary-stack details summary::-webkit-details-marker {
  display: none;
}

.lesson-shell-section {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.seg-line {
  word-break: keep-all;
}

.seg-token {
  display: inline-flex;
  align-items: center;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  padding: 0.08rem 0.34rem;
  margin: 0 0.04rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.seg-token.has-reading {
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding-top: 0.22rem;
  padding-bottom: 0.18rem;
  line-height: 1;
}

.token-reading {
  font-size: 0.6rem;
  line-height: 1;
  color: rgba(191, 219, 254, 0.78);
  font-family: var(--font-jp, inherit);
  display: block;
  white-space: nowrap;
}

.token-reading-top {
  letter-spacing: 0.01em;
}

.token-reading-bottom {
  color: rgba(203, 213, 225, 0.9);
  font-size: 0.56rem;
  text-transform: none;
}

.token-surface {
  display: block;
}

.seg-token:hover {
  transform: translateY(-1px);
}

.seg-token-active {
  border-color: rgba(244, 244, 245, 0.4) !important;
  box-shadow: 0 0 0 1px rgba(244, 244, 245, 0.12);
}

.seg-token-singing {
  background: rgba(244, 114, 182, 0.32) !important;
  color: #fff !important;
  border-color: rgba(244, 114, 182, 0.5) !important;
  transform: scale(1.08);
  transition: background-color 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
}

.seg-token-singing .token-reading,
.seg-token-singing .token-reading-bottom {
  color: rgba(255, 255, 255, 0.92) !important;
}

.seg-token-sung {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.pitch-accent-graphic {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.pitch-accent-track {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.pitch-accent-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 1.3em;
  gap: 0.2rem;
}

.pitch-accent-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
}

.pitch-accent-bar-high {
  border-top-color: #f59e0b;
}

.pitch-accent-bar-low {
  border-bottom-color: #64748b;
}

.pitch-accent-drop {
  position: absolute;
  right: -2px;
  top: -1px;
  height: 10px;
  border-right: 2px solid #f59e0b;
}

.pitch-accent-mora {
  font-size: 0.78rem;
  line-height: 1;
  color: #e5e7eb;
}

.pitch-accent-label {
  color: rgba(252, 211, 77, 0.9);
}

.lyric-line-detail {
  animation: fadeSlideIn 0.25s ease-out;
}

@keyframes fadeSlideIn {
  from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
  to { opacity: 1; max-height: 300px; }
}

.lyric-line.expanded {
  border-color: rgba(249, 168, 212, 0.3) !important;
  background: rgba(15, 15, 26, 0.8) !important;
  border-radius: 1rem;
}

.seg-token-noun {
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
}

.seg-token-verb {
  background: rgba(16, 185, 129, 0.12);
  color: #a7f3d0;
}

.seg-token-adjective {
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
}

.seg-token-particle {
  background: rgba(236, 72, 153, 0.12);
  color: #fbcfe8;
}

.seg-token-expression {
  background: rgba(168, 85, 247, 0.12);
  color: #ddd6fe;
}

.seg-token-auxiliary {
  background: rgba(6, 182, 212, 0.12);
  color: #cffafe;
}

.seg-token-function_noun {
  background: rgba(249, 115, 22, 0.12);
  color: #ffedd5;
}

.seg-token-adverb {
  background: rgba(132, 204, 22, 0.12);
  color: #ecfccb;
}

.seg-token-conjunction {
  background: rgba(234, 179, 8, 0.12);
  color: #fef08a;
}

.seg-token-other {
  background: rgba(244, 244, 245, 0.08);
  color: #e4e4e7;
}

.grammar-token-card:hover {
  border-color: rgba(244, 244, 245, 0.18);
}

.grammar-token-card {
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.grammar-token-card:hover {
  transform: translateY(-1px);
}

.grammar-token-card-current {
  border-color: rgba(244, 114, 182, 0.58) !important;
  background: rgba(244, 114, 182, 0.12) !important;
  box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.16), 0 10px 24px rgba(244, 114, 182, 0.14);
}

.token-detail-card-current {
  border-color: rgba(244, 114, 182, 0.36) !important;
  box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.12), 0 16px 36px rgba(244, 114, 182, 0.12);
}

.grammar-token-live-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.42rem;
  background: rgba(244, 114, 182, 0.16);
  border: 1px solid rgba(244, 114, 182, 0.28);
  color: #f9a8d4;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ── Loading spinner ─────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* ── Japanese font rendering ─────────────────────────────────────────────── */
.font-jp {
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
}

/* ── Smooth tab transitions ──────────────────────────────────────────────── */
.tab-panel {
  animation: fadeIn 0.15s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Vocabulary JLPT badge glow on hover ─────────────────────────────────── */
.vocab-item:hover {
  border-color: #374151;
  background-color: #1f2937;
}

/* ── Now-playing pulse indicator ─────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ── Cute loading notes ─────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes floatNote {
  0%   { transform: translateY(0); opacity: 0.2; }
  50%  { transform: translateY(-8px); opacity: 0.7; }
  100% { transform: translateY(0); opacity: 0.2; }
}
.loading-note {
  animation: floatNote 2.4s ease-in-out infinite;
}
.loading-note.delay-1 {
  animation-delay: 0.4s;
}
.loading-note.delay-2 {
  animation-delay: 0.9s;
}

/* ── Spotify-inspired shell on home ─────────────────────────────────────── */
.spotify-shell {
  border: 1px solid #24262b;
  border-radius: 1rem;
  background: linear-gradient(160deg, #121315 0%, #0d0e10 100%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.spotify-shell-inner {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  padding: 0.9rem;
}

.spotify-art-wrap {
  width: 96px;
  height: 96px;
}

.spotify-art,
.spotify-art-fallback {
  width: 96px;
  height: 96px;
  border-radius: 0.75rem;
}

.spotify-art {
  object-fit: cover;
}

.spotify-art-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101114;
  border: 1px solid #24262b;
  color: #7a7d85;
  font-size: 1.2rem;
}

.spotify-art-fallback.hidden {
  display: none;
}

.spotify-main {
  min-width: 0;
}

.global-player-row {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
}

#global-player-shell {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
  padding-bottom: env(safe-area-inset-bottom);
}

body.playback-mode-youtube #global-player-shell {
  display: none !important;
}

body.playback-mode-youtube #global-queue-shell {
  display: none !important;
}

#song-header #header-art {
  width: 2.75rem !important;
  height: 2.75rem !important;
  min-width: 2.75rem;
  max-width: 2.75rem;
  object-fit: cover;
}

.global-player-track {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.global-player-art,
.global-player-art-fallback {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  flex: 0 0 auto;
}

.global-player-art {
  object-fit: cover;
}

.global-player-art-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #14161b;
  color: #a1a1aa;
  border: 1px solid #2a2d32;
}

.global-player-art-fallback.hidden {
  display: none;
}

.global-player-center {
  min-width: 0;
}

.global-player-device-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.global-player-device-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.35rem;
}

.global-player-follow-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.global-player-source-cluster {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-left: auto;
  text-align: right;
}

.global-player-device-label {
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #71717a;
}

.global-player-device-select {
  min-width: 6rem;
  max-width: 8.5rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.42rem;
}

.global-player-mini-btn {
  min-width: 1.7rem;
  min-height: 1.7rem;
  padding: 0;
  font-size: 0.78rem;
}

.global-player-follow-indicator {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.24rem 0.48rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
}

.global-player-follow-indicator.is-live {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.global-player-follow-indicator.is-manual {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.playlist-card-actions {
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .playlist-card-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    padding-top: 0.15rem;
  }
}

.global-player-mobile-controls {
  display: none;
}

.global-player-controls {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.global-player-side {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.spotify-kicker {
  font-size: 0.72rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}

.spotify-title {
  font-size: 1rem;
  line-height: 1.25rem;
  color: #f9fafb;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-artist {
  font-size: 0.83rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-timeline {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: 2.6rem 1fr 2.6rem;
  gap: 0.45rem;
  align-items: center;
  min-height: 2rem;
  padding: 0.15rem 0;
  touch-action: pan-y;
}

.spotify-time {
  font-size: 0.72rem;
  color: #9ca3af;
  text-align: center;
}

.spotify-bar-bg {
  height: 0.55rem;
  border-radius: 999px;
  background: #212327;
  overflow: hidden;
}

.spotify-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fafafa, #a1a1aa);
  transition: none;
}

.spotify-controls-row {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.spotify-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #2a2d32;
  background: #101114;
  color: #f4f4f5;
  border-radius: 999px;
  padding: 0;
  min-width: 2.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: none;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.spotify-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.spotify-icon-svg {
  display: block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.spotify-icon-btn:hover {
  border-color: #4a4f58;
  background: #16181d;
}

.spotify-icon-btn-primary {
  border-color: #f4f4f5;
  background: #f4f4f5;
  color: #111214;
}

.lesson-main-shell {
  padding-top: 0 !important;
}

.yt-lesson-player-shell {
  display: block;
  height: clamp(220px, 56vw, 520px);
  min-height: 0;
  max-height: calc(100vh - 57px);
  background:
    radial-gradient(circle at 18% 22%, rgba(244, 114, 182, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(24, 24, 32, 0.96), rgba(9, 10, 16, 0.98));
}

.yt-lesson-player-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 640px) {
  .yt-lesson-player-shell {
    top: 56px;
    height: clamp(190px, 56vw, 320px);
  }
}

@media (min-width: 1024px) {
  #lyrics-list {
    max-height: calc(100vh - 57px - min(56vw, 520px) - 6.5rem) !important;
    min-height: 14rem;
  }
}

.spotify-actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.spotify-device-row {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr auto 110px;
  gap: 0.45rem;
  align-items: center;
}

.spotify-btn {
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #2f3238;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.spotify-btn:disabled,
.spotify-icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.spotify-btn-primary {
  background: #f4f4f5;
  color: #111214;
  box-shadow: none;
}

.spotify-btn-ghost {
  background: #15171a;
  border-color: #2f3238;
  color: #f4f4f5;
}

.spotify-select {
  background: #101114;
  border: 1px solid #2f3238;
  border-radius: 0.55rem;
  color: #f4f4f5;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  min-width: 0;
}

.spotify-volume {
  width: 100%;
  accent-color: #1db954;
}

/* ── Compact + fancy layout helpers ──────────────────────────────────────── */
.kashi-panel {
  border-radius: 1rem;
  border: 1px solid #24262b;
  background: linear-gradient(180deg, rgba(19, 20, 23, 0.96), rgba(15, 16, 18, 0.96));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.kashi-compact {
  padding: 0.85rem !important;
}

.kashi-chip {
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  color: #94a3b8;
}

.kashi-song-card {
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.kashi-song-card:hover {
  transform: translateY(-2px);
  border-color: #f4f4f5;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
}

.kashi-cover {
  background: linear-gradient(145deg, rgba(18, 18, 20, 0.92), rgba(24, 24, 27, 0.92));
  border-bottom: 1px solid #24262b;
}

.home-hero {
  padding: 1.1rem !important;
}

.home-search-input {
  background: #101114;
  border: 1px solid #2f3238;
  border-radius: 1.1rem;
  padding: 1rem 1rem;
  font-size: 1.02rem;
  color: #fafafa;
  outline: none;
  box-shadow: none;
}

.home-search-input::placeholder {
  color: #6b7280;
}

.home-search-input:focus {
  border-color: #71717a;
  box-shadow: 0 0 0 4px rgba(244, 244, 245, 0.05);
}

/* ── Light mode overrides ─────────────────────────────────────────────────── */
body.theme-dark {
  background: #09090b;
  color: #f4f4f5;
}

body.theme-dark nav {
  background: rgba(9, 9, 11, 0.94);
  border-color: #202227;
}

body.theme-dark footer {
  border-color: #202227;
  color: #71717a;
}

body.theme-dark .bg-midnight,
body.theme-dark .bg-midnight-card,
body.theme-dark .bg-midnight-light {
  background-color: #101114 !important;
}

body.theme-dark .text-gray-300 {
  color: #e4e4e7 !important;
}

body.theme-dark .border-gray-800,
body.theme-dark .border-gray-700 {
  border-color: #2a2d32 !important;
}

body.theme-dark .text-gray-400 {
  color: #d4d4d8 !important;
}

body.theme-dark .text-gray-500,
body.theme-dark .text-gray-600 {
  color: #b7bac3 !important;
}

body.theme-light {
  background: #f6f6f3;
  color: #151515;
}

body.theme-light nav {
  background: rgba(250, 250, 248, 0.94);
  border-color: #ddddda;
}

body.theme-light footer {
  border-color: #ddddda;
  color: #4b5563;
}

body.theme-light .bg-midnight,
body.theme-light .bg-midnight-card,
body.theme-light .bg-midnight-light,
body.theme-light .bg-midnight-elevated {
  background-color: rgba(255, 255, 254, 0.98) !important;
}

body.theme-light .border-gray-800,
body.theme-light .border-gray-700 {
  border-color: #d7d7d2 !important;
}

body.theme-light .text-white {
  color: #151515 !important;
}

body.theme-light .text-gray-300 {
  color: #24262d !important;
}

body.theme-light .text-gray-400,
body.theme-light .text-gray-500,
body.theme-light .text-gray-600 {
  color: #4f5561 !important;
}

body.theme-light .text-gray-700 {
  color: #2d313a !important;
}

body.theme-light .pitch-accent-track {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.88);
}

body.theme-light .pitch-accent-mora {
  color: #111827;
}

body.theme-light .pitch-accent-bar-high {
  border-top-color: #d97706;
}

body.theme-light .pitch-accent-bar-low {
  border-bottom-color: #475569;
}

body.theme-light .pitch-accent-drop {
  border-right-color: #d97706;
}

body.theme-light .pitch-accent-label {
  color: #92400e;
}

body.theme-light .pitch-accent-title {
  color: #64748b !important;
}

body.theme-light .spotify-shell {
  background: linear-gradient(165deg, rgba(255, 255, 254, 0.98) 0%, rgba(247, 247, 244, 0.98) 100%);
  border-color: #d7d7d2;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
}

body.theme-light .spotify-art-fallback {
  background: #fafaf8;
  border-color: #d7d7d2;
  color: #64748b;
}

body.theme-light .spotify-icon-btn,
body.theme-light .spotify-btn-ghost {
  background: rgba(255, 255, 254, 0.98);
  border-color: #d7d7d2;
  color: #151515;
}

body.theme-light .spotify-btn-primary,
body.theme-light .spotify-icon-btn-primary {
  background: #1db954;
  border-color: #1db954;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(29, 185, 84, 0.18);
}

body.theme-light .spotify-select {
  background: rgba(255, 255, 254, 0.98);
  border-color: #d7d7d2;
  color: #151515;
}

body.has-global-player main {
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
}

body.playback-mode-youtube main {
  padding-bottom: 1rem;
}

body.has-global-player footer {
  padding-bottom: 1.5rem;
}

body.has-global-player #global-queue-shell {
  bottom: calc(5.8rem + env(safe-area-inset-bottom));
}

body.theme-light .kashi-panel {
  border-color: #d7d7d2;
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.98), rgba(248, 248, 245, 0.98));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
}

body.theme-light .info-tab-panel,
body.theme-light #global-queue-shell,
body.theme-light .vocab-item,
body.theme-light #culture-content > div,
body.theme-light #study-content > div {
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.98), rgba(248, 248, 245, 0.98)) !important;
  border-color: #d7d7d2 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.045);
}

body.theme-light .kashi-chip {
  border-color: #d7d7d2;
  color: #30333b;
  background: #fafaf8;
}

body.theme-light #song-header {
  background: rgba(255, 255, 254, 0.97) !important;
  border-color: #d7d7d2 !important;
}

body.theme-light #song-header h1,
body.theme-light #song-header p.text-white,
body.theme-light #lesson-focus-shell .text-white,
body.theme-light .lesson-inline-focus .text-white,
body.theme-light #inline-line-card .text-white,
body.theme-light .lesson-inline-focus .seg-line,
body.theme-light #inline-line-card .seg-line {
  color: #151515 !important;
}

body.theme-light #inline-line-card,
body.theme-light .lesson-inline-focus,
body.theme-light .lesson-inline-focus p,
body.theme-light .lesson-inline-focus span,
body.theme-light .lesson-inline-focus div,
body.theme-light .lesson-inline-focus button,
body.theme-light #inline-line-card p,
body.theme-light #inline-line-card span,
body.theme-light #inline-line-card div {
  color: #151515;
}

body.theme-light #song-header .text-gray-400,
body.theme-light #lesson-focus-shell .text-gray-400,
body.theme-light #lesson-focus-shell .text-gray-500,
body.theme-light #lesson-focus-shell .text-gray-600,
body.theme-light .lesson-inline-focus .text-gray-400,
body.theme-light .lesson-inline-focus .text-gray-500,
body.theme-light .lesson-inline-focus .text-gray-600,
body.theme-light #inline-line-card .text-gray-400,
body.theme-light #inline-line-card .text-gray-500,
body.theme-light #inline-line-card .text-gray-600 {
  color: #4b5563 !important;
}

body.theme-light #header-title,
body.theme-light #global-player-title,
body.theme-light .lesson-tab-btn.text-white {
  color: #1f2937 !important;
}

body.theme-light #global-player-artist,
body.theme-light .lesson-tab-btn.text-gray-400 {
  color: #475569 !important;
}

body.theme-light #global-player-shell {
  background: rgba(255, 255, 254, 0.98) !important;
  border-color: #d7d7d2 !important;
  box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.08);
}

body.theme-light #global-player-track,
body.theme-light #global-player-track:hover {
  color: #0f172a !important;
}

body.theme-light #global-player-title {
  color: #0f172a !important;
  font-weight: 700;
}

body.theme-light #global-player-artist,
body.theme-light .spotify-time,
body.theme-light #global-player-elapsed,
body.theme-light #global-player-duration {
  color: #475569 !important;
}

body.theme-light #global-player-seek .spotify-bar-bg {
  background: rgba(15, 23, 42, 0.14);
}

body.theme-light #global-player-seek .spotify-bar-fill {
  background: linear-gradient(90deg, #111827, #475569);
}

body.theme-light #reading-mode-toggle,
body.theme-light #chinese-script-toggle {
  border-color: rgba(15, 23, 42, 0.12) !important;
  background: rgba(255, 255, 255, 0.88);
}

body.theme-light .lesson-tab-btn:hover {
  color: #1f2937 !important;
}

body.theme-light #lesson-focus-shell {
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.98), rgba(248, 248, 245, 0.98));
  border-color: #e1e1db !important;
}

body.theme-light .miraa-line.active-line {
  border-left-color: rgba(39, 39, 42, 0.92);
  background: linear-gradient(90deg, rgba(39, 39, 42, 0.08), rgba(255, 255, 254, 0.18));
}

body.theme-light .lesson-inline-focus {
  background: rgba(255, 255, 254, 0.96);
  border-color: rgba(39, 39, 42, 0.08);
  box-shadow: none;
}

body.theme-light #inline-line-card {
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.97), rgba(248, 248, 245, 0.96));
  border-color: rgba(39, 39, 42, 0.08);
  box-shadow: 0 22px 60px rgba(39, 39, 42, 0.12);
}

body.theme-light #inline-line-card .text-gray-200,
body.theme-light #inline-line-card .text-gray-300,
body.theme-light #inline-line-card .text-gray-400,
body.theme-light #inline-line-card .text-gray-500,
body.theme-light .lesson-inline-focus .text-gray-200,
body.theme-light .lesson-inline-focus .text-gray-300,
body.theme-light .lesson-inline-focus .text-gray-400,
body.theme-light .lesson-inline-focus .text-gray-500,
body.theme-light .lesson-inline-focus .text-gray-600,
body.theme-light #inline-line-card .text-gray-600 {
  color: #243041 !important;
}

body.theme-light #inline-line-card .font-jp,
body.theme-light #inline-line-card .seg-line,
body.theme-light .lesson-inline-focus .font-jp,
body.theme-light .lesson-inline-focus .seg-line,
body.theme-light #inline-line-card .line-context-item-active {
  color: #111827 !important;
}

body.theme-light .lesson-inline-focus .text-sky-200\/80 {
  color: #1d4ed8 !important;
}

body.theme-light .lesson-inline-focus .text-amber-400 {
  color: #b45309 !important;
}

body.theme-light .lesson-inline-focus .grammar-token-card {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(39, 39, 42, 0.14) !important;
}

body.theme-light .lesson-inline-focus .grammar-token-card-current {
  background: rgba(244, 114, 182, 0.1) !important;
  border-color: rgba(244, 114, 182, 0.38) !important;
  box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.1), 0 10px 20px rgba(244, 114, 182, 0.08);
}

body.theme-light .lesson-inline-focus .token-detail-card-current,
body.theme-light #inline-line-card .token-detail-card-current {
  border-color: rgba(244, 114, 182, 0.3) !important;
  box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.08), 0 16px 30px rgba(244, 114, 182, 0.08);
}

body.theme-light .grammar-token-live-label {
  background: rgba(244, 114, 182, 0.12);
  border-color: rgba(244, 114, 182, 0.24);
  color: #be185d;
}

body.theme-light .lesson-inline-focus .save-vocab-btn,
body.theme-light .lesson-inline-focus .line-action-replay,
body.theme-light .lesson-inline-focus .line-action-loop,
body.theme-light .lesson-inline-focus .line-action-translation,
body.theme-light .lesson-inline-focus .line-action-known {
  background: rgba(255, 255, 255, 0.9);
  color: #111827 !important;
  border-color: rgba(39, 39, 42, 0.16) !important;
}

body.theme-light .lesson-inline-focus .line-action-loop.text-green-400,
body.theme-light .lesson-inline-focus .save-vocab-btn.text-green-400 {
  color: #166534 !important;
  border-color: rgba(22, 101, 52, 0.26) !important;
}

body.theme-light #loading-overlay {
  background: rgba(244, 244, 240, 0.95) !important;
}

body.theme-light #loading-overlay .bg-midnight-card {
  background: rgba(255, 255, 254, 0.98) !important;
  border-color: #d7d7d2 !important;
}

body.theme-light #loading-overlay h2,
body.theme-light #loading-overlay .text-white {
  color: #151515 !important;
}

body.theme-light #loading-overlay .text-gray-400,
body.theme-light #loading-overlay .text-gray-500 {
  color: #4b5563 !important;
}

body.theme-light .line-context-item {
  color: #4b5563;
}

body.theme-light .line-context-item:hover {
  color: #111827;
}

body.theme-light .line-context-item-active {
  color: #111827;
}

body.theme-light .line-kana {
  color: #1d4ed8 !important;
}

body.theme-light .line-romaji {
  color: #374151 !important;
}

body.theme-light .token-reading {
  color: #2563eb !important;
}

body.theme-light .token-reading-bottom {
  color: #334155 !important;
}

body.theme-light .line-trans-primary {
  color: #1e293b !important;
  font-weight: 600;
}

body.theme-light #lyrics-study-shell {
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.98), rgba(248, 248, 245, 0.98));
  border-color: #d7d7d2;
}

body.theme-light .lyric-line-wrap.detail-open {
  background: rgba(17, 24, 39, 0.04);
  border-color: rgba(17, 24, 39, 0.08);
}

body.theme-light .lesson-shell-section {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(39, 39, 42, 0.1);
}

body.theme-light .lyric-line {
  opacity: 0.78;
}

body.theme-light .lyric-line.selected,
body.theme-light .lyric-line.active-line,
body.theme-light .lyric-line:hover,
body.theme-light .lyric-line:focus-visible,
body.theme-light .lyric-line:active {
  opacity: 1;
  background-color: rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .lyric-line .font-jp,
body.theme-light .lyric-line .seg-line,
body.theme-light .lyric-line .text-white,
body.theme-light .lyric-line:hover .font-jp,
body.theme-light .lyric-line:hover .seg-line,
body.theme-light .lyric-line:hover .text-white,
body.theme-light .lyric-line:focus-visible .font-jp,
body.theme-light .lyric-line:focus-visible .seg-line,
body.theme-light .lyric-line:focus-visible .text-white,
body.theme-light .lyric-line:active .font-jp,
body.theme-light .lyric-line:active .seg-line,
body.theme-light .lyric-line:active .text-white {
  color: #0f172a !important;
}

body.theme-light .lyric-line .text-gray-300,
body.theme-light .lyric-line .text-gray-400,
body.theme-light .lyric-line .text-gray-500,
body.theme-light .lyric-line .text-gray-600,
body.theme-light .lyric-line:hover .text-gray-300,
body.theme-light .lyric-line:hover .text-gray-400,
body.theme-light .lyric-line:hover .text-gray-500,
body.theme-light .lyric-line:hover .text-gray-600,
body.theme-light .lyric-line:focus-visible .text-gray-300,
body.theme-light .lyric-line:focus-visible .text-gray-400,
body.theme-light .lyric-line:focus-visible .text-gray-500,
body.theme-light .lyric-line:focus-visible .text-gray-600,
body.theme-light .lyric-line:active .text-gray-300,
body.theme-light .lyric-line:active .text-gray-400,
body.theme-light .lyric-line:active .text-gray-500,
body.theme-light .lyric-line:active .text-gray-600 {
  color: #475569 !important;
}

body.theme-light .lyric-line .line-kana,
body.theme-light .lyric-line:hover .line-kana,
body.theme-light .lyric-line:focus-visible .line-kana,
body.theme-light .lyric-line:active .line-kana,
body.theme-light .lyric-line .token-reading,
body.theme-light .lyric-line:hover .token-reading,
body.theme-light .lyric-line:focus-visible .token-reading,
body.theme-light .lyric-line:active .token-reading {
  color: #2563eb !important;
}

body.theme-light .lyric-line .line-romaji,
body.theme-light .lyric-line:hover .line-romaji,
body.theme-light .lyric-line:focus-visible .line-romaji,
body.theme-light .lyric-line:active .line-romaji,
body.theme-light .lyric-line .token-reading-bottom,
body.theme-light .lyric-line:hover .token-reading-bottom,
body.theme-light .lyric-line:focus-visible .token-reading-bottom,
body.theme-light .lyric-line:active .token-reading-bottom {
  color: #64748b !important;
}

body.theme-light .lyric-line-detail,
body.theme-light .lyric-line-detail .text-gray-200,
body.theme-light .lyric-line-detail .text-gray-300,
body.theme-light .lyric-line-detail .text-gray-400,
body.theme-light .lyric-line-detail .text-gray-500,
body.theme-light .lyric-line-detail .text-gray-600 {
  color: #334155 !important;
}

body.theme-light .lyric-line-detail .font-jp,
body.theme-light .lyric-line-detail .text-white,
body.theme-light .lyric-line-detail .seg-line {
  color: #111827 !important;
}

body.theme-light #culture-content .text-gray-300,
body.theme-light #culture-content .text-gray-400,
body.theme-light #culture-content .text-gray-500,
body.theme-light #culture-content .text-gray-600,
body.theme-light #study-content .text-gray-300,
body.theme-light #study-content .text-gray-400,
body.theme-light #study-content .text-gray-500,
body.theme-light #study-content .text-gray-600,
body.theme-light #vocabulary-content .text-gray-300,
body.theme-light #vocabulary-content .text-gray-400,
body.theme-light #vocabulary-content .text-gray-500,
body.theme-light #vocabulary-content .text-gray-600 {
  color: #475569 !important;
}

body.theme-light #culture-content .text-white,
body.theme-light #study-content .text-white,
body.theme-light #vocabulary-content .text-white,
body.theme-light #vocabulary-content .font-jp {
  color: #111827 !important;
}

body.theme-light .seg-token-noun,
body.theme-light .seg-token-verb,
body.theme-light .seg-token-adjective,
body.theme-light .seg-token-particle,
body.theme-light .seg-token-expression,
body.theme-light .seg-token-auxiliary,
body.theme-light .seg-token-function_noun,
body.theme-light .seg-token-adverb,
body.theme-light .seg-token-conjunction,
body.theme-light .seg-token-interjection,
body.theme-light .seg-token-adnominal,
body.theme-light .seg-token-other,
body.theme-light .seg-token-adnominal .seg-token-surface,
body.theme-light .seg-token-adnominal .token-reading,
body.theme-light .seg-token-adnominal .token-reading-bottom {
  color: #0f172a !important;
}

body.theme-light .seg-token,
body.theme-light .seg-token:hover,
body.theme-light .seg-token:focus-visible,
body.theme-light .seg-token:active,
body.theme-light .lyric-line .seg-token,
body.theme-light .lyric-line:hover .seg-token,
body.theme-light .lyric-line:focus-visible .seg-token,
body.theme-light .lyric-line:active .seg-token {
  color: #0f172a !important;
}

body.theme-light .seg-token .token-surface,
body.theme-light .seg-token:hover .token-surface,
body.theme-light .seg-token:focus-visible .token-surface,
body.theme-light .seg-token:active .token-surface,
body.theme-light .lyric-line .seg-token .token-surface,
body.theme-light .lyric-line:hover .seg-token .token-surface,
body.theme-light .lyric-line:focus-visible .seg-token .token-surface,
body.theme-light .lyric-line:active .seg-token .token-surface {
  color: #0f172a !important;
}

body.theme-light .seg-token .token-reading,
body.theme-light .seg-token:hover .token-reading,
body.theme-light .seg-token:focus-visible .token-reading,
body.theme-light .seg-token:active .token-reading,
body.theme-light .lyric-line .seg-token .token-reading,
body.theme-light .lyric-line:hover .seg-token .token-reading,
body.theme-light .lyric-line:focus-visible .seg-token .token-reading,
body.theme-light .lyric-line:active .seg-token .token-reading {
  color: #2563eb !important;
}

body.theme-light .seg-token .token-reading-bottom,
body.theme-light .seg-token:hover .token-reading-bottom,
body.theme-light .seg-token:focus-visible .token-reading-bottom,
body.theme-light .seg-token:active .token-reading-bottom,
body.theme-light .lyric-line .seg-token .token-reading-bottom,
body.theme-light .lyric-line:hover .seg-token .token-reading-bottom,
body.theme-light .lyric-line:focus-visible .seg-token .token-reading-bottom,
body.theme-light .lyric-line:active .seg-token .token-reading-bottom {
  color: #475569 !important;
}

body.theme-light .seg-token-adnominal,
body.theme-light .seg-token-adnominal:hover,
body.theme-light .seg-token-adnominal:focus-visible,
body.theme-light .seg-token-adnominal:active,
body.theme-light .lyric-line .seg-token-adnominal,
body.theme-light .lyric-line:hover .seg-token-adnominal,
body.theme-light .lyric-line:focus-visible .seg-token-adnominal,
body.theme-light .lyric-line:active .seg-token-adnominal {
  background: rgba(132, 204, 22, 0.18) !important;
  border-color: rgba(101, 163, 13, 0.22) !important;
  color: #14532d !important;
}

body.theme-light .seg-token-adnominal .token-surface,
body.theme-light .seg-token-adnominal:hover .token-surface,
body.theme-light .seg-token-adnominal:focus-visible .token-surface,
body.theme-light .seg-token-adnominal:active .token-surface,
body.theme-light .lyric-line:hover .seg-token-adnominal .token-surface,
body.theme-light .lyric-line:focus-visible .seg-token-adnominal .token-surface,
body.theme-light .lyric-line:active .seg-token-adnominal .token-surface {
  color: #14532d !important;
}

body.theme-light .seg-token-adnominal .token-reading,
body.theme-light .seg-token-adnominal:hover .token-reading,
body.theme-light .seg-token-adnominal:focus-visible .token-reading,
body.theme-light .seg-token-adnominal:active .token-reading {
  color: #1d4ed8 !important;
}

body.theme-light .seg-token-adnominal .token-reading-bottom,
body.theme-light .seg-token-adnominal:hover .token-reading-bottom,
body.theme-light .seg-token-adnominal:focus-visible .token-reading-bottom,
body.theme-light .seg-token-adnominal:active .token-reading-bottom {
  color: #475569 !important;
}

body.theme-light .inline-analysis-label {
  color: #64748b !important;
}

body.theme-light .inline-analysis-value,
body.theme-light .lesson-note-copy {
  color: #0f172a !important;
}

body.theme-light .lesson-note-copy-example {
  color: #475569 !important;
}

body.theme-light .home-search-input {
  background: rgba(255, 255, 254, 0.98);
  border-color: #d7d7d2;
  color: #151515;
}

body.theme-light .home-search-input::placeholder {
  color: #8b8d93;
}

body.theme-light .home-search-input:focus {
  border-color: #7c7c85;
  box-shadow: 0 0 0 4px rgba(39, 39, 42, 0.06);
}

body.theme-light #pq-list > div,
body.theme-light #rp-list > div {
  background: linear-gradient(180deg, rgba(255, 255, 254, 0.98), rgba(248, 248, 245, 0.98)) !important;
  border: 1px solid #d7d7d2 !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

body.theme-light #pq-list > div:hover,
body.theme-light #rp-list > div:hover {
  background: rgba(241, 245, 249, 0.98) !important;
}

body.theme-light #pq-list > div .text-white,
body.theme-light #rp-list > div .text-white {
  color: #0f172a !important;
}

body.theme-light #pq-list > div .text-gray-500,
body.theme-light #rp-list > div .text-gray-500,
body.theme-light #pq-empty,
body.theme-light #rp-empty {
  color: #475569 !important;
}

body.theme-light #pq-list > div .bg-gray-800,
body.theme-light #rp-list > div .bg-gray-800 {
  background: #e2e8f0 !important;
}

body.theme-light .lyric-line .text-green-300,
body.theme-light .lyric-line .text-green-400,
body.theme-light .lyric-line:hover .text-green-300,
body.theme-light .lyric-line:hover .text-green-400,
body.theme-light .lyric-line:focus-visible .text-green-300,
body.theme-light .lyric-line:focus-visible .text-green-400,
body.theme-light .lyric-line:active .text-green-300,
body.theme-light .lyric-line:active .text-green-400,
body.theme-light .lesson-inline-focus .text-green-300,
body.theme-light .lesson-inline-focus .text-green-400,
body.theme-light #inline-line-card .text-green-300,
body.theme-light #inline-line-card .text-green-400,
body.theme-light #pq-list > div .text-green-300,
body.theme-light #pq-list > div .text-green-400,
body.theme-light #rp-list > div .text-green-300,
body.theme-light #rp-list > div .text-green-400 {
  color: #166534 !important;
}

/* ── Grammar word cards hover ────────────────────────────────────────────── */
.grammar-line-card .bg-midnight:hover {
  border-color: rgba(249, 168, 212, 0.3);
}

/* ── Sticky header shadow ────────────────────────────────────────────────── */
#song-header {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#playlist-description a {
  color: #e4e4e7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#playlist-description a:hover {
  color: #ffffff;
}

/* ── Mobile layout refinements ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  #song-header {
    top: 56px;
  }
}

@media (max-width: 768px) {
  #global-queue-shell {
    display: none !important;
  }

  .global-player-device-inline {
    gap: 0.5rem;
  }

  .global-player-source-cluster {
    display: none;
  }

  .global-player-device-select {
    min-width: 5.25rem;
    max-width: 7rem;
  }

  main {
    padding-top: 1rem;
    padding-bottom: calc(8.75rem + env(safe-area-inset-bottom)) !important;
  }

  #song-header h1 {
    font-size: 1rem;
  }

  #song-header p {
    font-size: 0.8rem;
  }

  #lyrics-list {
    -webkit-overflow-scrolling: touch;
  }

  #lesson-focus-shell {
    top: 4.6rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .lesson-focus-card {
    min-height: 12rem;
  }

  .seg-line {
    font-size: 1.35rem !important;
    line-height: 1.8 !important;
  }

  .lyric-line {
    padding: 0.9rem 0.95rem !important;
  }

  #lyrics-list {
    max-height: 68vh !important;
    padding-top: 0 !important;
    padding-bottom: 1rem !important;
  }

  #pl-scroll,
  #lib-scroll {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  #inline-line-card {
    border-radius: 1.35rem;
    padding: 0.95rem 0.95rem;
  }

  #song-change-banner,
  #auto-banner {
    width: calc(100vw - 1.5rem);
    min-width: 0;
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    bottom: 0.75rem;
  }

  .spotify-shell-inner {
    grid-template-columns: 80px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .global-player-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
    align-items: center;
  }

  #global-player-shell {
    bottom: 0 !important;
    max-height: min(42vh, 8.75rem);
    overflow-y: auto;
  }

  .global-player-track {
    gap: 0.5rem;
  }

  .global-player-center {
    grid-column: 1 / -1;
    order: 2;
  }

  .global-player-center .global-player-controls {
    display: none;
  }

  .global-player-center .spotify-timeline {
    margin-top: 0;
  }


  .global-player-device-inline {
    width: 100%;
    justify-content: flex-start;
    gap: 0.3rem;
    margin-top: 0.4rem;
  }

  .global-player-device-select {
    min-width: 5.8rem;
    max-width: 8rem;
  }

  /* Inline controls next to track info on mobile */
  .global-player-mobile-controls {
    display: flex;
    align-items: center;
    gap: 0.15rem;
  }

  .global-player-side {
    display: none;
  }

  .global-player-art,
  .global-player-art-fallback {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.8rem;
  }

  .spotify-art-wrap,
  .spotify-art,
  .spotify-art-fallback {
    width: 80px;
    height: 80px;
  }

  .spotify-title {
    font-size: 0.95rem;
  }

  .spotify-timeline {
    grid-template-columns: 3rem 1fr 3rem;
    min-height: 2.5rem;
    padding: 0.3rem 0;
  }

  .spotify-bar-bg {
    height: 0.9rem;
  }

  .spotify-icon-btn {
    width: 2.4rem;
    height: 2.4rem;
    min-width: 2.4rem;
    font-size: 1rem;
  }

  .kashi-compact {
    padding: 0.7rem !important;
  }

  .kashi-song-card:hover {
    transform: none;
    box-shadow: none;
  }

  .spotify-device-row {
    grid-template-columns: 1fr;
  }
}

/* Mobile full-screen lyrics adjustment */
@media (max-width: 1023px) {
  .lesson-main-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    max-width: none !important;
  }
  #lyrics-study-shell {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    margin-top: 0 !important;
    min-height: calc(100vh - 120px);
  }
  #lyrics-list {
    max-height: none !important;
    overflow-y: visible !important;
  }
  #lesson-info-panel {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    margin-top: 0 !important;
    min-height: calc(100vh - 120px);
  }
}

/* --- Cute Loading Animation --- */
.cute-loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.cute-note {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 10px rgba(236, 72, 153, 0.4));
  animation: bounce-note 0.8s infinite alternate ease-in-out;
}
@keyframes bounce-note {
  from { transform: translateY(0) rotate(-5deg) scale(1); }
  to { transform: translateY(-20px) rotate(5deg) scale(1.1); }
}
.loader-dots {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.loader-dot {
  width: 10px;
  height: 10px;
  background: #ec4899;
  border-radius: 50%;
  animation: pulse-dot 1.4s infinite ease-in-out both;
}
.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes pulse-dot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Expanded Lesson Overlay --- */
#expanded-lesson-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #09090b;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
  display: flex;
  flex-direction: column;
  visibility: hidden;
}
#expanded-lesson-overlay.open {
  transform: translateY(0);
  visibility: visible;
}
.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(9, 9, 11, 0.8);
  backdrop-blur: 12px;
  border-bottom: 1px border border-white/5;
  z-index: 110;
}
.overlay-close-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: #a1a1aa;
  transition: all 0.2s;
}
.overlay-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: scale(1.05);
}
.overlay-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 6rem;
}

#lesson-overlay-body {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s 0.2s;
}
#expanded-lesson-overlay.open #lesson-overlay-body {
  opacity: 1;
  transform: translateY(0);
}

.lesson-main-container {
  max-width: 1280px !important;
  margin: 0 auto;
}

/* Hide lyrics tab on desktop */
@media (min-width: 1024px) {
  .lesson-tab-btn[data-tab="lyrics"] {
    display: none !important;
  }
}

.seg-token-adverb {
  background: rgba(20, 184, 166, 0.12);
  color: #99f6e4;
}

.seg-token-conjunction {
  background: rgba(249, 115, 22, 0.12);
  color: #fed7aa;
}

.seg-token-interjection {
  background: rgba(217, 70, 239, 0.12);
  color: #f5d0fe;
}

.seg-token-adnominal {
  background: rgba(132, 204, 22, 0.12);
  color: #d9f99d;
}

.seg-token-function_noun {
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
}

/* --- Overlay Player Section --- */
#overlay-player-section {
  position: sticky;
  top: 0;
  z-index: 105;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px);
}

#overlay-player-art {
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.05);
}

#overlay-player-art-fallback {
  background: linear-gradient(135deg, #18181b 0%, #09090b 100%);
  color: #27272a;
}

#overlay-player-title {
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.overlay-content-scroll::-webkit-scrollbar {
  width: 4px;
}

.overlay-content-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

/* Make Play/Queue buttons in header look like circle icons */
#lyrics-study-shell .spotify-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  border-radius: 50%;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ── Kashi TTS play buttons ───────────────────────────────────────────────── */
.kashi-tts-btn,
.kashi-tts-btn-pill,
.kashi-tts-btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #d1d5db;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.kashi-tts-btn { width: 2rem; height: 2rem; font-size: 0.85rem; }
.kashi-tts-btn-mini { width: 1.5rem; height: 1.5rem; font-size: 0.7rem; }
.kashi-tts-btn-pill { padding: 0.25rem 0.6rem; font-size: 0.72rem; gap: 0.3rem; }
.kashi-tts-btn:hover,
.kashi-tts-btn-pill:hover,
.kashi-tts-btn-mini:hover {
  border-color: rgba(255, 105, 180, 0.45);
  background: rgba(255, 105, 180, 0.08);
  color: #fff;
}
body.theme-light .kashi-tts-btn,
body.theme-light .kashi-tts-btn-pill,
body.theme-light .kashi-tts-btn-mini {
  background: rgba(0,0,0,0.04);
  color: #374151;
  border-color: rgba(0,0,0,0.1);
}
body.theme-light .kashi-tts-btn:hover,
body.theme-light .kashi-tts-btn-pill:hover,
body.theme-light .kashi-tts-btn-mini:hover {
  border-color: rgba(219, 39, 119, 0.4);
  background: rgba(219, 39, 119, 0.06);
  color: #111827;
}

/* ── Review mode grade buttons ────────────────────────────────────────────── */
.rv-grade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.65rem 0.5rem;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
  color: #d1d5db;
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.rv-grade-btn:hover { transform: translateY(-1px); }
.rv-grade-btn[data-rating="1"]:hover { border-color: rgba(248,113,113,0.6); background: rgba(248,113,113,0.1); color: #fca5a5; }
.rv-grade-btn[data-rating="2"]:hover { border-color: rgba(251,191,36,0.6);  background: rgba(251,191,36,0.08);  color: #fcd34d; }
.rv-grade-btn[data-rating="3"]:hover { border-color: rgba(34,197,94,0.6);   background: rgba(34,197,94,0.08);   color: #86efac; }
.rv-grade-btn[data-rating="4"]:hover { border-color: rgba(56,189,248,0.6);  background: rgba(56,189,248,0.08);  color: #7dd3fc; }
.rv-grade-btn .rv-grade-label { font-weight: 600; letter-spacing: 0.02em; }
.rv-grade-btn .rv-grade-eta { font-size: 0.65rem; color: rgba(255,255,255,0.45); min-height: 0.85rem; }
.rv-grade-btn kbd {
  font-size: 0.6rem; opacity: 0.5; padding: 0 0.3rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0.25rem; background: rgba(0,0,0,0.2);
}
body.theme-light .rv-grade-btn { background: rgba(0,0,0,0.03); color: #374151; border-color: rgba(0,0,0,0.1); }

/* Queue Item UX Improvements */
.queue-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-light .queue-item {
  background-color: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.theme-light .queue-item:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
  border-color: var(--sakura) !important;
}

body.theme-light .queue-item p.text-white {
  color: #1a1a1b !important;
}

body.theme-light .queue-item p.text-gray-500 {
  color: #5c626d !important;
}

/* Wordbook Mobile UX Improvements */
@media (max-width: 640px) {
  #wb-list .flex-col {
    width: 100%;
  }
  
  #wb-list .wb-list-tts {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  #wb-daily-goal-card {
    padding: 1.25rem;
  }
}

.kashi-tts-btn-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  color: #fff;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.kashi-tts-btn-mini:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--sakura);
}

body.theme-light .kashi-tts-btn-mini {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1a1b;
}

/* Global Player UI Improvements */
body.theme-light #global-player-artist {
  color: #5c626d !important;
}

body.theme-light .spotify-icon-btn svg {
  color: #1a1a1b !important;
}

body.theme-light .global-player-device-label {
  color: #5c626d !important;
}

body.theme-light .spotify-select {
  background-color: rgba(0, 0, 0, 0.04) !important;
  color: #1a1a1b !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Queue Item UX Improvements - Theme Aware */
body.theme-light .queue-item,
body.theme-light #aq-status div.rounded-lg,
body.theme-light #aq-status div.rounded-xl {
  background-color: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.theme-light .queue-item p.text-white,
body.theme-light #aq-status p.text-white,
body.theme-light #aq-status p.text-gray-300 {
  color: #1a1a1b !important;
}

body.theme-light .queue-item p.text-gray-500,
body.theme-light #aq-status p.text-gray-500,
body.theme-light #aq-status p.text-gray-600 {
  color: #5c626d !important;
}

body.theme-light #aq-status div.bg-white\/5 {
  background-color: rgba(0, 0, 0, 0.05) !important;
}
