/* Minimalist NCE UI — Inspired by modern elegant design */
:root {
  /* Google Color Scheme - Blue, Red, Yellow, Green */
  --bg: #ffffff;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --border: #dadce0;
  --shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
  --shadow-hover: 0 4px 6px -1px rgba(60, 64, 67, 0.15), 0 2px 4px -1px rgba(60, 64, 67, 0.1);
  --accent: #4285f4; /* Google Blue */
  --accent-hover: #3367d6; /* Darker Google Blue */
  --accent-light: #e8f0fe;
  --google-red: #ea4335;
  --google-yellow: #fbbc05;
  --google-green: #34a853;
  --radius: 8px;
  --control-h: 34px;
  --content-max: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124;
    --surface: #303134;
    --card: #303134;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #5f6368;
    --shadow: 0 1px 3px 0 rgba(66, 133, 244, 0.3);
    --shadow-hover: 0 4px 6px -1px rgba(66, 133, 244, 0.4), 0 2px 4px -1px rgba(66, 133, 244, 0.3);
    --accent: #8ab4f8;
    --accent-hover: #4285f4;
    --accent-light: #202124;
    --google-red: #f28b82;
    --google-yellow: #fdd663;
    --google-green: #81c995;
  }
}

/* 强制深色主题 class - 优先级高于媒体查询 */
body.dark-theme {
  --bg: #202124;
  --surface: #303134;
  --card: #303134;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --border: #5f6368;
  --shadow: 0 1px 3px 0 rgba(66, 133, 244, 0.3);
  --shadow-hover: 0 4px 6px -1px rgba(66, 133, 244, 0.4), 0 2px 4px -1px rgba(66, 133, 244, 0.3);
  --accent: #8ab4f8;
  --accent-hover: #4285f4;
  --accent-light: #202124;
  --google-red: #f28b82;
  --google-yellow: #fdd663;
  --google-green: #81c995;
}

/* 强制浅色主题 class */
body.light-theme {
  --bg: #ffffff;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --border: #dadce0;
  --shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
  --shadow-hover: 0 4px 6px -1px rgba(60, 64, 67, 0.15), 0 2px 4px -1px rgba(60, 64, 67, 0.1);
  --accent: #4285f4;
  --accent-hover: #3367d6;
  --accent-light: #e8f0fe;
  --google-red: #ea4335;
  --google-yellow: #fbbc05;
  --google-green: #34a853;
}

*{box-sizing:border-box}
html,body{height:100%}
[hidden]{display:none !important}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Microsoft YaHei",sans-serif;
  color:var(--text);
  background:var(--bg);
  min-height:100vh;
  padding:0 20px;
  position:relative;
}

/* Canvas background */
#bg-canvas{
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
}

.container{max-width:1200px;margin:0 auto;}

/* Apple-style Navbar */
.navbar {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 0 20px;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

/* Brand */
.navbar-brand {
  flex: 0 0 auto;
}

.navbar-logo {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.navbar-title {
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.navbar-logo:hover .navbar-title {
  color: var(--accent);
}

/* Main Navigation */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.navbar-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-block;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--accent);
}

.nav-link.active {
  font-weight: 600;
  color: var(--accent);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}



/* Right Actions */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-action-btn:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  transform: scale(1.05);
}

.nav-action-btn:active {
  transform: scale(0.95);
}

