:root{
    --bg0:#07080b;
    --bg1:#0b0e14;
    --panel:#0d1220cc;
    --line:#1e2a40;
    --text:#c9d3e6;
    --muted:#7f90ad;
    --cyan:#44f2ff;
    --mag:#ff3bd6;
    --amber:#ffcf66;
    --danger:#ff5b6e;
    --ok:#6dff95;
    --shadow: 0 0 18px rgba(68,242,255,.18), 0 0 40px rgba(255,59,214,.12);
    --shadow-hard: 0 0 26px rgba(68,242,255,.28), 0 0 60px rgba(255,59,214,.20);
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
    margin:0;
    color:var(--text);
    font-family:var(--sans);
    background:
    radial-gradient(1200px 600px at 15% 10%, rgba(68,242,255,.14), transparent 55%),
    radial-gradient(900px 500px at 88% 22%, rgba(255,59,214,.10), transparent 60%),
    radial-gradient(1200px 900px at 60% 90%, rgba(255,207,102,.06), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
    overflow:hidden;
}

/* faint rain scanlines vibe */
.scanlines::before{
    content:"";
    position:fixed; inset:0;
    pointer-events:none;
    background:
    repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,.04),
        rgba(255,255,255,.04) 1px,
        rgba(0,0,0,0) 3px,
        rgba(0,0,0,0) 6px
    );
    mix-blend-mode:overlay;
    opacity:.08;
}

.wrap{
    height:100%;
    display:flex;
    flex-direction:column;
}

header{
    padding:16px 18px 10px;
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:12px;
    border-bottom:1px solid rgba(30,42,64,.7);
    background: linear-gradient(180deg, rgba(13,18,32,.75), rgba(13,18,32,.15));
    box-shadow: 0 10px 50px rgba(0,0,0,.45);
    backdrop-filter: blur(8px);
}

.brand{
    display:flex;
    flex-direction:column;
    gap:2px;
}

.titleRow{
    display:flex;
    align-items:baseline;
    gap:10px;
}

.title{
    font-family:var(--mono);
    letter-spacing:.14em;
    font-size:14px;
    text-transform:uppercase;
    color:rgba(201,211,230,.9);
    text-shadow: 0 0 12px rgba(68,242,255,.12);
}
.kata{
    font-family:var(--mono);
    font-size:12px;
    color:rgba(68,242,255,.75);
    letter-spacing:.12em;
    text-shadow: var(--shadow);
    opacity:.95;
}
.subtitle{
    font-size:12px;
    color:var(--muted);
}

.pill{
    display:flex;
    align-items:center;
    gap:10px;
    padding:8px 10px;
    border:1px solid rgba(68,242,255,.18);
    border-radius:999px;
    background: rgba(7,8,11,.35);
    box-shadow: var(--shadow);
    font-family:var(--mono);
    font-size:12px;
    color:rgba(201,211,230,.85);
    user-select:none;
    white-space:nowrap;
}
.dot{
    width:8px; height:8px; border-radius:99px;
    background: radial-gradient(circle at 30% 30%, rgba(109,255,149,.95), rgba(109,255,149,.25));
    box-shadow: 0 0 12px rgba(109,255,149,.35);
}

main{
    flex:1;
    min-height:0;
    display:grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap:14px;
    padding:14px 14px 18px;
}

@media (max-width: 980px){
    body{ overflow:auto; }
    main{ grid-template-columns:1fr; }
}

.panel{
    border:1px solid rgba(30,42,64,.8);
    border-radius:14px;
    background: linear-gradient(180deg, rgba(13,18,32,.78), rgba(13,18,32,.50));
    box-shadow: 0 20px 70px rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    position:relative;
    overflow:hidden;
}

.panel::before{
    content:"";
    position:absolute; inset:-2px;
    background:
    radial-gradient(420px 220px at 12% 12%, rgba(68,242,255,.18), transparent 60%),
    radial-gradient(420px 220px at 88% 18%, rgba(255,59,214,.12), transparent 60%),
    radial-gradient(520px 320px at 40% 110%, rgba(255,207,102,.08), transparent 60%);
    opacity:.8;
    pointer-events:none;
}

.panelHeader{
    position:relative;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:12px 12px 10px;
    border-bottom:1px solid rgba(30,42,64,.6);
    background: rgba(7,8,11,.25);
}

.panelHeader h2{
    margin:0;
    font-family:var(--mono);
    font-size:12px;
    letter-spacing:.18em;
    text-transform:uppercase;
    color:rgba(201,211,230,.9);
}

.actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

button{
    appearance:none;
    border:1px solid rgba(68,242,255,.20);
    background: linear-gradient(180deg, rgba(7,8,11,.35), rgba(7,8,11,.12));
    color:rgba(201,211,230,.92);
    font-family:var(--mono);
    font-size:12px;
    padding:8px 10px;
    border-radius:10px;
    cursor:pointer;
    box-shadow: var(--shadow);
    transition: transform .08s ease, box-shadow .18s ease, border-color .18s ease;
}
button:hover{
    border-color: rgba(68,242,255,.35);
    box-shadow: var(--shadow-hard);
    transform: translateY(-1px);
}
button:active{ transform: translateY(0px); }

