/* 黄瓜短剧 · 播放器原型 v1 */
:root {
  --accent: #d6b36a;
  --accent-bright: #e8cd92;
  --accent-ink: #191204;
  --accent-soft: rgba(214, 179, 106, 0.16);
  --ui-fade: 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --swap: 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #000; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #fff; font-size: 14px; user-select: none; -webkit-user-select: none;
}
.num { font-variant-numeric: tabular-nums; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* —— 舞台：移动端全屏，宽屏居中 9:16 —— */
#stage {
  position: fixed; inset: 0; margin: 0 auto;
  width: 100%; height: 100%;
  max-width: calc(100vh * 9 / 16);
  overflow: hidden; background: #000;
}

/* —— 三元素滑动窗口 —— */
#deck { position: absolute; inset: 0; }
.cell {
  position: absolute; inset: 0;
  will-change: transform;
}
.cell.anim { transition: transform var(--swap); }
.cell video { width: 100%; height: 100%; object-fit: cover; background: #000; }

#gesture { position: absolute; inset: 0; z-index: 5; touch-action: none; }

/* —— 控件层 —— */
#ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity var(--ui-fade); }
#ui.visible { opacity: 1; }
#ui > * { pointer-events: auto; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 20px;
  background: linear-gradient(rgba(0,0,0,0.4), transparent);
}
.back-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(20,20,24,0.5); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; }
#top-title { display: flex; flex-direction: column; line-height: 1.3; }
#drama-name { font-weight: 600; font-size: 15px; }
#ep-indicator { font-size: 12px; color: rgba(255,255,255,0.72); }
#pc-hints { margin-left: auto; font-size: 11px; color: rgba(255,255,255,0.45); display: none; }
@media (min-width: 900px) { #pc-hints { display: block; } }

/* —— 右侧操作栏 —— */
#rail {
  position: absolute; right: 8px; bottom: 170px;
  display: flex; flex-direction: column; gap: 22px; align-items: center;
}
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; }
.rail-btn svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.55)); }
.rail-btn i { font-style: normal; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.rail-btn.active svg { color: var(--accent); }
#btn-like.active svg { color: #ff5060; }
.rail-btn.pop svg { animation: pop 320ms ease; }
@keyframes pop { 40% { transform: scale(1.35); } }

/* —— 底部：字幕条 + 进度条 —— */
#bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 20px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
}
#ep-title { display: block; font-size: 16px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.6); padding-right: 64px; }
#cap-desc { display: block; font-size: 12px; color: rgba(255,255,255,0.72); margin: 4px 0 10px; padding-right: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ep-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ep-bar-main {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px; background: rgba(20,20,24,0.55);
  font-size: 13px; font-weight: 600; backdrop-filter: blur(4px);
}
.ep-bar-main svg { width: 17px; height: 17px; }
.ep-bar-main em { font-style: normal; font-weight: 400; font-size: 12px; color: rgba(255,255,255,0.65); }

#pbar-hit { position: relative; padding: 10px 0; cursor: pointer; touch-action: none; }
#pbar { position: relative; height: 3px; border-radius: 99px; background: rgba(255,255,255,0.28); transition: height 120ms; }
#pbar-hit.scrubbing #pbar { height: 6px; }
#pbar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: var(--accent); }
#pbar-knob {
  position: absolute; top: 50%; left: 0; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; transform: translate(-50%, -50%) scale(0);
  transition: transform 120ms; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
#pbar-hit.scrubbing #pbar-knob, #stage.paused #pbar-knob { transform: translate(-50%, -50%) scale(1); }
#scrub-time {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
  z-index: 14; font-size: 15px; color: rgba(255,255,255,0.8);
  opacity: 0; pointer-events: none; transition: opacity 120ms;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6); text-align: center;
}
#scrub-time b { font-size: 34px; font-weight: 700; color: #fff; margin-right: 6px; }
#stage.scrubbing #scrub-time { opacity: 1; }
#time-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 11px; color: rgba(255,255,255,0.65); }

.chip {
  padding: 4px 10px; border-radius: 99px; font-size: 12px;
  background: rgba(255,255,255,0.14); color: #fff;
}
.chip--primary { background: linear-gradient(160deg, var(--accent-bright), var(--accent)); color: var(--accent-ink); font-weight: 700; }

