/* baseline reset (auto-injected) */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol { list-style: none; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
  --color-primary: #FF5C57;
  --color-accent: #FFD166;
  --color-bg: #1A1A2E;
  --color-surface: #FFFFFF;
  --color-text: #1A1A2E;
  --color-text-muted: #6B7280;
  --color-overlay-scrim: rgba(26,26,46,0.55);

  --radius-modal: 20px;
  --radius-btn: 50px;

  --font-base: -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;

  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;

  --toolbar-h: 64px;
  --progress-h: 4px;
}

/* ── Base ── */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  font-family: var(--font-base);
  overflow: hidden;
}

/* ── Player Body ── */
.player-body {
  position: relative;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
  background: var(--color-bg) url('../images/creator-thumbnail-bg.webp') center center / cover no-repeat;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* Cinematic dark vignette at bottom */
.player-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.08) 0%,
    rgba(0,0,0,0.0) 40%,
    rgba(0,0,0,0.65) 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Overlay (modal scrim) ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.60);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 10;
  transition: opacity 0.25s ease;
}
.overlay.hidden {
  display: none;
}

/* ── Modal ── */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  background: var(--color-surface);
  border-radius: var(--radius-modal);
  width: clamp(300px, 90vw, 480px);
  padding: var(--space-lg) var(--space-md);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  animation: modalIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -44%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal.hidden { display: none; }

.modal__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 32px;
  height: 32px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  transition: background 0.15s ease;
  pointer-events: auto;
}
.modal__close:hover { background: #e0e0e0; }
.modal__close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.modal__close img { width: 14px; height: 14px; display: block; }

.modal__inner {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.modal__avatar-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: relative;
}

.modal__avatar {
  width: 82px;
  height: 82px;
  object-fit: contain;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.modal__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.modal__badge {
  display: inline-block;
  background: linear-gradient(90deg, var(--color-primary), #ff8c3a);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 50px;
  text-transform: uppercase;
}

.modal__text {
  margin: 0;
  font-size: clamp(14px, 2.5vw, 15px);
  line-height: 1.55;
  color: var(--color-text);
  overflow-wrap: break-word;
}

/* ── Buttons ── */
.modal__btns {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.btn {
  flex: 1;
  min-height: 44px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  padding: 10px 16px;
  pointer-events: auto;
  user-select: none;
  overflow-wrap: break-word;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn--ghost {
  background: #f3f4f6;
  color: var(--color-text-muted);
}
.btn--ghost:hover { background: #e8e9ec; }

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), #ff8c3a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,92,87,0.4);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #e84d48, #f07a2a);
  box-shadow: 0 6px 18px rgba(255,92,87,0.5);
}

@media (prefers-reduced-motion: reduce) {
  .btn, .modal { transition: none; animation: none; }
}

/* ── Player Surface ── */
.player-surface {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
}

/* ── Player Meta (channel label, top-left) ── */
.player-meta {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(calc(-100vh + var(--toolbar-h) + 64px));
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: none;
}

.player-meta__channel {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.45);
  border-radius: 50px;
  padding: 4px 12px;
}

.player-meta__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulseDot 1.8s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

.player-meta__label {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.player-meta__views {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  background: rgba(0,0,0,0.35);
  border-radius: 50px;
  padding: 4px 10px;
}

/* ── Play Center Icon ── */
.play-center {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.play-center__icon {
  width: clamp(56px, 10vw, 80px);
  height: clamp(56px, 10vw, 80px);
  opacity: 0.82;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  user-select: none;
}

/* ── Toolbar ── */
.toolbar {
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.0) 100%);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
}

/* Progress */
.progress {
  width: 100%;
}

.progress__track {
  position: relative;
  height: var(--progress-h);
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: visible;
}

.progress__bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 21%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px;
}

.progress__thumb {
  position: absolute;
  top: 50%;
  left: 21%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

/* Controls row */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.controls__left,
.controls__right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.ctrl-icon {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  display: block;
  user-select: none;
}

.ctrl-time {
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── RTL support ── */
[dir='rtl'] .modal__inner {
  flex-direction: row-reverse;
}
[dir='rtl'] .modal__btns {
  flex-direction: row-reverse;
}
[dir='rtl'] .controls {
  flex-direction: row-reverse;
}

/* ── Desktop refinements ── */
@media (min-width: 768px) {
  .modal {
    padding: var(--space-lg) var(--space-lg);
  }
  .modal__avatar-wrap {
    width: 88px;
    height: 88px;
  }
  .modal__avatar {
    width: 100px;
    height: 100px;
  }
  .ctrl-icon {
    width: 22px;
    height: 22px;
  }
  .toolbar {
    padding: var(--space-lg) var(--space-lg) var(--space-md);
  }
}

@media (min-width: 1200px) {
  .toolbar {
    padding: var(--space-lg) calc(var(--space-lg) * 2) var(--space-md);
  }
  .player-meta {
    padding: var(--space-lg) calc(var(--space-lg) * 2);
  }
}

/* ── Hidden utility ── */
.hidden {
  display: none !important;
}

html,
body {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}