/* Theme Toggle */
.theme-icon {
  width: 18px;
  height: 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Show light icon in dark theme, dark icon in light theme */
body.light-theme .theme-icon.light,
body.dark-theme .theme-icon.dark {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
}

body.light-theme .theme-icon.dark,
body.dark-theme .theme-icon.light {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Responsive Navbar */
@media (max-width: 1200px) {
  .navbar-nav {
    gap: 20px;
  }
  
  .nav-link {
    font-size: 14px;
  }
}

@media (max-width: 1024px) {
  .navbar-content {
    gap: 16px;
  }
  
  .navbar-nav {
    gap: 16px;
  }
  
  .nav-link {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 8px 0;
  }
  
  .navbar-content {
    gap: 12px;
  }
  
  .navbar-title {
    font-size: 1.125rem;
  }
  
  .navbar-nav {
    display: none;
  }
  
  .navbar-actions {
    gap: 8px;
  }
  
  .nav-action-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
  }
  
  .theme-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 576px) {
  .navbar-content {
    justify-content: space-between;
  }
}

/* Header */
.hero{padding:40px 0 24px;text-align:center;position:relative}
.hero h1{
  font-size:2.5rem;
  color:var(--text);
  font-weight:600;
  margin:0 0 10px;
  letter-spacing:-0.02em;
}
.hero p{color:var(--muted);margin:0;font-size:16px;font-weight:400}

/* Back/Speed buttons inline with player — unify control height with audio */
.back-inline{display:inline-flex;align-items:center;gap:6px;height:var(--control-h);padding:0 12px;border-radius:8px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);color:inherit;flex:0 0 auto;}
.back-inline svg{width:14px;height:14px}
.back-inline[aria-pressed="true"]{background:var(--surface);color:var(--text);border-color:var(--text)}
/* Compact, icon-only button variant */
.back-inline.icon-only{padding:0 10px}
.back-inline.icon-only svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6}

/* Segmented control */
.segmented{display:inline-flex;gap:4px;background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:4px;margin-top:14px;}
.segmented .seg{appearance:none;border:1px solid transparent;background:transparent;color:var(--text);font-size:12px;padding:8px 12px;border-radius:8px;cursor:pointer;text-decoration:none;transition:all .15s ease; white-space:nowrap}
.segmented .seg.active{background:var(--bg);border-color:var(--text);box-shadow:var(--shadow);font-weight:600}
/* tiny segmented for minimal toolbar switches */
.segmented.tiny{padding:2px;gap:2px}
.segmented.tiny .seg{font-size:11px;padding:6px 8px}

/* Smaller top tabs for book switch - Apple style */
.segmented.tabs{
  padding:6px;
  gap:4px;
  margin-top:20px;
  display:inline-flex;
  background:var(--surface);
  border-radius:8px;
  border:1px solid var(--border);
}
.seg-wrap{max-width:var(--content-max); margin:0 auto; display:flex; justify-content:center}
.segmented.tabs .seg{
  font-size:13px;
  font-weight:500;
  padding:10px 20px;
  border-radius:8px;
  border:1px solid transparent;
  transition:all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  letter-spacing:0.3px;
}
.segmented.tabs .seg:hover{
  background:var(--bg);
  transform:scale(1.02);
}
.segmented.tabs .seg.active{
  background:var(--bg);
  color:var(--text);
  border-color:var(--text);
  box-shadow:var(--shadow);
  font-weight:600;
}

@media (max-width: 768px){
  .hero{padding:40px 0 20px}
  .hero h1{font-size:42px}
  .hero .subtitle{font-size:14px}
  .segmented.tabs{
    gap:2px;
    padding:4px;
    margin-top:16px;
  }
  .segmented.tabs .seg{
    font-size:12px;
    padding:8px 16px;
  }
  .lessons-grid{grid-template-columns:1fr;gap:6px}
  .lesson-item{padding:16px}
  .lesson-title{font-size:16px}
}

/* Book cards grid */
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px;padding:26px 0 64px}
.card{position:relative;border:1px solid var(--border);background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden;transition:transform .2s ease, box-shadow .2s ease}
.card:hover{transform:translateY(-4px)}
.card img{width:100%;height:160px;object-fit:cover;display:block;opacity:.9}
.card .body{padding:14px 14px 16px}
.card .title{font-weight:700;margin:6px 0 4px}
.card .sub{font-size:12px;color:var(--muted)}