button.secondary{
    border-color: rgba(255,59,214,.20);
    box-shadow: 0 0 18px rgba(255,59,214,.12), 0 0 40px rgba(68,242,255,.10);
}
button.secondary:hover{
    border-color: rgba(255,59,214,.35);
    box-shadow: 0 0 26px rgba(255,59,214,.18), 0 0 60px rgba(68,242,255,.14);
}

button.ghost{
    border-color: rgba(30,42,64,.9);
    box-shadow:none;
    background: rgba(7,8,11,.20);
}
button.ghost:hover{
    border-color: rgba(68,242,255,.25);
    box-shadow: var(--shadow);
}

.panelBody{
    position:relative;
    padding:12px;
    height:calc(100% - 48px);
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:10px;
}

textarea{
    flex:1;
    min-height:0;
    resize:none;
    width:100%;
    border-radius:12px;
    border:1px solid rgba(30,42,64,.85);
    background: rgba(7,8,11,.35);
    color:rgba(201,211,230,.94);
    padding:12px 12px;
    outline:none;
    font-family:var(--mono);
    font-size:13px;
    line-height:1.45;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.2), 0 0 0 rgba(0,0,0,0);
    transition: border-color .2s ease, box-shadow .2s ease;
}
textarea:focus{
    border-color: rgba(68,242,255,.35);
    box-shadow: 0 0 0 2px rgba(68,242,255,.10), 0 0 28px rgba(68,242,255,.14);
}

.hint{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    color:var(--muted);
    font-size:12px;
    line-height:1.35;
}
.hint code{
    font-family:var(--mono);
    color:rgba(68,242,255,.78);
    background: rgba(68,242,255,.08);
    border:1px solid rgba(68,242,255,.12);
    padding:1px 6px;
    border-radius:999px;
    box-shadow: 0 0 12px rgba(68,242,255,.08);
    white-space:nowrap;
}

.status{
    display:flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius:12px;
    border:1px solid rgba(30,42,64,.85);
    background: rgba(7,8,11,.25);
    font-family:var(--mono);
    font-size:12px;
}
.status .led{
    width:10px; height:10px; border-radius:99px;
    background: radial-gradient(circle at 30% 30%, rgba(255,207,102,.95), rgba(255,207,102,.22));
    box-shadow: 0 0 14px rgba(255,207,102,.25);
    flex:0 0 auto;
}
.status.ok .led{
    background: radial-gradient(circle at 30% 30%, rgba(109,255,149,.95), rgba(109,255,149,.22));
    box-shadow: 0 0 14px rgba(109,255,149,.25);
}
.status.err{
    border-color: rgba(255,91,110,.35);
}
.status.err .led{
    background: radial-gradient(circle at 30% 30%, rgba(255,91,110,.95), rgba(255,91,110,.22));
    box-shadow: 0 0 14px rgba(255,91,110,.25);
}
.status .msg{
    color: rgba(201,211,230,.9);
}
.status.err .msg{
    color: rgba(255,179,188,.95);
}

/* Diagram area */
.diagramShell{
    flex:1;
    min-height:0;
    border-radius:12px;
    border:1px solid rgba(30,42,64,.85);
    background: rgba(7,8,11,.22);
    overflow:auto;
    position:relative;
    padding:10px;
}
.diagramShell::after{
    content:"";
    position:absolute; inset:0;
    pointer-events:none;
    box-shadow: inset 0 0 80px rgba(0,0,0,.55);
    border-radius:12px;
}

/* Mermaid SVG styling: make it feel like neon ink on smoked glass */
.diagramShell svg{
    filter: drop-shadow(0 0 8px rgba(68,242,255,.16)) drop-shadow(0 0 16px rgba(255,59,214,.10));
}
/* Nodes */
.diagramShell .node rect,
.diagramShell .node polygon,
.diagramShell .node path{
    stroke: rgba(68,242,255,.55) !important;
    stroke-width: 1.2px !important;
    fill: rgba(13,18,32,.65) !important;
}
.diagramShell .node .label{
    color: rgba(201,211,230,.95) !important;
    font-family: var(--mono) !important;
    font-size: 13px !important;
}
/* Edges */
.diagramShell .edgePath path{
    stroke: rgba(255,59,214,.55) !important;
    stroke-width: 1.2px !important;
    filter: drop-shadow(0 0 8px rgba(255,59,214,.15));
}
.diagramShell .arrowheadPath{
    fill: rgba(255,59,214,.65) !important;
    stroke: rgba(255,59,214,.65) !important;
}
/* Labels on edges */
.diagramShell .edgeLabel{
    background: transparent !important;
}
.diagramShell .edgeLabel tspan,
.diagramShell .edgeLabel{
    fill: rgba(255,207,102,.92) !important;
    font-family: var(--mono) !important;
    font-size: 12px !important;
}

.footerNote{
    padding:10px 14px 14px;
    color:rgba(127,144,173,.9);
    font-size:12px;
    text-align:center;
    opacity:.9;
}
.footerNote span{
    font-family:var(--mono);
    color:rgba(68,242,255,.75);
    text-shadow: var(--shadow);
}