:root {
  --bg: #080c18;
  --surface: rgba(16, 23, 43, 0.76);
  --surface-strong: #111a31;
  --surface-deep: #090f20;
  --line: rgba(151, 170, 216, 0.14);
  --line-bright: rgba(151, 170, 216, 0.24);
  --text: #f1f5ff;
  --muted: #8f9ab5;
  --subtle: #60708e;
  --indigo: #7887ff;
  --violet: #b276ff;
  --pink: #f56cac;
  --mint: #56d6b1;
  --amber: #ffb55f;
  --radius: 19px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); overflow-x: hidden; }
button, input, textarea { font: inherit; }
button { border: 0; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

.ambient { position: fixed; border-radius: 999px; filter: blur(3px); pointer-events: none; z-index: -1; opacity: .48; }
.ambient-a { width: 560px; height: 560px; background: radial-gradient(circle, rgba(79, 61, 189, .18), transparent 68%); top: -300px; left: -180px; }
.ambient-b { width: 600px; height: 600px; background: radial-gradient(circle, rgba(38, 128, 142, .11), transparent 67%); right: -340px; top: 40%; }

.topbar { position: sticky; z-index: 10; top: 0; border-bottom: 1px solid var(--line); background: rgba(8, 12, 24, .78); backdrop-filter: blur(18px); }
.topbar__inner { max-width: 1440px; min-height: 76px; margin: 0 auto; padding: 12px 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: max-content; }
.brand__mark { width: 39px; height: 39px; display: grid; place-items: center; position: relative; border-radius: 13px 13px 13px 5px; background: linear-gradient(135deg, #8c86ff 0%, #7a50e8 55%, #cf72e4 100%); box-shadow: 0 10px 28px rgba(107, 87, 236, .35); transform: rotate(-5deg); }
.brand__mark::after { content: ""; position: absolute; inset: 1px; border-radius: inherit; border: 1px solid rgba(255,255,255,.34); }
.brand__mark span { position: relative; z-index: 1; color: white; font-size: 18px; transform: rotate(5deg); }
.brand__copy { display: grid; gap: 2px; }
.brand__copy strong { letter-spacing: .02em; font-size: 15px; }
.brand__copy small { color: var(--subtle); font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.topbar__actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: #060a14; border: 1px solid var(--line); border-radius: 11px; }
.segment { min-height: 32px; border-radius: 8px; padding: 0 11px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: .2s ease; display: inline-flex; align-items: center; gap: 7px; }
.segment__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.segment:hover { color: #dbe2f8; }
.segment.is-active { background: linear-gradient(100deg, #596ce9, #8866ed); color: white; box-shadow: 0 5px 14px rgba(79, 73, 193, .35); }
.segment.is-active .segment__dot { opacity: 1; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }

.button { min-height: 36px; padding: 0 14px; border-radius: 10px; color: var(--text); font-size: 12px; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0) scale(.98); }
.button--quiet { background: rgba(32, 42, 68, .65); border: 1px solid var(--line); color: #cad4ed; }
.button--quiet:hover { border-color: var(--line-bright); background: rgba(42, 55, 87, .7); }
.button--primary { border: 1px solid rgba(190, 167, 255, .3); background: linear-gradient(100deg, #586be9 0%, #8964e9 52%, #b26aed 100%); box-shadow: 0 8px 20px rgba(105, 78, 220, .27); }
.button--primary:hover { box-shadow: 0 11px 25px rgba(105, 78, 220, .43); }
.button--secondary { border: 1px solid rgba(86, 214, 177, .3); background: rgba(49, 128, 111, .22); color: #a7f0da; }
.button--secondary:hover { border-color: rgba(86, 214, 177, .62); background: rgba(49, 128, 111, .35); box-shadow: 0 8px 20px rgba(46, 170, 139, .18); }
.button--chatgpt { border: 1px solid rgba(116, 229, 194, .38); background: linear-gradient(100deg, rgba(17, 128, 111, .92), rgba(65, 175, 149, .86)); color: #fff; box-shadow: 0 8px 20px rgba(43, 173, 143, .22); }
.button--chatgpt:hover { border-color: rgba(200, 255, 236, .7); box-shadow: 0 11px 25px rgba(43, 173, 143, .35); }
.button--chatgpt:disabled { cursor: wait; opacity: .65; transform: none; }

.workspace { max-width: 1440px; margin: 0 auto; padding: 37px 30px 55px; }
.intro { min-height: 106px; display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.eyebrow, .panel__index { margin: 0; color: var(--subtle); letter-spacing: .12em; font-size: 10px; font-weight: 800; }
.eyebrow { color: #9d9bee; display: flex; align-items: center; gap: 8px; }
.eyebrow span { display: inline-block; width: 16px; height: 1px; background: linear-gradient(90deg, var(--indigo), var(--pink)); }
h1 { margin: 10px 0 8px; max-width: 700px; font-size: clamp(26px, 3vw, 37px); line-height: 1.13; letter-spacing: -.045em; font-weight: 780; background: linear-gradient(94deg, #fff, #cdd5ff 55%, #a6b4d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro__description { margin: 0; font-size: 13px; color: var(--muted); }
.intro__status { padding-top: 9px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.intro__status span { border: 1px solid var(--line); border-radius: 100px; background: rgba(15, 22, 42, .52); padding: 7px 10px; color: #acb7d0; font-size: 10px; white-space: nowrap; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 9px var(--mint); }
.status-dot--pink { background: var(--pink); box-shadow: 0 0 9px var(--pink); }

.input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.panel, .trigger-panel, .output-panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 40px rgba(0,0,0,.16); backdrop-filter: blur(14px); }
.panel { min-height: 430px; padding: 20px; position: relative; overflow: hidden; border-radius: var(--radius); display: flex; flex-direction: column; gap: 15px; }
.panel::before { content: ""; position: absolute; top: 0; left: 19px; width: 52px; height: 2px; background: var(--indigo); box-shadow: 0 0 16px var(--indigo); }
.panel--b::before { background: var(--mint); box-shadow: 0 0 16px var(--mint); }
.panel--c::before { background: var(--violet); box-shadow: 0 0 16px var(--violet); }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel__head h2, .trigger-panel h2, .output-panel h2 { margin: 5px 0 4px; color: #e8edfd; font-size: 15px; letter-spacing: -.02em; }
.panel__head p:not(.panel__index) { margin: 0; color: var(--subtle); font-size: 11px; }
.icon-button { width: 28px; height: 28px; border-radius: 8px; color: #9da9c5; background: rgba(37, 49, 78, .48); cursor: pointer; transition: .18s ease; }
.icon-button:hover { color: #ffd6dd; background: rgba(179, 67, 88, .17); }
.subtabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: #090e1c; }
.subtab { border-radius: 7px; min-height: 27px; padding: 0 4px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; transition: .18s ease; white-space: nowrap; }
.subtab:hover { color: #dce4fb; }
.subtab.is-active { color: white; background: linear-gradient(110deg, #596fe8, #8467e7); box-shadow: 0 4px 10px rgba(83, 76, 196, .32); }
.field { display: grid; gap: 7px; }
.field--grow { flex: 1; min-height: 0; }
.field label { color: #a9b5cd; font-size: 11px; font-weight: 650; }
.field label span { margin-left: 5px; color: #9e98ff; font-size: 9px; font-weight: 700; }
input, textarea { width: 100%; color: #dbe4fb; border: 1px solid rgba(126, 146, 193, .17); background: rgba(5, 9, 19, .68); border-radius: 10px; transition: border-color .18s ease, box-shadow .18s ease; }
input { min-height: 36px; padding: 0 11px; font-size: 12px; }
textarea { height: 100%; min-height: 126px; padding: 11px; resize: vertical; font-size: 12px; line-height: 1.7; }
textarea:focus, input:focus { border-color: rgba(118, 134, 255, .78); box-shadow: 0 0 0 3px rgba(103, 117, 255, .1); outline: none; }
.panel--b textarea:focus { border-color: rgba(73, 209, 169, .7); box-shadow: 0 0 0 3px rgba(73, 209, 169, .09); }
.panel--c textarea:focus { border-color: rgba(183, 106, 239, .7); box-shadow: 0 0 0 3px rgba(183, 106, 239, .09); }
::placeholder { color: #50607d; opacity: 1; }
.panel__hint { min-height: 16px; margin: 0; color: #64728d; font-size: 10px; line-height: 1.45; }
.panel__hint span { color: #9e98ff; font-weight: 900; }
.rule-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #79d7bf; font-size: 10px; font-weight: 700; }
.rule-strip i { width: 3px; height: 3px; border-radius: 50%; background: #5e7890; }
.mode-c-preview { display: flex; gap: 5px; }
.mode-c-preview span { flex: 1; padding: 6px 2px; border-radius: 7px; border: 1px solid rgba(180, 118, 236, .18); background: rgba(133, 73, 191, .09); color: #bd98e8; text-align: center; font-size: 9px; letter-spacing: .18em; font-weight: 800; }

.trigger-panel { border-color: rgba(236, 104, 173, .2); margin-top: 15px; padding: 19px 20px 18px; border-radius: var(--radius); }
.trigger-panel__head, .output-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.trigger-panel h2 { margin-bottom: 0; }
.trigger-panel h2 span { margin-left: 6px; padding: 3px 6px; border: 1px solid rgba(92, 214, 179, .25); border-radius: 5px; background: rgba(76, 182, 149, .09); color: #69e0be; font-size: 9px; vertical-align: 2px; letter-spacing: 0; }
.trigger-panel__tools { display: flex; align-items: center; gap: 16px; padding-top: 2px; }
.trigger-panel__tools p { margin: 0; color: var(--subtle); font-size: 10px; }
code { font-family: "SFMono-Regular", Consolas, monospace; color: #f1a6ca; font-size: .95em; }
.text-button { padding: 0; background: transparent; color: #aa93b3; font-size: 10px; cursor: pointer; white-space: nowrap; }
.text-button:hover { color: #ff9fcb; }
.trigger-panel__body { display: grid; gap: 11px; margin-top: 15px; }
.trigger-input-wrap { position: relative; }
.trigger-input-wrap > span { position: absolute; left: 12px; top: 8px; color: #ea74ae; font-size: 17px; font-weight: 600; }
.trigger-input-wrap input { padding-left: 31px; border-color: rgba(230, 103, 169, .17); }
.trigger-input-wrap input:focus { border-color: rgba(233, 100, 170, .7); box-shadow: 0 0 0 3px rgba(233, 100, 170, .08); }
.tag-list { min-height: 25px; display: flex; flex-wrap: wrap; gap: 6px; }
.trigger-tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid rgba(242, 109, 177, .19); border-radius: 7px; background: rgba(196, 67, 133, .08); color: #f2afd0; font-size: 10px; font-weight: 650; animation: tag-in .22s ease both; }
.trigger-tag::before { content: "#"; color: #e771aa; font-weight: 800; }
@keyframes tag-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.output-panel { margin-top: 15px; padding: 23px; border-radius: 22px; background: linear-gradient(150deg, rgba(20, 29, 54, .86), rgba(11, 17, 34, .85)); }
.output-title { display: flex; align-items: center; gap: 12px; }
.output-title__icon { flex: 0 0 auto; width: 37px; height: 37px; display: grid; place-items: center; color: #fff4dc; border-radius: 11px 11px 11px 4px; background: linear-gradient(135deg, #f6a952, #f07051); box-shadow: 0 8px 20px rgba(231, 121, 57, .22); font-size: 17px; }
.output-title h2 { margin-top: 3px; }
.output-title p:not(.panel__index) { margin: 0; color: var(--subtle); font-size: 11px; }
.button--copy { border: 1px solid rgba(255, 198, 118, .3); background: linear-gradient(100deg, #ed9d48, #ee794a); box-shadow: 0 8px 19px rgba(216, 113, 43, .2); }
.button--copy:hover { box-shadow: 0 11px 23px rgba(216, 113, 43, .35); }
.output-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 13px; margin: 20px 0 13px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 9, 19, .53); }
.check-group { display: flex; align-items: center; gap: 15px; }
.check-control, .html-control { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.check-control { gap: 4px; color: var(--muted); font-size: 10px; }
.check-control input, .html-control input { position: absolute; opacity: 0; pointer-events: none; }
.check-control > span { width: 15px; height: 15px; display: grid; place-items: center; border: 1px solid #41506f; border-radius: 4px; font-size: 0; transition: .17s ease; }
.check-control > span::after { content: "✓"; color: white; font-size: 10px; transform: scale(0); transition: .14s ease; }
.check-control small { font-size: 10px; color: inherit; }
.check-control--a input:checked + span { border-color: var(--indigo); background: var(--indigo); }
.check-control--b input:checked + span { border-color: #46bfa1; background: #46bfa1; }
.check-control--c input:checked + span { border-color: var(--violet); background: var(--violet); }
.check-control--d input:checked + span { border-color: var(--amber); background: var(--amber); }
.check-control input:checked + span::after { transform: scale(1); }
.check-control input:checked ~ small { color: #dce4f9; font-weight: 700; }
.html-control { gap: 7px; color: #e79ac0; font-size: 10px; font-weight: 700; }
.html-control__switch { width: 28px; height: 16px; padding: 2px; border: 1px solid rgba(235, 104, 173, .33); border-radius: 99px; background: rgba(195, 77, 137, .12); transition: .2s ease; }
.html-control__switch::after { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: #c96c9c; transition: transform .2s ease, background .2s ease; }
.html-control input:checked + .html-control__switch { background: #d75c9c; }
.html-control input:checked + .html-control__switch::after { transform: translateX(12px); background: white; }
.output-editor { border: 1px solid rgba(134, 153, 197, .16); border-radius: 13px; overflow: hidden; background: #070c18; }
.output-editor__topline { height: 33px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(134, 153, 197, .12); color: #657492; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; letter-spacing: .12em; }
.output-editor__topline span:last-child { color: #63718d; letter-spacing: .03em; }
#mergedOutput { display: block; min-height: 278px; height: 34vh; max-height: 510px; border: 0; border-radius: 0; background: radial-gradient(circle at 0 0, rgba(69, 91, 157, .08), transparent 32%), #070c18; color: #d9e2fb; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.85; }
#mergedOutput:focus { box-shadow: none; }
.output-panel__footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; color: #7e8ba6; font-size: 10px; }
.output-panel__footer span:last-child { color: #52627e; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 25px; max-width: min(410px, calc(100vw - 36px)); padding: 10px 14px; border: 1px solid rgba(121, 142, 255, .35); border-radius: 10px; background: rgba(18, 27, 51, .94); box-shadow: 0 18px 44px rgba(0,0,0,.4); color: #edf2ff; font-size: 12px; text-align: center; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(239, 108, 141, .45); color: #ffdce6; }

@media (max-width: 1100px) { .input-grid { grid-template-columns: 1fr 1fr; } .panel--c { grid-column: span 2; min-height: 375px; } }
@media (max-width: 820px) { .topbar__inner { padding: 12px 18px; } .workspace { padding: 28px 18px 44px; } .topbar__inner, .intro { align-items: flex-start; flex-direction: column; } .topbar__actions { width: 100%; justify-content: flex-start; } .intro { margin-bottom: 20px; } .intro__status { padding-top: 0; justify-content: flex-start; } .trigger-panel__head, .output-panel__head { align-items: flex-start; flex-direction: column; } .trigger-panel__tools { width: 100%; justify-content: space-between; } .button--copy { align-self: stretch; } }
@media (max-width: 620px) { .topbar__inner { gap: 11px; } .topbar__actions { gap: 7px; } .segmented { order: -1; width: 100%; } .segment { flex: 1; justify-content: center; } .button { padding: 0 11px; } .input-grid { grid-template-columns: 1fr; } .panel, .panel--c { grid-column: auto; min-height: 390px; } .intro__status { display: grid; grid-template-columns: 1fr; width: 100%; } .intro__status span { white-space: normal; } .trigger-panel, .output-panel, .panel { padding: 16px; } .trigger-panel__tools { align-items: flex-start; flex-direction: column; gap: 9px; } .output-controls { align-items: flex-start; flex-direction: column; } .check-group { width: 100%; justify-content: space-between; gap: 0; } .output-panel__footer { align-items: flex-start; flex-direction: column; } h1 { font-size: 28px; } }
@media (max-width: 390px) { .brand__copy strong { font-size: 13px; } .check-control small { display: none; } }