/* Last seen section - integrated into lessons */
.last-seen-section{margin-bottom:20px; padding:8px 4px;}

/* Lessons container */
.lessons{padding:10px 0 40px; max-width:var(--content-max); margin:0 auto}

/* Lessons grid - Apple-inspired design */
.lessons-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:8px}
.lesson-item{
  background:var(--surface);
  border-radius:8px;
  border:1px solid var(--border);
  padding:20px;
  text-decoration:none;
  color:inherit;
  transition:all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position:relative;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.lesson-item:hover{
  transform:scale(1.02);
  box-shadow:0 8px 25px rgba(0,0,0,0.12);
  border-color:var(--border);
}
.lesson-item:active{
  transform:scale(1.01);
}
.lesson-content{display:flex;flex-direction:column;justify-content:center;flex:1;min-width:0;height:100%}
.lesson-num{
  font-size:11px;
  font-weight:600;
  color:var(--muted);
  letter-spacing:0.5px;
  text-transform:uppercase;
  margin-bottom:4px;
}
.lesson-title{
  font-size:17px;
  font-weight:600;
  line-height:1.3;
  color:var(--text);
}

/* Favorite button on lesson item - Apple style */
.fav-btn{
  flex:0 0 auto;
  width:32px;
  height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:transparent;
  color:var(--muted);
  opacity:0;
  transition:all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor:pointer;
  padding:0;
  margin:0;
  border:none;
  outline:none;
  border-radius:8px;
}
.lesson-item:hover .fav-btn{opacity:0.5}
.fav-btn:hover{
  opacity:1;
  color:var(--text);
  background:var(--surface);
  transform:scale(1.1);
}
.fav-btn.active{
  opacity:1;
  color:var(--text);
}
.fav-btn.active:hover{
  background:var(--surface);
}
.fav-btn svg{width:18px;height:18px;fill:currentColor}

/* Lesson page */
.toolbar{position:sticky;top:0;z-index:10;background:transparent;padding:6px 0 4px;border-bottom:none}
.toolbar .row{display:flex;align-items:center;justify-content:flex-end;gap:10px}
.toolbar .info{display:flex;align-items:center;gap:10px}
.toolbar .title{font-weight:700}
.toolbar .sub{font-size:12px;color:var(--muted)}
.controls{display:flex;align-items:center;gap:8px}
.btn{appearance:none;border:1px solid var(--border);background:var(--surface);color:inherit;border-radius:8px;padding:6px 10px;cursor:pointer;box-shadow:var(--shadow)}
.btn:hover{transform:translateY(-1px)}

.sentences{padding:20px 0 40px; max-width:var(--content-max); margin:0 auto}
.sentence{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px;
  margin:12px 0;
  cursor:pointer;
  transition:all .2s ease;
  text-decoration:none;
  color:inherit;
  display:block;
  position:relative;
}
.sentence:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-hover);
  border-color:var(--border);
}
.sentence.active{
  border:2px solid var(--text);
  box-shadow:0 6px 20px rgba(0,0,0,0.2);
  padding:19px; /* 减1px以补偿2px边框 */
}
.en{font-weight:600;font-size:1.1rem;line-height:1.5;color:var(--text)}
.cn{font-size:0.9rem;color:var(--muted);margin-top:8px;line-height:1.4}
.lang-en .cn{display:none}
.lang-cn .en{display:none}

