/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1a1a1a; background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
button { cursor: pointer; border: none; background: none; font: inherit; }
a { color: #22c55e; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ── Header ─────────────────────────────────────────────── */
#header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid #f3f4f6; }
.header-left { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: #333; }
.logo-green { color: #4ade80; }
.tagline { font-size: 12px; color: #9ca3af; }
.header-nav { display: flex; align-items: center; gap: 10px; }
.nav-btn { font-size: 13px; font-weight: 500; color: #333; border: 1px solid #e5e7eb; padding: 7px 14px; border-radius: 12px; transition: all .2s; }
.nav-btn:hover { border-color: #4ade80; color: #22c55e; background: #f0fdf4; }
.pro-toggle { font-family: monospace; font-size: 11px; color: #9ca3af; background: #f9fafb; }
.pro-toggle.on { background: #f0fdf4; border-color: #86efac; color: #16a34a; }

/* ── Main Layout ────────────────────────────────────────── */
#main { flex: 1; display: flex; gap: 24px; max-width: 1280px; width: 100%; margin: 0 auto; padding: 32px 16px; align-items: flex-start; }
#left-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
footer { text-align: center; color: #d1d5db; font-size: 12px; padding: 20px; border-top: 1px solid #f3f4f6; }

/* ── Hero ───────────────────────────────────────────────── */
#hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#hero h1 { font-size: 24px; font-weight: 700; color: #333; }
.hero-desc { font-size: 13px; color: #9ca3af; }
.search-bar { position: relative; width: 100%; max-width: 600px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #d1d5db; pointer-events: none; }
#search-input { width: 100%; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 100px 12px 40px; font-size: 14px; color: #333; outline: none; transition: border-color .2s; }
#search-input::placeholder { color: #d1d5db; }
#search-input:focus { border-color: #4ade80; }
#search-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #4ade80; color: #fff; font-size: 12px; font-weight: 600; padding: 7px 16px; border-radius: 8px; transition: background .2s; }
#search-btn:hover { background: #22c55e; }
#no-results { font-size: 12px; color: #9ca3af; }

/* ── Guide ──────────────────────────────────────────────── */
#guide { padding: 16px 0; }
#guide h2 { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 20px; color: #333; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.guide-card { background: #fff; border: 1px solid #f3f4f6; border-radius: 16px; overflow: hidden; text-align: center; }
.guide-img { width: 100%; aspect-ratio: 4/3; position: relative; overflow: hidden; }
.guide-img img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.guide-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.guide-img-green .guide-fallback { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.guide-img-rose .guide-fallback { background: linear-gradient(135deg, #fef2f2, #fecaca); }
.guide-img-blue .guide-fallback { background: linear-gradient(135deg, #eff6ff, #bfdbfe); }
.guide-img img + .guide-fallback { display: none; }
.guide-card h3 { font-size: 13px; font-weight: 700; color: #333; margin-top: 12px; }
.guide-card p { font-size: 11px; color: #9ca3af; line-height: 1.5; padding: 4px 16px 16px; }

/* ── Ad Box ─────────────────────────────────────────────── */
.ad-box { width: 100%; max-width: 600px; margin: 0 auto; height: 72px; background: #f9fafb; border: 1px dashed #e5e7eb; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #d1d5db; letter-spacing: 1px; }

/* ── Scene Nav ──────────────────────────────────────────── */
.scene-nav-bar { display: flex; align-items: center; justify-content: space-between; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 16px; padding: 10px 20px; }
.scene-btn { font-size: 13px; font-weight: 500; padding: 8px 16px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; transition: all .2s; }
.scene-btn:hover:not(:disabled) { border-color: #4ade80; color: #22c55e; }
.scene-btn:disabled { opacity: .3; cursor: not-allowed; }
.scene-btn-green { background: #4ade80; color: #fff; border-color: #4ade80; }
.scene-btn-green:hover:not(:disabled) { background: #22c55e; color: #fff; }
.scene-counter { text-align: center; font-size: 13px; font-weight: 600; color: #333; }
.scene-counter .green { color: #22c55e; }
.scene-counter .dim { color: #d1d5db; margin: 0 4px; }
.scene-info { font-size: 11px; color: #9ca3af; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.free-limit { font-size: 11px; color: #9ca3af; text-align: center; margin-top: 8px; }

/* ── Player ─────────────────────────────────────────────── */
.player-section { display: flex; flex-direction: column; }
#player-container { width: 100%; aspect-ratio: 16/9; border-radius: 16px 16px 0 0; overflow: hidden; border: 1px solid #e5e7eb; border-bottom: none; background: #000; position: relative; }
#player-container iframe, #player-container > div { width: 100% !important; height: 100% !important; position: absolute; inset: 0; }
.player-hidden { opacity: 0; pointer-events: none; z-index: 0; }

/* ── Subtitle Panel ─────────────────────────────────────── */
#subtitle-panel { background: #f9fafb; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 16px 16px; padding: 20px 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.sub-line { min-height: 1.4em; }
.sub-dim { font-size: 13px; color: #9ca3af; opacity: .5; }
.sub-main { font-size: 22px; font-weight: 700; color: #000; line-height: 1.4; }
.sub-placeholder { font-size: 14px; font-weight: 400; color: #d1d5db; }
.sub-hint { font-size: 11px; color: #d1d5db; text-align: center; margin-top: -6px; }
.sub-divider { height: 1px; background: #e5e7eb; }
.sub-controls { display: flex; align-items: center; justify-content: space-between; }
.sub-controls-left { display: flex; align-items: center; gap: 10px; }
.ctrl-btn { font-size: 12px; font-weight: 500; color: #333; background: #fff; border: 1px solid #e5e7eb; padding: 6px 12px; border-radius: 8px; transition: all .2s; }
.ctrl-btn:hover { border-color: #4ade80; color: #22c55e; }
.ctrl-btn-sm { font-size: 12px; color: #9ca3af; transition: color .2s; }
.ctrl-btn-sm:hover { color: #333; }

/* Clickable words */
.word { cursor: pointer; padding: 0 2px; margin: 0 -2px; border-radius: 3px; transition: all .15s; }
.word:hover { background: #e0f2fe; color: #0369a1; }
.word.highlight { color: #22c55e; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ── Replay ─────────────────────────────────────────────── */
#replay-row { text-align: center; }
.replay-btn { font-size: 16px; font-weight: 600; padding: 12px 32px; border: 2px solid #4ade80; color: #22c55e; background: #f0fdf4; border-radius: 16px; transition: all .2s; }
.replay-btn:hover { background: #4ade80; color: #fff; box-shadow: 0 4px 12px rgba(74,222,128,.3); }

/* ── Shadowing ──────────────────────────────────────────── */
#shadowing-panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; overflow: hidden; }
.shadow-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: #f9fafb; border-bottom: 1px solid #f3f4f6; font-size: 13px; font-weight: 700; color: #333; }
.shadow-reset { font-size: 11px; color: #9ca3af; cursor: pointer; }
#shadow-body { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.shadow-sub { font-size: 12px; color: #9ca3af; font-style: italic; text-align: center; max-width: 400px; }
.shadow-record-btn { font-size: 16px; font-weight: 600; padding: 14px 32px; border-radius: 16px; background: linear-gradient(135deg, #ef4444, #f43f5e); color: #fff; transition: all .2s; }
.shadow-record-btn:hover { box-shadow: 0 4px 16px rgba(239,68,68,.3); }
.shadow-pro-note { font-size: 11px; color: #d1d5db; }
.shadow-timer { font-size: 28px; font-weight: 700; font-family: monospace; color: #ef4444; display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ef4444; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.shadow-stop-btn { font-size: 14px; font-weight: 600; padding: 10px 24px; border-radius: 12px; background: #333; color: #fff; }
.shadow-stop-btn:hover { background: #000; }
.shadow-compare { display: flex; gap: 12px; width: 100%; max-width: 360px; }
.shadow-compare button { flex: 1; padding: 12px; border-radius: 12px; border: 2px solid; font-size: 13px; font-weight: 600; transition: all .2s; }
.shadow-compare .btn-original { border-color: #4ade80; color: #22c55e; }
.shadow-compare .btn-original:hover { background: #f0fdf4; }
.shadow-compare .btn-myvoice { border-color: #93c5fd; color: #3b82f6; }
.shadow-compare .btn-myvoice:hover { background: #eff6ff; }
.shadow-compare .btn-myvoice.playing { background: #eff6ff; border-color: #60a5fa; }
.shadow-again { font-size: 12px; color: #9ca3af; }
.shadow-again:hover { color: #22c55e; }

/* ── Pro Space (sidebar) ────────────────────────────────── */
#pro-space { width: 300px; flex-shrink: 0; border-radius: 16px; border: 1px solid #e5e7eb; overflow: hidden; }
.pro-space-header { padding: 28px 24px; color: #fff; display: flex; flex-direction: column; gap: 10px; }
.pro-space-header.free { background: linear-gradient(135deg, #111827, #1f2937); }
.pro-space-header.active { background: linear-gradient(135deg, #065f46, #047857); }
.pro-badge { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #4ade80; display: flex; align-items: center; gap: 6px; }
.pro-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: pulse 2s infinite; }
.pro-space-header h3 { font-size: 17px; font-weight: 700; }
.pro-space-header p { font-size: 13px; color: #9ca3af; }
.pro-space-header.active p { color: rgba(167,243,208,.7); }
.pro-features { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; background: #f9fafb; }
.pro-features.active-bg { background: #f0fdf4; }
.pro-feat { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: #333; }
.pro-feat span:first-child { font-size: 16px; flex-shrink: 0; }
.pro-cta-area { padding: 20px 24px; background: #fff; border-top: 1px solid #f3f4f6; }
.cta-btn { display: block; width: 100%; text-align: center; padding: 12px; border-radius: 12px; font-size: 14px; font-weight: 600; background: linear-gradient(135deg, #4ade80, #22c55e); color: #fff; transition: all .2s; border: none; cursor: pointer; }
.cta-btn:hover { box-shadow: 0 4px 16px rgba(74,222,128,.3); }
.pro-note { font-size: 11px; color: #9ca3af; text-align: center; margin-top: 10px; }
.vocab-shortcut { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.vocab-shortcut span { font-size: 13px; font-weight: 500; color: #333; display: flex; align-items: center; gap: 6px; }
.vocab-badge { font-size: 11px; color: #22c55e; font-weight: 600; background: #fff; padding: 2px 8px; border-radius: 99px; border: 1px solid #86efac; }
.vocab-open-btn { width: 100%; padding: 10px; border-radius: 12px; border: 1px solid #86efac; color: #22c55e; font-weight: 600; font-size: 13px; background: #fff; transition: all .2s; }
.vocab-open-btn:hover { background: #f0fdf4; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); backdrop-filter: blur(4px); }
.modal-card { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.15); max-width: 420px; width: calc(100% - 32px); overflow: hidden; }
.modal-accent { height: 5px; background: linear-gradient(90deg, #4ade80, #22c55e); }
.modal-body { padding: 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.modal-body h2 { font-size: 20px; font-weight: 700; color: #333; }
.modal-body p { font-size: 13px; color: #6b7280; line-height: 1.6; }
.modal-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.green-circle { background: linear-gradient(135deg, #4ade80, #22c55e); box-shadow: 0 8px 24px rgba(74,222,128,.3); color: #fff; }
.price-tag { display: flex; align-items: baseline; gap: 4px; }
.price { font-size: 30px; font-weight: 900; color: #22c55e; }
.price-period { font-size: 14px; color: #9ca3af; }
.feature-list { width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 13px; color: #333; }
.feature-item { display: flex; align-items: center; gap: 8px; }
.trial-note { font-size: 11px; color: #9ca3af; }
.dismiss-btn { font-size: 12px; color: #9ca3af; transition: color .2s; }
.dismiss-btn:hover { color: #6b7280; }
.close-btn { font-size: 22px; color: #d1d5db; line-height: 1; transition: color .2s; }
.close-btn:hover { color: #6b7280; }

/* ── Slide Panel (Vocabulary) ───────────────────────────── */
.slide-panel { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end; background: rgba(0,0,0,.25); backdrop-filter: blur(4px); }
.slide-panel-inner { width: 100%; max-width: 400px; height: 100%; background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.1); display: flex; flex-direction: column; }
.panel-header { padding: 20px 24px; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between; }
.panel-header h2 { font-size: 17px; font-weight: 700; color: #333; }
.panel-header p { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.vocab-list { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.vocab-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #9ca3af; font-size: 13px; text-align: center; padding: 40px; }
.vocab-entry { background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 12px; padding: 12px 16px; position: relative; transition: border-color .2s; }
.vocab-entry:hover { border-color: #e5e7eb; }
.vocab-entry .vw { font-weight: 700; font-size: 13px; color: #333; }
.vocab-entry .vd { font-size: 12px; color: #6b7280; margin-top: 4px; }
.vocab-entry .vs { font-size: 11px; color: #9ca3af; font-style: italic; margin-top: 6px; padding-left: 8px; border-left: 2px solid #e5e7eb; }
.vocab-entry .vdel { position: absolute; top: 12px; right: 12px; font-size: 14px; color: #d1d5db; opacity: 0; transition: all .2s; }
.vocab-entry:hover .vdel { opacity: 1; }
.vocab-entry .vdel:hover { color: #ef4444; }

/* ── Word Tooltip ───────────────────────────────────────── */
.tooltip-card { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.15); max-width: 420px; width: calc(100% - 32px); overflow: hidden; }
.tooltip-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 20px 10px; }
.tooltip-header h3 { font-size: 20px; font-weight: 700; color: #333; }
.tt-phonetic { font-size: 13px; color: #9ca3af; margin-top: 2px; }
.tt-body { padding: 0 20px 12px; }
.tt-pos { display: inline-block; font-size: 11px; font-weight: 600; color: #22c55e; background: #f0fdf4; padding: 2px 8px; border-radius: 4px; margin-bottom: 6px; }
.tt-def { font-size: 13px; color: #333; line-height: 1.5; }
.tt-example { font-size: 12px; color: #9ca3af; font-style: italic; border-left: 2px solid #e5e7eb; padding-left: 10px; margin-top: 6px; }
.tt-context { padding: 10px 20px; border-top: 1px solid #f3f4f6; font-size: 11px; color: #9ca3af; }
.tt-save { margin: 12px 20px 20px; width: calc(100% - 40px); }
.tt-save.saved { background: #f0fdf4; color: #22c55e; border: 1px solid #86efac; }

/* ── Quiz ───────────────────────────────────────────────── */
.quiz-card { max-width: 480px; }
.quiz-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #f3f4f6; }
.quiz-header-left { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #333; }
.quiz-counter { font-size: 12px; color: #9ca3af; font-family: monospace; }
.quiz-progress { height: 3px; background: #f3f4f6; }
.quiz-progress-bar { height: 100%; background: #4ade80; transition: width .4s; }
.quiz-body { padding: 32px; text-align: center; }
.quiz-prompt { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; }
.quiz-word { font-size: 30px; font-weight: 900; color: #333; margin-bottom: 24px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.quiz-opt { width: 100%; padding: 14px 20px; border: 2px solid #e5e7eb; border-radius: 12px; font-size: 13px; font-weight: 500; color: #333; background: #fff; transition: all .2s; }
.quiz-opt:hover:not(:disabled) { border-color: #4ade80; background: #f0fdf4; }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { background: #f0fdf4; border-color: #4ade80; color: #16a34a; }
.quiz-opt.wrong { background: #fef2f2; border-color: #fca5a5; color: #ef4444; }
.quiz-opt.faded { background: #f9fafb; border-color: #f3f4f6; color: #d1d5db; }
.quiz-opt .opt-label { font-size: 11px; color: #d1d5db; font-family: monospace; margin-right: 6px; }
.quiz-result { padding: 48px 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.quiz-score { font-size: 40px; font-weight: 900; color: #22c55e; }
.quiz-result h2 { font-size: 20px; font-weight: 700; color: #333; }
.quiz-result p { font-size: 13px; color: #6b7280; }
.quiz-actions { display: flex; gap: 10px; margin-top: 8px; }
.quiz-actions .cta-btn { padding: 10px 24px; font-size: 13px; width: auto; }
.btn-outline { background: #fff; color: #333; border: 1px solid #e5e7eb; padding: 10px 24px; border-radius: 12px; font-size: 13px; font-weight: 600; transition: all .2s; }
.btn-outline:hover { background: #f9fafb; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  #main { flex-direction: column; }
  #pro-space { width: 100%; }
  .guide-grid { grid-template-columns: 1fr; }
  .tagline { display: none; }
}
