/* video-comic: 精彩定格AI styles */
* { margin:0; padding:0; box-sizing:border-box; }
body {
    background:#111; color:#eee; font-family:'Segoe UI',sans-serif;
    display:flex; justify-content:center; padding:30px 16px; min-height:100vh;
}
.container { max-width:900px; width:100%; }

/* Upload area */
.upload-area {
    border:2px dashed #555; border-radius:12px; padding:30px;
    text-align:center; margin-bottom:20px; cursor:pointer;
    transition:border-color .3s;
}
.upload-area:hover { border-color:#888; }
.upload-area.has-file { border-color:#4caf50; }
.upload-icon { font-size:40px; margin-bottom:10px; }
.upload-text { font-size:16px; }
.upload-hint { color:#666; font-size:13px; margin-top:6px; }

/* Player */
.player-wrap {
    position:relative; width:100%; border-radius:8px; overflow:hidden;
    background:#000; display:none; cursor:pointer;
}
.player-wrap video { width:100%; display:block; }
#comicLayer {
    position:absolute; top:0; left:0; width:100%; height:100%;
    display:none; object-fit:contain; cursor:pointer;
    z-index:10; opacity:0;
    transition: opacity 0.5s ease-in-out;
}
#comicLayer.visible { opacity:1; }
#comicLayer.fade-out { opacity:0; }

/* Huazi overlay - above comic */
#huaziOverlay {
    position:absolute;top:0;left:0;width:100%;height:100%;
    pointer-events:none;z-index:20;
}

/* Control bar */
.ctrl-bar {
    display:none; align-items:center; gap:10px;
    margin-top:8px; padding:10px 14px;
    background:#1e1e1e; border-radius:8px; user-select:none;
}
.ctrl-bar.show { display:flex; }

#playBtn {
    background:none; border:none; color:#eee; font-size:22px;
    cursor:pointer; padding:2px 6px; line-height:1;
    transition:color .2s; flex-shrink:0;
}
#playBtn:hover { color:#4caf50; }

#seekBar {
    flex:1; height:5px; -webkit-appearance:none; appearance:none;
    background:#444; border-radius:3px; outline:none; cursor:pointer;
}
#seekBar::-webkit-slider-thumb { -webkit-appearance:none; width:14px; height:14px; border-radius:50%; background:#4caf50; cursor:pointer; }
#seekBar::-moz-range-thumb { width:14px; height:14px; border-radius:50%; background:#4caf50; cursor:pointer; border:none; }

#timeDisplay { font-size:13px; color:#999; flex-shrink:0; font-variant-numeric:tabular-nums; min-width:90px; text-align:right; }