/* —— 中央播放按钮 —— */
#center-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 74px; height: 74px; display: grid; place-items: center;
  opacity: 0; pointer-events: none; transition: opacity 160ms, transform 160ms;
}
#center-play svg { width: 74px; height: 74px; color: rgba(255,255,255,0.85); filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)); }
#stage.paused #center-play { opacity: 1; }

/* —— 3x 徽标 —— */
#boost-badge {
  position: absolute; top: 16%; left: 50%; transform: translateX(-50%);
  z-index: 12; padding: 7px 16px; border-radius: 99px;
  background: rgba(20,20,24,0.8); font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity 140ms; pointer-events: none;
}
#boost-badge .num { color: var(--accent-bright); }
#stage.boosting #boost-badge { opacity: 1; }

/* —— 双击快进指示 —— */
.seek-hint {
  position: absolute; top: 0; bottom: 0; width: 34%;
  display: grid; place-items: center; z-index: 11;
  opacity: 0; pointer-events: none; font-size: 22px; font-weight: 700;
}
.seek-hint span { padding: 10px 16px; border-radius: 12px; background: rgba(20,20,24,0.7); }
#seek-hint-l { left: 0; }
#seek-hint-r { right: 0; }
.seek-hint.flash { animation: flash 500ms ease; }
@keyframes flash { 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* —— 声音提示 —— */
#unmute-pill {
  position: absolute; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 12; padding: 7px 14px; border-radius: 99px;
  background: rgba(20,20,24,0.85); border: 1px solid rgba(255,255,255,0.2);
  font-size: 12px; display: none;
}
#stage.muted-hint #unmute-pill { display: block; }

/* —— Toast —— */
#toast {
  position: absolute; bottom: 34%; left: 50%; transform: translateX(-50%);
  z-index: 30; padding: 9px 18px; border-radius: 99px;
  background: rgba(20,20,24,0.88); font-size: 13px; white-space: nowrap;
  opacity: 0; transition: opacity 180ms; pointer-events: none;
}
#toast.show { opacity: 1; }

/* —— 选集抽屉 —— */
#drawer-mask, #rate-mask {
  position: absolute; inset: 0; z-index: 18; background: rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; transition: opacity 220ms;
}
#drawer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: 68%; border-radius: 16px 16px 0 0; background: #16171d;
  transform: translateY(105%); transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
  display: flex; flex-direction: column;
}
#stage.drawer-open #drawer { transform: translateY(0); }
#stage.drawer-open #drawer-mask { opacity: 1; pointer-events: auto; }
#drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 10px;
}
#drawer-head b { font-size: 15px; display: block; }
#drawer-head .text-dim { font-size: 12px; color: rgba(255,255,255,0.45); }
#drawer-tabs { display: flex; gap: 8px; padding: 0 16px 10px; }
.tab {
  padding: 5px 14px; border-radius: 8px; font-size: 13px;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75);
}
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#drawer-grid {
  flex: 1; overflow-y: auto; padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-content: start;
}
.ep-item {
  aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255,255,255,0.07); font-size: 14px; position: relative;
}
.ep-item.watched { color: rgba(255,255,255,0.38); }
.ep-item.current { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--accent); }
.ep-item.current::after {
  content: ""; position: absolute; right: 5px; bottom: 5px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

/* —— 倍速面板 —— */
#rate-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  border-radius: 16px 16px 0 0; background: #16171d;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
#stage.rate-open #rate-sheet { transform: translateY(0); }
#stage.rate-open #rate-mask { opacity: 1; pointer-events: auto; }
#rate-sheet b { display: block; margin-bottom: 14px; font-size: 15px; }
#rate-list { display: flex; gap: 8px; flex-wrap: wrap; }
.rate-opt {
  flex: 1; min-width: 52px; padding: 9px 0; border-radius: 8px; text-align: center;
  background: rgba(255,255,255,0.08); font-size: 13px;
}
.rate-opt.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* —— 完结卡 —— */
#end-card {
  position: absolute; inset: 0; z-index: 25; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(0,0,0,0.82); text-align: center;
}
#stage.ended #end-card { display: flex; }
#end-card b { font-size: 22px; }
#end-card p { font-size: 13px; color: rgba(255,255,255,0.6); }
#end-count { font-size: 13px; color: rgba(255,255,255,0.75); margin-top: 6px; }
.end-actions { display: flex; gap: 12px; margin-top: 14px; }
.end-actions .chip { padding: 9px 20px; font-size: 14px; }