/* Listen Mode - Clean minimal design */
.sentence.listen-mode:not(.revealed) {
  position: relative;
  cursor: pointer;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:var(--card);
}
.sentence.listen-mode:not(.revealed) .en,
.sentence.listen-mode:not(.revealed) .cn {
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
/* Cover overlay */
.sentence.listen-mode:not(.revealed)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card);
  border-radius: calc(var(--radius) - 1px);
  z-index: 1;
}
/* Reveal button */
.reveal-btn {
  display: none;
  position: absolute;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 2;
  opacity: 0;
  transition: all 0.2s ease;
  cursor: pointer;
  pointer-events: none;
}
.sentence.listen-mode:not(.revealed) .reveal-btn {
  display: inline-flex;
}
.sentence.listen-mode:not(.revealed):hover .reveal-btn {
  opacity: 0.7;
  pointer-events: auto;
}
.sentence.listen-mode:not(.revealed):hover .reveal-btn:hover {
  opacity: 1;
  transform: scale(1.02);
  box-shadow: var(--shadow-hover);
}
.reveal-btn .reveal-icon {
  display: inline-block;
}
.reveal-btn .reveal-text {
  display: inline-block;
}
/* Active sentence in listen mode */
.sentence.listen-mode.active:not(.revealed) {
  border:2px solid var(--text);
  box-shadow:0 6px 20px rgba(0,0,0,0.2);
  padding:19px; /* 减1px以补偿2px边框 */
  min-height:60px;
}
.sentence.listen-mode.active:not(.revealed) .reveal-btn {
  opacity: 0.9;
  border-color: var(--text);
  color: var(--text);
  pointer-events: auto;
}
/* Revealed sentences */
.sentence.listen-mode.revealed {
  cursor: default;
}
.sentence.listen-mode.revealed.active {
  border:2px solid var(--text);
  box-shadow:0 6px 20px rgba(0,0,0,0.2);
  padding:19px; /* 减1px以补偿2px边框 */
}
.sentence.listen-mode.revealed .en,
.sentence.listen-mode.revealed .cn {
  animation: revealText 0.3s ease forwards;
}
@keyframes revealText {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Revealed sentence: hide button in corner */
.sentence.listen-mode.revealed .reveal-btn {
  display: inline-flex;
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
  z-index: 3;
  pointer-events: auto;
}
.sentence.listen-mode.revealed .reveal-btn .reveal-icon {
  display: none;
}
.sentence.listen-mode.revealed:hover .reveal-btn {
  opacity: 0.7;
  pointer-events: auto;
}

/* Auto Continue Card */
.auto-continue-card{display:inline-flex; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:4px; animation:fadeIn 0.2s ease-out; height:var(--control-h); align-items:center;}
.auto-continue-option{display:flex; align-items:center; gap:0; border-radius:8px; transition:all 0.15s ease;}
.auto-continue-option input[type="radio"]{appearance:none; position:absolute; opacity:0;}
.auto-continue-option label{display:block; padding:6px 10px; font-size:12px; color:var(--text); cursor:pointer; border-radius:8px; border:1px solid transparent; transition:all 0.15s ease; margin:0; white-space:nowrap;}
.auto-continue-option input[type="radio"]:checked + label{background:var(--bg); color:var(--text); border-color:var(--text); box-shadow:var(--shadow); font-weight:600;}
.auto-continue-option:hover label{background:var(--bg);}
.auto-continue-option input[type="radio"]:disabled + label{opacity:0.5; cursor:not-allowed;}
.auto-continue-option input[type="radio"]:disabled + label:hover{background:transparent;}

@keyframes fadeIn{from{opacity:0; transform:scale(0.95);} to{opacity:1; transform:scale(1);}}
@keyframes slideDown{from{opacity:0; transform:translate(-50%, -20px);} to{opacity:1; transform:translate(-50%, 0);}}
@keyframes slideUp{from{opacity:1; transform:translate(-50%, 0);} to{opacity:0; transform:translate(-50%, -20px);}}

/* Responsive auto continue */
@media (max-width: 768px){
  .auto-continue-card{gap:2px; padding:3px;}
  .auto-continue-option label{padding:5px 8px; font-size:11px;}

  /* 播完后选项：2x2网格布局 */
  #afterPlayCard{
    display:grid !important;
    grid-template-columns:1fr 1fr;
    grid-template-rows:auto auto;
    gap:4px;
    padding:4px;
    width:100%;
    flex-wrap:nowrap;
  }
  #afterPlayCard .auto-continue-option{
    width:100%;
    display:flex;
  }
  #afterPlayCard .auto-continue-option label{
    width:100%;
    text-align:center;
    padding:8px 6px;
    font-size:12px;
  }

  /* 播完后的settings-group垂直居中 */
  .settings-group:has(#afterPlayCard){
    align-items:center;
  }
}