/* Buttons */
.btn { border:none; border-radius:6px; padding:4px 12px; font-size:13px; cursor:pointer; white-space:nowrap; transition:background .15s; }
.btn-green { background:#4caf50; color:#fff; }
.btn-green:hover { background:#43a047; }
.btn-pink { background:#e91e63; color:#fff; }
.btn-pink:hover { background:#d81b60; }
.btn-red { background:#f44336; color:#fff; }
.btn-red:hover { background:#e53935; }
.btn-gray { background:#444; color:#ccc; }
.btn-gray:hover { background:#555; }

/* Fade row */
.fade-row { display:flex; align-items:center; gap:6px; margin-left:auto; flex-shrink:0; }
.fade-row label { color:#888; font-size:12px; flex-shrink:0; }
#fadeSlider { width:60px; height:4px; -webkit-appearance:none; appearance:none; background:#555; border-radius:2px; outline:none; cursor:pointer; }
#fadeSlider::-webkit-slider-thumb { -webkit-appearance:none; width:12px; height:12px; border-radius:50%; background:#4caf50; cursor:pointer; }
#fadeSlider::-moz-range-thumb { width:12px; height:12px; border-radius:50%; background:#4caf50; cursor:pointer; border:none; }
#fadeLabel { color:#4caf50; font-size:12px; min-width:28px; text-align:right; flex-shrink:0; }


/* Hero section */
.hero-section { text-align:center; margin-bottom:24px; padding-top:10px; }
.hero-title {
    font-size:36px; font-weight:bold;
    background: linear-gradient(135deg, #e91e63, #ff6f00, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing:6px; margin-bottom:6px;
}
.hero-subtitle {
    font-size:14px; color:#888;
    letter-spacing:3px;
}

/* Style gallery: hidden by default, show on convert */
.style-gallery { display:none; }
.style-gallery.show { display:grid; }

.style-gallery {
    display:grid; gap:8px; margin-top:14px;
    grid-template-columns: repeat(3, 1fr);
}
.style-card {
    position:relative; border-radius:10px; overflow:hidden;
    border:2px solid #333; cursor:pointer; transition:all .2s;
    background:#1a1a1a; aspect-ratio:16/10;
}
.style-card:hover { border-color:#888; transform:scale(1.03); }
.style-card.selected { border-color:#4caf50; box-shadow:0 0 12px #4caf5066; }
.style-card img { width:100%; height:calc(100% - 30px); object-fit:cover; display:block; }
.style-card .label { padding:4px 6px; font-size:12px; text-align:center; background:#1a1a1a; color:#ccc; height:30px; line-height:22px; }
.style-card.selected .label { color:#4caf50; font-weight:bold; }
#aiStyleContainer { display:contents; }

/* Bookmarks */
.bookmark-bar { display:none; margin-top:10px; padding:8px 12px; background:#1a1a2e; border-radius:8px; border:1px solid #333; }
.bookmark-bar.show { display:block; }
.bm-title { font-size:12px; color:#888; margin-bottom:6px; }
.bookmark-list { display:flex; gap:6px; flex-wrap:wrap; }
.bookmark-tag {
    display:inline-flex; align-items:center; gap:4px;
    padding:4px 10px; background:#2a2a4a; border-radius:4px;
    cursor:pointer; font-size:13px; transition:background .2s; border:1px solid #444;
}
.bookmark-tag:hover { background:#3a3a6a; border-color:#4caf50; }
.bookmark-tag .time { color:#4caf50; font-weight:bold; }
.bookmark-tag .sty { color:#ccc; }
.bookmark-tag .del { color:#f44336; margin-left:4px; font-size:11px; cursor:pointer; }
.bookmark-tag .del:hover { color:#ff7961; }

/* Status bar */
.status-bar { margin-top:10px; padding:8px 12px; border-radius:6px; font-size:14px; display:none; }
.status-bar.show { display:block; }
.status-bar.ok { background:#1b5e20; color:#a5d6a7; }
.status-bar.err { background:#b71c1c; color:#ef9a9a; }
.status-bar.info { background:#1a237e; color:#90caf9; }

/* Params panel */
.params-panel { display:flex; align-items:center; gap:8px; margin-top:6px; padding:8px 14px; background:#1e1e2e; border-radius:8px; border:1px solid #333; }
.param-row { display:flex; align-items:center; gap:8px; width:100%; }
.param-row label { color:#aaa; font-size:13px; min-width:56px; }
#paramSlider { flex:1; height:4px; -webkit-appearance:none; appearance:none; background:#555; border-radius:2px; outline:none; cursor:pointer; max-width:200px; }
#paramSlider::-webkit-slider-thumb { -webkit-appearance:none; width:12px; height:12px; border-radius:50%; background:#4caf50; cursor:pointer; }
#paramSlider::-moz-range-thumb { width:12px; height:12px; border-radius:50%; background:#4caf50; cursor:pointer; border:none; }
.param-value { color:#4caf50; font-size:13px; min-width:28px; text-align:right; }
.param-hint { color:#666; font-size:11px; margin-left:auto; }

/* Huazi modal */
#huaziModal {
    display:none; position:fixed; top:0; left:0; width:100%; height:100%;
    background:rgba(0,0,0,0.6); z-index:1000;
    justify-content:center; align-items:center;
}
.modal-box { background:#222; border-radius:12px; padding:20px; width:340px; border:1px solid #444; }
.modal-title { font-size:16px; margin-bottom:12px; color:#e91e63; }
#huaziInput { width:100%; padding:10px; border:1px solid #555; border-radius:6px; background:#333; color:#fff; font-size:16px; outline:none; }
.modal-btns { margin-top:10px; display:flex; gap:8px; justify-content:flex-end; }

canvas { display:none; }

/* ====================== */
/* MOBILE RESPONSIVE      */
/* ====================== */
@media (max-width: 768px) {
  body { padding: 8px 6px; }
  .container { max-width: 100%; }

  /* Hero */
  .hero-section { margin-bottom: 14px; padding-top: 6px; }
  .hero-title { font-size: 22px; letter-spacing: 3px; }
  .hero-subtitle { font-size: 11px; letter-spacing: 1px; }

  /* Upload */
  .upload-area { padding: 3px 14px; margin-bottom: 10px; }
  .upload-icon { font-size: 24px; }
  .upload-text { font-size: 13px; }
  .upload-hint { font-size: 12px; }

  /* Player */
  .player-wrap { border-radius: 6px; }

  /* Control bar - wrap on mobile */
  .ctrl-bar {
    flex-wrap: wrap; padding: 12px 10px; gap: 8px;
    border-radius: 6px; margin-top: 12px;
  }

  #playBtn { font-size: 26px; padding: 4px 10px; min-width: 44px; min-height: 44px; }

  #seekBar { height: 6px; order: 10; width: 100%; flex: none; margin-top: 2px; }
  #seekBar::-webkit-slider-thumb { width: 22px; height: 22px; }
  #seekBar::-moz-range-thumb { width: 22px; height: 22px; }

  #timeDisplay {
    font-size: 12px; min-width: auto; order: 11;
    width: 100%; text-align: center;
  }

  /* Buttons: bigger touch targets */
  .ctrl-bar .btn {
    padding: 10px 14px; font-size: 14px; min-width: 48px; min-height: 44px;
    flex-shrink: 0;
  }

  /* Fade row: move below on mobile */
  .fade-row {
    margin: 8px 0; flex-shrink: 0;
    padding: 6px 0;
  }
  .fade-row label { font-size: 12px; }
  #fadeSlider { width: 100px; height: 8px; }
  #fadeSlider::-webkit-slider-thumb { width: 22px; height: 22px; }
  #fadeSlider::-moz-range-thumb { width: 22px; height: 22px; }
  #fadeLabel { font-size: 14px; min-width: 36px; }

  /* Style gallery: 2 columns on tablet, 1 on phone */
  .style-gallery { gap: 6px; margin-top: 10px; }
  .style-card { aspect-ratio: 16/9; }
  .style-card img { height: calc(100% - 28px); }
  .style-card .label { font-size: 11px; height: 28px; line-height: 20px; }

  /* Mobile: make gallery scrollable if needed */
  @media (max-width: 480px) {
    .style-gallery {
      grid-template-columns: 1fr;
      gap: 8px;
    }
    .style-card { aspect-ratio: 16/9; max-height: 220px; }
  }

  /* Bookmarks */
  .bookmark-bar { padding: 6px 10px; }
  .bookmark-list { gap: 4px; }
  .bookmark-tag { padding: 6px 10px; font-size: 13px; }
  .bookmark-tag .del { font-size: 13px; padding-left: 6px; }

  /* Status bar */
  .status-bar { font-size: 13px; padding: 8px 10px; }

  /* Params panel */
  .params-panel { padding: 6px 10px; }
  .param-row { gap: 6px; }
  .param-row label { font-size: 12px; min-width: 48px; }
  #paramSlider { max-width: none; height: 6px; }
  #paramSlider::-webkit-slider-thumb { width: 18px; height: 18px; }
  #paramSlider::-moz-range-thumb { width: 18px; height: 18px; }
  .param-value { font-size: 13px; min-width: 24px; }
  .param-hint { font-size: 10px; }
  #confirmParamBtn { padding: 8px 14px; min-height: 40px; }

  /* Modal */
  .modal-box { width: calc(100% - 24px); padding: 16px; }
  .modal-title { font-size: 15px; }
  #huaziInput { font-size: 16px; padding: 12px; }
  .modal-btns .btn { padding: 10px 20px; font-size: 14px; min-height: 44px; }
}

/* Very small screens */

@media (max-width: 600px) {
  /* Player: fill more space on mobile */
  .player-wrap {
    max-height: 55vh;
  }
  .player-wrap video {
    max-height: 55vh;
    object-fit: contain;
  }
}

@media (max-width: 360px) {
  .hero-title { font-size: 18px; }
  .ctrl-bar { padding: 6px 4px; gap: 4px; }
  .ctrl-bar .btn { padding: 8px 10px; font-size: 12px; min-width: 40px; }
}
