.sg-dialog { width: min(960px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: 0 24px 80px #0006; overflow: hidden; font: 14px/1.5 "Segoe UI", "Microsoft JhengHei", sans-serif; }
.sg-dialog[open] { display: flex; flex-direction: column; }
.sg-dialog::backdrop { background: #08060ecc; }
.sg-dialog *, .sg-dialog *::before, .sg-dialog *::after { box-sizing: border-box; }
.sg-dialog button, .sg-dialog input, .sg-dialog textarea { font: inherit; }
.sg-dialog button { cursor: pointer; color: var(--text); }
.sg-dialog button:disabled { cursor: default; opacity: .42; }
.sg-dialog button:focus-visible, .sg-dialog input:focus-visible, .sg-dialog textarea:focus-visible, .sg-genres:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.sg-dialog h2, .sg-dialog h3, .sg-dialog p { margin: 0; }
.sg-dialog h2 { font-size: 19px; font-weight: 650; }
.sg-dialog h3 { font-size: 14px; }
.sg-muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.sg-head { flex: none; display: flex; gap: 16px; justify-content: space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--line-soft); }
.sg-head p { margin-top: 5px; }
.sg-dialog .sg-close { flex: none; width: 32px; height: 32px; padding: 0; font-size: 23px; line-height: 1; }
.sg-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 24px 8px; scrollbar-gutter: stable; }
.sg-project { overflow-wrap: anywhere; }
.sg-stage { display: grid; grid-template-columns: minmax(140px, 190px) minmax(180px, 1fr) minmax(140px, 190px); gap: 18px; align-items: center; padding: 18px 0 24px; }
.sg-genre-column { min-width: 0; }
.sg-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 8px; }
.sg-list-head h3 { font-size: 12px; color: var(--muted); font-weight: 500; }
.sg-list-head > .sg-muted { font-size: 10px; }
.sg-clear { padding: 2px 6px; border: 0; background: transparent; color: var(--brand-text); font-size: 11px !important; }
.sg-genres { display: grid; align-content: start; gap: 6px; height: 264px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; scrollbar-gutter: stable; border: 1px solid transparent; border-radius: 10px; }
.sg-choosing-secondary .sg-genres { border-color: var(--brand-line); background: var(--panel-2); }
.sg-genre { display: flex; gap: 10px; align-items: center; width: 100%; min-height: 46px; padding: 7px 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); text-align: left; }
.sg-genre:hover { background: var(--panel-2); border-color: var(--line); }
.sg-genre[aria-pressed="true"] { background: var(--panel-sel); border-color: var(--brand-line); color: var(--brand-text); }
.sg-genre-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 8px; font-size: 14px; color: var(--brand-text); background: linear-gradient(135deg, var(--panel-sel), var(--panel)); border: 1px solid var(--line); }
.sg-visual { min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; }
.sg-art { --sg-sphere: 162px; width: min(306px, 100%); height: 220px; position: relative; isolation: isolate; }
.sg-art::before { content: ""; position: absolute; inset: 14% 0; border-radius: 50%; background: radial-gradient(ellipse, var(--brand-soft), transparent 69%); z-index: -1; }
.sg-art-sphere { position: absolute; top: 50%; left: 43%; width: var(--sg-sphere); height: var(--sg-sphere); display: grid; place-items: center; border-radius: 50%; transform: translate(-50%, -50%); border: 1px solid var(--brand-text); background: radial-gradient(circle at 29% 22%, var(--brand-text) 0, transparent 26%), radial-gradient(circle at 70% 76%, var(--brand-soft), transparent 64%), linear-gradient(145deg, var(--panel-sel), var(--panel)); box-shadow: inset 0 0 24px var(--brand-soft), inset -12px -16px 30px #0004, 0 0 30px var(--brand-soft); overflow: hidden; }
.sg-art-sphere::after { content: ""; position: absolute; width: 150%; height: 90%; top: 42%; left: -26%; border: 1px solid var(--brand-text); border-radius: 50%; transform: rotate(-31deg); opacity: .4; }
.sg-art-glyph { color: var(--text); font-size: 48px; font-family: "Microsoft JhengHei", serif; font-weight: 500; text-shadow: 0 2px 18px var(--panel); z-index: 1; }
.sg-art-sphere-secondary { left: 70%; top: 42%; display: none; background: radial-gradient(circle at 31% 19%, var(--gold), transparent 27%), radial-gradient(circle at 64% 78%, var(--brand-soft), transparent 62%), linear-gradient(145deg, var(--panel-sel), var(--panel)); }
.sg-art-blended .sg-art-sphere-primary { left: 32%; top: 56%; }
.sg-art-blended .sg-art-sphere-secondary { display: grid; }
.sg-fusion-add { position: absolute; top: 51%; left: 62%; width: 74px; height: 74px; padding: 7px; border: 1px dashed var(--brand-text); border-radius: 50%; background: var(--panel-sel); color: var(--brand-text) !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 4px 16px #0002; }
.sg-fusion-add > span { font-size: 26px; line-height: 1; }
.sg-fusion-add > small { font-size: 10px; }
.sg-fusion-add:hover, .sg-fusion-add[aria-expanded="true"] { border-style: solid; background: var(--panel-2); }
.sg-fusion-remove { position: absolute; top: 5%; right: 3%; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--brand-text); border-radius: 50%; background: var(--panel-sel); color: var(--text); font-size: 21px !important; line-height: 1; }
.sg-genre-title { max-width: 100%; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.sg-visual > .sg-muted { max-width: 290px; min-height: 38px; }
.sg-extra-tools { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.sg-dialog .sg-reference-button { min-height: 30px; height: 30px; font-size: 12px; background: transparent; }
.sg-parameters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.sg-parameter { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 12px; min-height: 76px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); text-align: left; }
.sg-parameter:hover, .sg-parameter[aria-expanded="true"] { border-color: var(--brand-line); background: var(--panel-sel); }
.sg-parameter > span { font-size: 12px; color: var(--muted); }
.sg-parameter > b { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.sg-options-panel { margin-top: 12px; padding: 16px; border: 1px solid var(--brand-line); border-radius: 12px; background: var(--panel-2); }
.sg-options-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sg-dialog .sg-options-close { font-size: 12px; height: 28px; padding: 0 8px; }
.sg-option-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sg-option { min-height: 36px; padding: 6px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.sg-option:hover { border-color: var(--line-2); }
.sg-option[aria-pressed="true"] { border-color: var(--brand); background: var(--panel-sel); color: var(--brand-text); }
.sg-episodes { display: flex; align-items: center; gap: 12px; margin: 10px 0 18px; }
.sg-episodes input[type="range"] { flex: 1; min-width: 50px; accent-color: var(--brand); }
.sg-episodes input[type="number"] { width: 68px; min-width: 0; height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
.sg-episodes input[aria-invalid="true"] { border-color: var(--brand-text); outline: 2px solid var(--brand-text); }
.sg-asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.sg-asset { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.sg-asset:hover, .sg-asset[aria-pressed="true"] { border-color: var(--brand); background: var(--panel-sel); }
.sg-asset > img, .sg-asset-placeholder { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 5px; background: var(--panel-2); }
.sg-asset-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 26px; }
.sg-asset > span:last-child { font-size: 12px; overflow-wrap: anywhere; }
.sg-empty { padding: 18px 0 4px; color: var(--muted); font-size: 13px; }
.sg-detail-toggle { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; cursor: pointer; }
.sg-detail-toggle input { accent-color: var(--brand); }
.sg-story-field { display: grid; gap: 7px; margin-top: 15px; font-size: 12px; color: var(--muted); }
.sg-story-field > span { display: flex; align-items: center; gap: 8px; }
.sg-story-field small { font-size: 10px; }
.sg-story-notes { width: 100%; min-width: 0; min-height: 66px; max-height: 180px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; color: var(--text); background: var(--panel-2); font-size: 13px !important; line-height: 1.5; }
.sg-summary { margin-top: 8px; padding: 12px; border-radius: var(--radius); background: var(--panel-2); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.sg-summary p + p { margin-top: 4px; }
.sg-status { color: var(--brand-text); font-size: 12px; min-height: 20px; padding-top: 6px; }
.sg-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 24px; border-top: 1px solid var(--line-soft); background: var(--panel); }
.sg-actions { display: flex; flex: none; gap: 8px; }
.sg-dialog .s-btn { min-height: 36px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); padding: 0 14px; color: var(--text); }
.sg-dialog .s-btn:hover { border-color: var(--line-2); background: var(--panel-sel); }
.sg-dialog .s-btn.primary { background: var(--brand); border-color: var(--brand); color: white; }
.sg-dialog .s-btn.primary:hover { background: var(--brand-hi); }
.sg-dialog [hidden] { display: none !important; }
@media (max-width: 720px) {
  .sg-stage { grid-template-columns: minmax(100px, 1fr) minmax(110px, 1.1fr) minmax(100px, 1fr); gap: 8px; padding: 14px 0 20px; }
  .sg-genre { padding: 6px; font-size: 12px; gap: 6px; }
  .sg-genre-icon { flex-basis: 24px; width: 24px; height: 26px; font-size: 12px; }
  .sg-parameters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sg-art { --sg-sphere: 112px; height: 180px; }
  .sg-art-glyph { font-size: 36px; }
  .sg-fusion-add { width: 62px; height: 62px; left: 60%; }
  .sg-fusion-remove { top: 6%; right: 0; }
  .sg-genre-title { font-size: 16px; }
  .sg-genres { height: 250px; }
}
@media (max-width: 480px) {
  .sg-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 12px; }
  .sg-head { padding: 16px 14px 12px; gap: 8px; }
  .sg-head h2 { font-size: 18px; }
  .sg-head p { font-size: 11px; }
  .sg-body { padding: 12px 12px 6px; scrollbar-gutter: auto; }
  .sg-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 8px; }
  .sg-visual { grid-column: 1 / -1; grid-row: 1; gap: 3px; }
  .sg-art { --sg-sphere: 126px; width: min(260px, 100%); height: 156px; }
  .sg-art-glyph { font-size: 37px; }
  .sg-fusion-add { top: 50%; left: 62%; }
  .sg-fusion-remove { top: 0; right: 2%; }
  .sg-genre-title { font-size: 17px; }
  .sg-visual > .sg-muted { font-size: 11px; }
  .sg-genres { height: 181px; gap: 5px; padding: 2px; scrollbar-gutter: auto; }
  .sg-list-head { padding: 0 4px 6px; }
  .sg-genre { min-height: 40px; font-size: 12px; }
  .sg-parameter { padding: 9px; min-height: 67px; gap: 3px; }
  .sg-parameter > span { font-size: 11px; }
  .sg-parameter > b { font-size: 12px; }
  .sg-parameters { gap: 6px; }
  .sg-options-panel { padding: 12px; }
  .sg-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-episodes { flex-wrap: wrap; gap: 8px; }
  .sg-episodes input[type="range"] { flex-basis: calc(100% - 90px); }
  .sg-foot { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .sg-foot > .sg-muted { width: 100%; font-size: 11px; }
  .sg-actions { width: 100%; justify-content: flex-end; }
  .sg-dialog .sg-actions .s-btn { min-height: 38px; }
}