/* Audio */
.player{display:flex; align-items:center; gap:8px; margin:6px auto 10px; padding:0; background:transparent; border:none; box-shadow:none; min-height:var(--control-h); max-width:var(--content-max); width:100%;}

/* Custom Audio Player */
.custom-player{display:flex; align-items:center; gap:8px; flex:1; height:var(--control-h); background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:0 12px; box-shadow:var(--shadow); transition:all .2s ease;}
.custom-player:hover{box-shadow:var(--shadow-hover);}
.custom-player audio{display:none;}

/* Play/Pause Button */
.play-btn{display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; background:transparent; border:none; color:var(--text); cursor:pointer; padding:0; transition:all .2s ease;}
.play-btn:hover{transform:scale(1.1);}
.play-btn svg{width:18px; height:18px;}

/* Time Display */
.time-display{font-size:11px; font-weight:500; color:var(--muted); min-width:32px; text-align:center; font-variant-numeric:tabular-nums;}

/* Progress Container */
.progress-container{flex:1; height:100%; display:flex; align-items:center; cursor:pointer; padding:0 4px;}
.progress-bar{position:relative; width:100%; height:4px; background:color-mix(in srgb, var(--border) 80%, transparent); border-radius:2px; overflow:hidden;}
.progress-filled{height:100%; background:var(--text); border-radius:2px; transition:width .1s linear; min-width:0;}
.progress-bar:hover{height:6px;}
.progress-bar:hover .progress-filled{height:100%;}

/* Lesson bottom navigation */
.lesson-nav{display:flex; gap:10px; padding:6px 0 16px; max-width:var(--content-max); margin:0 auto}
.btn-nav{display:inline-flex; align-items:center; justify-content:center; padding:8px 14px; min-width:96px;
  border-radius:8px; border:1px solid var(--border); background:var(--surface); color:inherit; text-decoration:none; box-shadow:var(--shadow);
  transition:transform .15s ease, box-shadow .15s ease}
.btn-nav:hover{transform:translateY(-2px); box-shadow:var(--shadow)}
/* 让第一个可见按钮靠左，最后一个可见按钮靠右 */
.btn-nav.prev{margin-right:auto}
.btn-nav.next{margin-left:auto}

/* Footer - Parallel Layout */
footer{
  padding:16px 0;
  color:var(--muted);
  margin-top:30px;
  border-top:1px solid var(--border);
}
footer p{
  margin:3px 0;
  font-size:12px;
  font-weight:500;
}

/* Main Footer Container - Parallel Layout */
.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Left Section: GitHub Link and Credits */
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* GitHub Link */
.repo {
  margin: 0;
}

.gh-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--muted);
  text-decoration:none;
  transition:all .2s ease;
  padding:4px 8px;
  border-radius:8px;
}
.gh-link:hover{
  color:var(--text);
  background:color-mix(in srgb, var(--surface) 50%, transparent);
}

