* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a237e;
  color: #fff;
}

.hidden { display: none !important; }

/* ── SCREENS ───────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: #0d1b4b;
}

/* Auth */
.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  width: min(360px, 90vw);
}

.auth-box h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.auth-box p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

#pwd-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
}
#pwd-input:focus { border-color: rgba(255,255,255,0.7); }

#pwd-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#pwd-btn:hover { background: rgba(255,255,255,0.35); }

.error { color: #ff6b6b; font-size: 0.9rem; }

/* Launch */
.launch-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.launch-box h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 3px;
}
.launch-sub {
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── APP ───────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#card-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

#card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: env(safe-area-inset-top, 20px) 24px env(safe-area-inset-bottom, 20px);
  gap: 0;
  transition: background-color 0.35s ease;
  overflow: hidden;
}

/* Movie info - top right */
#movie-info {
  position: absolute;
  top: max(env(safe-area-inset-top, 16px), 16px);
  right: 20px;
  text-align: right;
  opacity: 0.65;
  line-height: 1.4;
}
#movie-name-zh { display: block; font-size: 0.78rem; }
#movie-name    { display: block; font-size: 0.72rem; }

/* Word section */
#word-section {
  margin-bottom: 28px;
}

#word-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

#word {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

#pos {
  font-size: 1rem;
  font-style: italic;
  opacity: 0.7;
  margin-top: 4px;
}

#phonetic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  opacity: 0.75;
  margin-bottom: 14px;
}
.dot { opacity: 0.5; }

#meaning {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.9;
  max-width: 100%;
}

/* Quote section */
#quote-section {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 20px;
  transition: opacity 0.5s ease;
}

#quote-section.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

#quote-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

#quote {
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.6;
  opacity: 0.95;
  flex: 1;
}

#quote-zh {
  font-size: 0.95rem;
  opacity: 0.7;
  line-height: 1.5;
}

/* Audio buttons */
.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 6px;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
  color: inherit;
}
.audio-btn:active {
  opacity: 1;
  transform: scale(1.2);
}
.audio-btn.playing { opacity: 1; }
.audio-btn.disabled { opacity: 0.2; pointer-events: none; }

/* ── SETTINGS DRAWER ───────────────────── */
#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}

#settings-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a1a2e;
  border-radius: 20px 20px 0 0;
  padding: 12px 24px max(env(safe-area-inset-bottom, 20px), 20px);
  z-index: 51;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

#settings-drawer.open {
  display: block !important;
  transform: translateY(0);
}

.drawer-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin: 0 auto 20px;
}

#settings-drawer h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  opacity: 0.8;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.toggle-btn {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.4);
  background: transparent;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 64px;
}
.toggle-btn.on {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.8);
}

.speed-btns, .mode-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.speed-btn, .mode-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.3);
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.speed-btn.active, .mode-btn.active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.9);
  color: #fff;
  font-weight: 600;
}

/* ── SWIPE ANIMATION ───────────────────── */
#card.swipe-up {
  animation: swipeUp 0.28s ease forwards;
}
#card.swipe-down {
  animation: swipeDown 0.28s ease forwards;
}
#card.enter-up {
  animation: enterUp 0.28s ease forwards;
}
#card.enter-down {
  animation: enterDown 0.28s ease forwards;
}

@keyframes swipeUp   { to { transform: translateY(-100%); opacity: 0; } }
@keyframes swipeDown { to { transform: translateY(100%);  opacity: 0; } }
@keyframes enterUp   { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes enterDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── EAGLE FOOTER ──────────────────────── */
#eagle-footer {
  position: fixed;
  bottom: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  cursor: pointer;
}

.eagle-svg {
  width: 50px;
  height: 47px;
  animation: eagle-bob 0.72s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

@keyframes eagle-bob {
  from { transform: translateY(0px) rotate(-3deg); }
  to   { transform: translateY(-7px) rotate(3deg); }
}

.eagle-credit {
  font-size: 0.64rem;
  color: rgba(255,255,255,0.38);
  font-style: italic;
  letter-spacing: 0.5px;
}