/* —— 站内版补充：链接形态的控件 —— */
a { color: inherit; text-decoration: none; }
a.icon-btn { display: grid; }
a#drama-name { color: inherit; }
a.ep-item { display: grid; place-items: center; }
a.chip { display: inline-flex; align-items: center; }
#end-card .chip--primary { color: var(--accent-ink); }


/* —— 双击点赞飘心 —— */
#hearts { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.heart-pop {
  position: absolute; width: 68px; height: 68px; margin: -34px 0 0 -34px;
  color: #ff5060; filter: drop-shadow(0 2px 10px rgba(0,0,0,0.4));
  animation: heartpop 900ms ease-out forwards;
}
@keyframes heartpop {
  0% { transform: scale(0) rotate(-12deg); opacity: 0; }
  18% { transform: scale(1.15) rotate(-8deg); opacity: 1; }
  40% { transform: scale(1) rotate(-8deg) translateY(-6px); opacity: 1; }
  100% { transform: scale(1.1) rotate(-4deg) translateY(-110px); opacity: 0; }
}

/* —— 播放器评论面板 —— */
#cmt-mask { position: absolute; inset: 0; z-index: 18; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity 220ms; }
#cmt-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21;
  height: 72%; border-radius: 16px 16px 0 0; background: #131318;
  transform: translateY(105%); transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
  display: flex; flex-direction: column;
}
#stage.cmt-open #cmt-sheet { transform: translateY(0); }
#stage.cmt-open #cmt-mask { opacity: 1; pointer-events: auto; }
#cmt-list { flex: 1; overflow-y: auto; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 16px; }
.pcmt { display: flex; gap: 10px; }
.pcmt-avatar { width: 34px; height: 34px; border-radius: 50%; background: #23232b; display: grid; place-items: center; font-size: 14px; color: var(--accent-bright); flex-shrink: 0; }
.pcmt-body { flex: 1; min-width: 0; }
.pcmt-head { font-size: 12px; color: rgba(255,255,255,0.5); display: flex; gap: 8px; align-items: baseline; }
.pcmt-head b { color: rgba(255,255,255,0.75); font-weight: 600; }
.pcmt-content { font-size: 14px; margin: 3px 0 5px; word-break: break-word; }
.pcmt-actions { display: flex; gap: 16px; }
.pcmt-actions button { font-size: 12px; color: rgba(255,255,255,0.5); }
.pcmt-actions .liked, .pcmt-actions button:active { color: var(--accent); }
.pcmt-replies { margin-top: 6px; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; }
.pcmt-replies div { font-size: 13px; color: rgba(255,255,255,0.75); word-break: break-word; }
.pcmt-replies b { color: rgba(255,255,255,0.5); font-weight: 500; }
.pcmt-empty { color: rgba(255,255,255,0.35); text-align: center; padding: 40px 0 20px; font-size: 14px; }
#cmt-inputbar { border-top: 1px solid rgba(255,255,255,0.08); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
.cmt-reply-chip { display: inline-block; font-size: 12px; color: var(--accent-bright); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; }
.cmt-inputrow { display: flex; gap: 10px; }
#cmt-input {
  flex: 1; min-width: 0; padding: 9px 14px; border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06);
  color: #fff; font: inherit; font-size: 14px; outline: none;
}
#cmt-input:focus { border-color: var(--accent); }

#cmt-nick {
  width: 88px; flex-shrink: 0; padding: 9px 12px; border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06);
  color: #fff; font: inherit; font-size: 13px; outline: none;
}
#cmt-nick:focus { border-color: var(--accent); }
.cmt-pending { font-style: normal; font-size: 11px; color: #d0a355; background: rgba(208,163,85,.14); padding: 2px 8px; border-radius: 99px; }