/* Footer Credits */
.footer-credits {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

/* Byline, Thanks, Version */
.byline, .thanks, .version {
  margin: 0;
  font-size: 12px;
  text-align: left;
}

.byline a, .thanks a, .version a{
  color:var(--muted);
  text-decoration:none;
  transition:color .2s ease;
}
.byline a:hover, .thanks a:hover, .version a:hover{
  color:var(--text);
}

.version {
  opacity: 0.75;
  font-family:-apple-system, BlinkMacSystemFont, "SF Mono", "Monaco", "Cascadia Code", monospace;
  letter-spacing:0.3px;
}

/* AI Translation Note */
.ai-translation {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

/* Right Section: Copyright Information */
.copyright-section {
  margin: 0;
  padding: 0;
  border-top: none;
  text-align: right;
  flex-shrink: 0;
}

.copyright-text {
  font-size: 13px;
  color: var(--muted);
  margin: 3px 0;
  line-height: 1.4;
  opacity: 0.85;
}

/* SSL Certificate Icon */
.ssl-cert {
  margin: 6px 0;
}

.ssl-cert img {
  max-height: 24px;
}

/* Responsive Footer */
@media (max-width: 768px) {
  footer {
    padding: 12px 0;
    margin-top: 24px;
  }
  
  .footer-container {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
  }
  
  .footer-left {
    flex-direction: column;
    gap: 8px;
  }
  
  .footer-credits {
    align-items: center;
  }
  
  .byline, .thanks, .version {
    text-align: center;
  }
  
  .copyright-section {
    text-align: center;
  }
  
  .copyright-text {
    font-size: 12px;
    line-height: 1.3;
  }
  
  .ssl-cert img {
    max-height: 20px;
  }
}

/* Sections on index (e.g., recents) */
.section{ padding:6px 0 8px }
.section-title{ font-size:12px; color:var(--muted); letter-spacing:.02em; margin:4px 2px 8px; }

/* Last seen card - 融入整体设计 */
.last-seen{
  background:var(--surface);
  border-radius:8px;
  border:1px solid var(--border);
  border-left:4px solid var(--border);
  padding:20px;
  text-decoration:none;
  color:inherit;
  transition:all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:8px 4px 16px 4px;
}
.last-seen:hover{
  transform:scale(1.02);
  box-shadow:0 8px 25px rgba(0,0,0,0.12);
  border-color:var(--border);
  border-left-color:var(--border);
}
.last-seen:active{
  transform:scale(1.01);
}
.last-seen .lesson-content::before{
  content:'继续学习';
  position:absolute;
  top:-6px;
  left:0;
  font-size:10px;
  font-weight:600;
  color:var(--muted);
  background:var(--surface);
  padding:0 6px;
  border-radius:4px;
  letter-spacing:0.5px;
  text-transform:uppercase;
}

/* Links */
a{color:inherit}
a{text-decoration:none}

/* GitHub icon link */
.gh-link svg{width:18px;height:18px;fill:currentColor;opacity:.8;vertical-align:middle;transition:opacity .2s ease, transform .2s ease}
.gh-link:hover svg{opacity:1;transform:translateY(-1px)}

/* Smooth theme transitions for surfaces */
body, .card, .lesson-item, .sentence{ transition: background-color .35s ease, color .35s ease, box-shadow .35s ease, border-color .35s ease; }

/* Settings Panel (Apple-like modal sheet) */
.settings-overlay{position:fixed; inset:0; background:color-mix(in srgb, var(--bg) 30%, rgba(0,0,0,0.35)); backdrop-filter:saturate(130%) blur(12px); -webkit-backdrop-filter:saturate(130%) blur(12px); z-index:900;}
.settings-panel{position:fixed; left:50%; top:50%; transform:translate(-50%,-52%) scale(.98); width:min(92vw, 520px); max-height:min(86vh, 680px); overflow:auto; background:var(--surface); border:1px solid var(--border); border-radius:8px; box-shadow:var(--shadow); z-index:901; padding:12px 14px; display:flex; flex-direction:column; gap:10px; opacity:0;}
.settings-overlay, .settings-panel{transition:opacity .22s ease, transform .22s ease}
.settings-overlay{opacity:0}
.settings-overlay.show{opacity:1}
.settings-panel.show{opacity:1; transform:translate(-50%,-50%) scale(1)}
.settings-header{display:flex; align-items:center; justify-content:space-between; padding:4px 6px 2px 6px; border-bottom:1px solid color-mix(in srgb, var(--border) 70%, transparent);}
.settings-header h2{font-size:16px; font-weight:600; margin:6px 0;}
.icon-btn{display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:8px; border:1px solid var(--border); background:var(--surface); color:inherit; box-shadow:var(--shadow); cursor:pointer}
.icon-btn:hover{background:color-mix(in srgb, var(--surface) 80%, transparent)}
.settings-body{display:flex; flex-direction:column; gap:10px; padding:4px}
.settings-group{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:12px; border:1px solid var(--border); border-radius:8px; background:var(--bg)}
.settings-left{display:flex; flex-direction:column; gap:4px; min-width:0;}
.settings-label{font-size:13px; color:var(--text); font-weight:600}
.settings-desc{font-size:12px; color:var(--muted); line-height:1.5}
.settings-control{display:flex; align-items:center; gap:8px}
.settings-footer{display:flex; justify-content:space-between; padding:6px}
.settings-control #modeToggle{display:none}

/* Make inline controls adapt nicely inside panel */
.settings-panel .back-inline{height:28px; padding:0 10px}
.settings-panel .auto-continue-card{height:auto; padding:6px}
.settings-panel .auto-continue-option label{padding:6px 10px}

/* After-Play options: inline segmented control with short labels */
#afterPlayCard{
  display:inline-flex;
  flex-direction:row;
  align-items:center;
  gap:4px;
  height:auto;
  padding:6px;
  width:auto;
  flex-wrap:wrap; /* 极小屏允许换行但保持整齐 */
}
#afterPlayCard .auto-continue-option label{
  display:block;
  white-space:nowrap;
  text-align:center;
  min-height:0;
  padding:6px 10px;
  width:auto;
}

