/* =====================================
   Scenelyx — tools/scenelyx/css/style.css
   Builds on base.css / layout.css / tool.css.
   Mirrors PixelForge's hero + workspace structure (sx-* namespace).
===================================== */

/* ============================================================
   Hero (self-contained sx-hero-*, same card pattern as PixelForge)
   ============================================================ */
.sx-hero-wrap { padding: 2rem 1.5rem 0.5rem; }
.sx-hero-card {
  position: relative; max-width: 1100px; margin: 0 auto;
  border-radius: 28px; overflow: hidden; background: #0d1424;
}
.sx-hero-card::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8,14,28,.82) 0%, rgba(8,14,28,.55) 42%, rgba(8,14,28,.10) 68%, rgba(8,14,28,0) 100%),
    linear-gradient(180deg, rgba(31,111,255,.10) 0%, rgba(31,111,255,0) 45%);
}
.sx-hero-media { position: relative; display: block; width: 100%; aspect-ratio: 2200 / 800; overflow: hidden; background: #11182b; }
.sx-hero-media picture { display: contents; }
.sx-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 42%; display: block; }
.sx-hero-badge {
  position: absolute; z-index: 2; top: 22px; left: 24px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: rgba(13,20,36,.55); border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #dbe4ff; font-size: .76rem; font-weight: 700; letter-spacing: .02em;
}
.sx-hero-badge svg { color: #7aa2ff; }
.sx-hero-copy {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 48px 55px; max-width: 640px;
}
.sx-hero-title {
  margin: 0 0 14px; color: #fff; font-weight: 800;
  letter-spacing: -0.02em; font-size: clamp(1.9rem, 3.2vw, 2.45rem); line-height: 1.2;
  word-break: keep-all; overflow-wrap: anywhere; text-shadow: 0 2px 14px rgba(0,0,0,.35);
}
.sx-hero-lead {
  margin: 0 0 24px; color: rgba(255,255,255,.92); line-height: 1.6;
  font-size: 0.98rem; max-width: 52ch; font-weight: 500; text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.sx-hero-cta {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px;
  border-radius: 999px; text-decoration: none; background: var(--gz-accent, #1f6fff);
  color: #fff; font-weight: 700; font-size: 0.95rem; box-shadow: 0 8px 22px rgba(31,111,255,.35);
  transition: transform .18s ease, opacity .18s ease;
}
.sx-hero-cta:hover { opacity: .94; transform: translateY(-1px); }
.sx-hero-arrow { transition: transform .18s ease; }
.sx-hero-cta:hover .sx-hero-arrow { transform: translateX(4px); }
@media (min-width: 641px) {
  html[lang="ja"] .sx-hero-title { font-size: clamp(1.8rem, 3vw, 2.25rem); }
}
@media (max-width: 640px) {
  .sx-hero-wrap { padding: 0 0 25px; }
  .sx-hero-card { border-radius: 22px; margin: 0 1.25rem; }
  .sx-hero-card::before { display: none; }
  .sx-hero-media { aspect-ratio: 1672 / 941; }
  .sx-hero-copy { position: static; inset: auto; justify-content: flex-start; align-items: stretch; padding: 24px 22px 30px; max-width: none; }
  .sx-hero-title { text-align: center; font-size: 1.7rem; margin-bottom: 10px; }
  .sx-hero-lead { text-align: center; margin-bottom: 18px; }
  .sx-hero-cta { width: 100%; justify-content: center; }
  .sx-hero-badge { top: 14px; left: 14px; }
}

/* ============================================================
   Workspace: LEFT = stage (the dropzone) · RIGHT = control panel
   ============================================================ */
.sx-workspace {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px; align-items: start;
}
.sx-workspace:has(.sx-panel[hidden]) { grid-template-columns: 1fr; }
@media (max-width: 960px) { .sx-workspace { grid-template-columns: 1fr; gap: 16px; } }

.sx-stage-area { align-self: start; }
@media (min-width: 961px) { .sx-stage-area { position: sticky; top: 16px; } }

.sx-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 440px; padding: 18px; background: #f4f5f7;
  border: 1.5px solid #e0e0e0; border-radius: 14px; overflow: hidden; cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sx-stage.is-dragover { border-color: #1f6fff; box-shadow: 0 0 0 3px rgba(31,111,255,.15); }
.sx-stage.has-img { cursor: default; }

.sx-drop-hint {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 30px; text-align: center; color: #9aa0a6;
}
.sx-drop-hint svg { opacity: .5; }
.sx-drop-hint span:first-of-type { color: #1f6fff; font-weight: 600; font-size: 15px; }
.sx-drop-sub { font-size: 12px; color: #9aa0a6; }

.sx-stage-card { position: relative; width: 100%; display: flex; justify-content: center; }
.sx-stage-card[hidden] { display: none; }
/* The preview is a tall 9:16 canvas — cap its height, keep its aspect. */
.sx-preview {
  display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto;
  border-radius: 10px; box-shadow: 0 4px 24px rgba(15,23,42,.14);
}

.sx-busy[hidden] { display: none; }
.sx-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.6rem; background: rgba(255,255,255,.6); color: #1f2937; font-size: 0.9rem; z-index: 5; border-radius: 10px; }
.sx-spinner { width: 20px; height: 20px; border: 3px solid rgba(31,111,255,.25); border-top-color: #1f6fff; border-radius: 50%; animation: sx-spin 0.8s linear infinite; }
@keyframes sx-spin { to { transform: rotate(360deg); } }

.sx-stage-meta { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.8rem; color: #6b7280; }
.sx-stage-meta[hidden] { display: none; }

/* ============================================================
   Control panel
   ============================================================ */
.sx-panel { display: flex; flex-direction: column; gap: 14px; }
.sx-panel[hidden] { display: none; }
.sx-card { border: 1px solid #e8e8e8; border-radius: 12px; background: #fff; padding: 16px; }
.sx-card[hidden] { display: none; }
.sx-card-title { font-size: 12px; font-weight: 700; color: #374151; margin: 0 0 12px; letter-spacing: .04em; text-transform: uppercase; }

/* segmented control */
.sx-seg { display: inline-flex; border: 1px solid #d7dbe0; border-radius: 10px; overflow: hidden; background: #f8fafc; }
.sx-seg-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 64px; padding: 0.5rem 0.85rem; border: none; border-right: 1px solid #e3e7ec;
  background: transparent; font-weight: 700; color: #374151; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease; line-height: 1.2;
}
.sx-seg-btn b { font-size: 0.9rem; }
.sx-seg-btn span { font-size: 0.68rem; font-weight: 600; opacity: .75; }
.sx-seg-btn:last-child { border-right: none; }
.sx-seg-btn:hover:not(.is-active) { background: #eef2ff; }
.sx-seg-btn.is-active { background: #1f6fff; color: #fff; }
.sx-seg--small .sx-seg-btn { flex-direction: row; min-width: 56px; padding: 0.4rem 0.8rem; font-size: 0.82rem; }

/* radio stack (background styles) */
.sx-radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.sx-radio { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border: 1px solid #d7dbe0; border-radius: 10px; cursor: pointer; }
.sx-radio input { accent-color: #1f6fff; flex-shrink: 0; }
.sx-radio-text { display: flex; flex-direction: column; line-height: 1.25; }
.sx-radio-title { font-size: 0.85rem; font-weight: 600; color: #1a1a2e; }
.sx-radio-desc { font-size: 0.72rem; color: #6b7280; }
.sx-radio:has(input:checked) { border-color: #1f6fff; background: rgba(31,111,255,.06); }
.sx-radio:has(input:checked) .sx-radio-desc { color: #4b6fb0; }

/* per-mode sub-controls */
.sx-subctl { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eceef1; display: flex; flex-direction: column; gap: 10px; }
.sx-subctl[hidden] { display: none; }

.sx-range-row { display: grid; grid-template-columns: minmax(96px, auto) 1fr; align-items: center; gap: 10px; font-size: 0.82rem; color: #4b5563; }
/* Custom-painted track: the fill position comes from a CSS variable that JS
   keeps in sync with the value. Native accent-color tinting desynced from the
   thumb in Safari after programmatic value changes. */
.sx-range-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px; margin: 8px 0;
  background: linear-gradient(to right,
    #1f6fff 0%, #1f6fff var(--fill, 50%),
    #e3e7ec var(--fill, 50%), #e3e7ec 100%);
  cursor: pointer;
}
.sx-range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1px solid #d0d5dd;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}
.sx-range-row input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1px solid #d0d5dd;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: pointer;
}
.sx-range-row input[type="range"]::-moz-range-track { background: transparent; }
.sx-range-row input[type="range"]:focus-visible { outline: 2px solid #1f6fff; outline-offset: 4px; }

/* colour swatches */
.sx-swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sx-swatch {
  width: 34px; height: 34px; border-radius: 10px; border: 2px solid #d7dbe0;
  cursor: pointer; padding: 0; transition: border-color .15s ease, transform .15s ease;
}
.sx-swatch:hover { transform: scale(1.06); }
.sx-swatch.is-active { border-color: #1f6fff; box-shadow: 0 0 0 2px rgba(31,111,255,.2); }
.sx-swatch--auto {
  width: auto; padding: 0 10px; font-size: 0.75rem; font-weight: 700; color: #374151;
  background: linear-gradient(135deg, #fde68a 0%, #a7f3d0 50%, #bfdbfe 100%);
}
.sx-custom-color { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #4b5563; cursor: pointer; }
.sx-custom-color input[type="color"] { width: 34px; height: 34px; padding: 2px; border: 1px solid #d7dbe0; border-radius: 10px; background: #fff; cursor: pointer; }

/* framing card footer + hints */
.sx-hint { font-size: 0.78rem; color: #6b7280; margin: 0; }
.sx-framing-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

/* checkbox */
.sx-chk { display: flex; align-items: flex-start; gap: 8px; font-size: 0.82rem; color: #374151; cursor: pointer; line-height: 1.45; }
.sx-chk input { width: 15px; height: 15px; accent-color: #1f6fff; cursor: pointer; flex-shrink: 0; margin-top: 2px; }

/* caption */
.sx-textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 0.9rem;
  border: 1.5px solid #e0e0e0; border-radius: 10px; background: #fafafa; color: #222;
  resize: vertical; outline: none; margin-bottom: 10px;
}
.sx-textarea:focus { border-color: #1f6fff; background: #fff; }
.sx-caption-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sx-card .sx-range-row { margin-bottom: 8px; }

/* export */
.sx-export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sx-export-btn {
  width: 100%; min-height: 40px; padding: 0 12px; border-radius: 10px;
  background: #f4f6f9; color: #374151; border: 1px solid #d7dbe0;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sx-export-btn:hover:not(:disabled) { background: #eaeefc; border-color: #1f6fff; color: #1f4fd0; }
.sx-export-btn:disabled { opacity: .45; cursor: default; }
.sx-export-btn--primary { grid-column: 1 / -1; background: #1f6fff !important; color: #fff !important; border-color: #1f6fff !important; box-shadow: 0 2px 8px rgba(31,111,255,.3); }
.sx-export-btn--primary:hover:not(:disabled) { background: #1558d4 !important; }

/* ============================================================
   Guide section (mirror PixelForge)
   ============================================================ */
.gz-guide-section { background: transparent; padding-bottom: 80px; }
@media (max-width: 640px) { .gz-guide-section { padding-bottom: 56px; } }
.gz-guide-inner { max-width: 800px; margin: 0 auto; padding: 0 24px; }
.gz-guide-body { margin-top: 40px; }
.gz-guide-subheading { font-size: 1.15rem; font-weight: 700; color: #1a1a2e; margin: 32px 0 14px; }
.gz-guide-subheading:first-child { margin-top: 0; }
.gz-guide-steps { padding-left: 24px; margin: 0 0 8px; }
.gz-guide-step { font-size: 1rem; line-height: 1.75; color: #374151; margin-bottom: 16px; padding-left: 8px; }
.gz-guide-text { font-size: 1rem; line-height: 1.8; color: #374151; margin: 0 0 16px; }
.gz-guide-img { width: 100%; max-width: 720px; height: auto; border-radius: 12px; margin: 16px 0 24px; display: block; }
@media (max-width: 640px) {
  .gz-guide-inner { padding: 0 16px; }
  .gz-guide-subheading { font-size: 1.05rem; }
  .gz-guide-steps { padding-left: 20px; }
}

/* ============================================================
   SP floating mini preview (fixed, NOT sticky — sticky jittered on
   iOS Safari's collapsing toolbar in past tools). Shows while the
   main preview is scrolled out of view so sliders give live feedback.
   ============================================================ */
.sx-mini {
  position: fixed; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 9000; display: none; padding: 0; border: none; background: transparent;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sx-mini canvas {
  display: block; width: 128px; height: auto; border-radius: 12px;
  border: 2px solid #fff; box-shadow: 0 6px 22px rgba(0,0,0,.38);
  background: #fff;
}
.sx-mini[hidden] { display: none !important; }
@media (max-width: 960px) {
  .sx-mini.is-visible { display: block; }
}

/* Toast */
.sx-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  background: #111827; color: #fff; padding: 0.6rem 1rem; border-radius: 10px;
  font-size: 0.85rem; box-shadow: 0 6px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; z-index: 9999;
}
.sx-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* This tool has its own drop handling — suppress the shared full-screen overlay. */
#gzDropOverlay { display: none !important; }

/* Hide the shared "Private by design" pill on this page only — it floats over
   the control panel / preview while scrolling (same call as PixelForge). */
body.gz-tool-scenelyx #tlPrivacyWrap { display: none !important; }

/* ============================================================
   SP: plain single-column scroll, consistent with the other tools.
   ============================================================ */
@media (max-width: 640px) {
  .sx-stage { min-height: 320px; }
  .sx-preview { max-height: 56vh; }
  .sx-textarea, .sx-custom-color input { font-size: 16px; }  /* no iOS focus zoom */
  #sxFileName { display: none; }
  .sx-stage-meta { justify-content: center; margin-top: 6px; }
}
