@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #333;
  --accent: #ff4000;
  --accent-dim: #cc3300;
  --text: #e8e8e8;
  --text-dim: #888;
  --radius: 6px;
  --player-max: 854px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* Site header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 14px 24px;
  background: rgba(8, 8, 8, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 64, 0, 0.15);
}

.site-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s;
}
.site-logo:hover { transform: scale(1.05); }
.site-logo span {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent);
}

.site-tool-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 16px 32px;
}

/* Tool intro */
.tool-intro {
  text-align: center;
  margin-bottom: 32px;
}

.tool-intro h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 64, 0, 0.4);
}

.subtitle {
  color: var(--text-dim);
  margin-top: 4px;
  font-size: 13px;
}

/* Site footer */
.site-footer {
  text-align: center;
  padding: 24px 16px 32px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.site-footer a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.site-footer a:hover { opacity: 0.7; }

/* URL input */
#url-input-section {
  margin-bottom: 24px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

.input-row input:focus {
  border-color: var(--accent);
}

button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dim);
}

button:active {
  opacity: 0.8;
}

#load-btn, #copy-btn {
  box-shadow: 0 0 20px rgba(255, 64, 0, 0.35);
}
#load-btn:hover, #copy-btn:hover {
  box-shadow: 0 0 35px rgba(255, 64, 0, 0.55);
}

.error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 6px;
}

/* Player */
#player-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#player-wrapper {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: var(--player-max);
  margin: 0 auto;
}

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#player iframe {
  width: 100%;
  height: 100%;
}

/* Controls panel */
#controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Playback row */
.playback-row {
  gap: 12px;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--border);
}

.time-display {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 52px;
}

.time-sep {
  color: var(--text-dim);
}

/* Scrubber */
.scrubber-row {
  padding: 0 2px;
}

#scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  position: relative;
}

#scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
}

#scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
}

/* Start / End endpoints */
.endpoints-row {
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.endpoint-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.endpoint-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.time-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
}

.step-btn:hover {
  background: var(--border);
}

.time-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  width: 72px;
  padding: 5px 4px;
  outline: none;
  cursor: text;
  transition: border-color 0.15s;
}

.time-input:focus {
  border-color: var(--accent);
}

.set-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
}

.set-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

/* Clip duration */
.clip-duration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 60px;
}

#clip-duration-label {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.clip-duration-sub {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Preview */
.preview-row {
  justify-content: center;
}

#preview-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 28px;
  font-size: 13px;
}

#preview-btn:hover {
  background: var(--accent);
  color: #fff;
}

#preview-btn.previewing {
  background: var(--accent);
  color: #fff;
}

/* Share section */
#share-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#share-section label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.share-row {
  display: flex;
  gap: 8px;
}

#share-url {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#copy-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  font-size: 13px;
}

#copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface2);
}

.copy-confirm {
  color: #4caf50;
  font-size: 12px;
  text-align: right;
}

.embed-note {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #app {
    padding: 20px 12px 48px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  /* Stack URL input + button */
  .input-row {
    flex-direction: column;
  }

  /* Stack Start / duration / End vertically */
  .endpoints-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .endpoint-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex: unset;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
  }

  .endpoint-group label {
    min-width: 36px;
  }

  .set-btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  /* Clip duration centered between the two groups */
  .clip-duration {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    min-width: unset;
  }

  #clip-duration-label {
    font-size: 15px;
  }

  /* Share URL wraps onto two lines */
  .share-row {
    flex-direction: column;
  }

  #copy-btn {
    width: 100%;
  }
}