/* Hide overflow-prone inline controls on small screens (defensive) */
@media (max-width: 560px){
  .player .back-inline:not(#backLink):not(#settingsBtn){display:none}
}

/* Shortcuts Help Panel */
.shortcuts-panel{max-height:min(90vh, 720px)}
.shortcuts-group{padding:12px 0; border-bottom:1px solid color-mix(in srgb, var(--border) 50%, transparent)}
.shortcuts-group:last-child{border-bottom:none}
.shortcuts-group h3{font-size:13px; font-weight:600; color:var(--text); margin:0 0 10px 0; letter-spacing:0.3px}
.shortcut-item{display:flex; align-items:center; justify-content:space-between; padding:8px 0; gap:12px}
.shortcut-item kbd{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:32px;
  height:28px;
  padding:0 10px;
  border-radius:6px;
  border:1px solid var(--border);
  background:var(--surface);
  box-shadow:0 2px 4px rgba(0,0,0,0.08), inset 0 -1px 0 rgba(0,0,0,0.1);
  font-family:-apple-system, BlinkMacSystemFont, "SF Mono", "Monaco", "Cascadia Code", monospace;
  font-size:12px;
  font-weight:500;
  color:var(--text);
  letter-spacing:0.3px;
  white-space:nowrap;
}
.shortcut-item span{font-size:13px; color:var(--muted); flex:1; text-align:right}

@media (prefers-color-scheme: light) {
  .shortcut-item kbd{
    background:linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
    box-shadow:0 2px 4px rgba(0,0,0,0.05), inset 0 -1px 0 rgba(0,0,0,0.06);
  }
}

/* PWA Install Prompt */
.pwa-prompt{
  position:fixed;
  bottom:20px;
  right:20px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px 10px 10px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  z-index:800;
  opacity:0;
  transform:translateY(10px);
  transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events:none;
}
.pwa-prompt.show{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}
.pwa-prompt-icon{
  width:40px;
  height:40px;
  border-radius:9px;
  background:var(--bg);
  padding:4px;
  flex-shrink:0;
}
.pwa-prompt-content{
  display:flex;
  flex-direction:column;
  gap:2px;
  flex:1;
  min-width:0;
}
.pwa-prompt-title{
  font-size:13px;
  font-weight:500;
  color:var(--text);
}
.pwa-prompt-sub{
  font-size:11px;
  color:var(--muted);
  line-height:1.4;
}
.pwa-prompt-sub .ios-icon{
  display:inline-block;
  width:16px;
  height:16px;
  vertical-align:middle;
  margin:0 2px;
}
.pwa-prompt-btn{
  padding:6px 12px;
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:6px;
  font-size:12px;
  font-weight:500;
  cursor:pointer;
  box-shadow:var(--shadow);
  transition:transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink:0;
}
.pwa-prompt-btn:hover{
  transform:translateY(-1px);
}
.pwa-prompt-close{
  color:var(--muted);
  cursor:pointer;
  font-size:16px;
  line-height:1;
  padding:4px;
  opacity:0.6;
  transition:opacity 0.2s;
  flex-shrink:0;
}
.pwa-prompt-close:hover{
  opacity:1;
}
@media (max-width: 480px){
  .pwa-prompt{
    left:12px;
    right:12px;
    bottom:12px;
    gap:10px;
  }
  .pwa-prompt-content{
    flex:1;
  }
  .pwa-prompt-btn{
    padding:6px 10px;
  }
  .pwa-prompt.ios-prompt{
    flex-direction:column;
    align-items:stretch;
    text-align:center;
    padding:16px;
  }
  .pwa-prompt.ios-prompt .pwa-prompt-icon{
    width:48px;
    height:48px;
    margin:0 auto 8px;
  }
  .pwa-prompt.ios-prompt .pwa-prompt-close{
    position:absolute;
    top:8px;
    right:8px;
  }
}

/* ============================== */
/* Google Color Scheme Overrides */
/* ============================== */

/* Buttons */
.btn-nav, .btn, .play-btn, .back-inline {
  background: var(--accent) !important;
  color: white !important;
  border: none !important;
}

.btn-nav:hover, .btn:hover, .play-btn:hover, .back-inline:hover {
  background: var(--accent-hover) !important;
}

/* Card hover effect */
.card:hover {
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.15) !important;
}

/* Segmented control */
.segmented .seg.active {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

/* Tabs segmented control */
.segmented.tabs .seg.active {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

/* Sentence active state */
.sentence.active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-light) !important;
}

/* Auto continue options */
.auto-continue-option input[type="radio"]:checked + label {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

/* Progress bar */
.progress-filled {
  background: var(--accent) !important;
}

/* Favorite button */
.fav-btn.active {
  color: var(--google-yellow) !important;
}

/* Settings buttons */
.settings-footer .btn-nav {
  background: var(--accent) !important;
  color: white !important;
}

.settings-footer .btn-nav:hover {
  background: var(--accent-hover) !important;
}

/* PWA install button */
.pwa-prompt-btn {
  background: var(--accent) !important;
  color: white !important;
}

.pwa-prompt-btn:hover {
  background: var(--accent-hover) !important;
}

/* Shortcuts panel buttons */
.shortcuts-footer .btn-nav {
  background: var(--accent) !important;
  color: white !important;
}

.shortcuts-footer .btn-nav:hover {
  background: var(--accent-hover) !important;
}

/* Back inline button active state */
.back-inline[aria-pressed="true"] {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

/* Segmented control hover */
.segmented .seg:hover {
  background: var(--accent-light) !important;
}

/* Segmented tabs hover */
.segmented.tabs .seg:hover {
  background: var(--accent-light) !important;
}

/* Auto continue option hover */
.auto-continue-option:hover label {
  background: var(--accent-light) !important;
}

/* Fav button hover */
.fav-btn:hover {
  color: var(--google-yellow) !important;
}

/* Settings reset button */
.settings-footer .btn {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.settings-footer .btn:hover {
  background: var(--accent-light) !important;
}
