/* ===== Demo page layout ===== */
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh;
    user-select: none;
}

/* ---- Top header bar ---- */
.demo-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.demo-header-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.demo-title {
    font-size: 20px;
    font-weight: 700;
    color: #1d2939;
}
.demo-version {
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
    background: #eef2ff;
    border-radius: 999px;
    padding: 2px 10px;
}
.demo-desc {
    font-size: 13px;
    color: #6b7280;
}
.demo-badge {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    padding: 2px 10px;
}

.demo-wrap {
    display: flex; flex-direction: column; align-items: center;
    gap: 32px; width: 100%; padding: 24px 24px 0;
    margin: auto;
}

/* ---- Trigger input ---- */
.trigger-input {
    width: 320px;
    height: 52px;
    border: 2px solid #d0d5dd;
    border-radius: 12px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #1d2939;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.trigger-wrap {
    position: relative;
}
.trigger-wrap .trigger-input {
    padding-right: 44px;
}
.trigger-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    color: #6b7280;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.trigger-btn:hover {
    background: #f3f4f6;
    color: #4f46e5;
}
.trigger-btn svg {
    transition: transform 0.2s ease;
}
.trigger-btn.open svg {
    transform: rotate(180deg);
}
.trigger-input:hover {
    border-color: #a5b4fc;
}
.trigger-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.trigger-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: -24px;
}

/* ---- Bottom panel ---- */
.demo-bottom {
    display: flex; flex-direction: column; gap: 12px;
    width: 100%;
}
.demo-row {
    display: flex; gap: 16px;
}
.demo-params, .demo-code, .demo-call, .demo-output {
    flex: 0 0 calc(50% - 8px);
    background: #fff; border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    padding: 18px 20px;
}
.demo-params h3, .demo-code h3, .demo-call h3, .demo-output h3 {
    font-size: 13px; color: #6b7280; margin-bottom: 12px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}

/* Settings area */
.param-row {
    display: flex; align-items: center; gap: 10px;
}
.param-row + .param-row { margin-top: 10px; }
.param-row label {
    font-size: 14px; color: #374151; white-space: nowrap;
}
.param-row select {
    flex: 1;
    height: 36px; border: 1.5px solid #d0d5dd; border-radius: 8px;
    padding: 0 10px; font-size: 14px; color: #1d2939;
    background: #f9fafb; outline: none; cursor: pointer;
}
.param-row input[type="color"] {
    width: 32px; height: 28px; border: 1px solid #d0d5dd;
    border-radius: 6px; padding: 2px; cursor: pointer; background: none;
}
.param-row select:focus, .param-row input[type="color"]:focus {
    border-color: #4f46e5; outline: none;
}

/* Hour-cycle radio group */
.param-radio-group {
    display: flex; gap: 6px; align-items: center;
}
.param-radio-group label {
    display: flex; align-items: center; gap: 4px;
    font-size: 13px; color: #374151; cursor: pointer;
    padding: 4px 10px; border-radius: 6px;
    border: 1.5px solid #d0d5dd;
    transition: all .15s;
}
.param-radio-group label.active {
    border-color: #4f46e5; background: #eef2ff; color: #4f46e5;
}
.param-radio-group input[type="radio"] { display: none; }

/* Code area — dark theme */
.demo-code textarea,
.demo-call textarea,
.demo-output textarea {
    background: #1e1e2e; color: #cdd6f4;
    border-radius: 8px; padding: 14px 16px;
    font-size: 12px; line-height: 1.65;
    overflow-x: auto; white-space: pre;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    width: 100%; min-height: 360px;
    border: 2px solid transparent; outline: none;
    resize: vertical; tab-size: 2;
}
.demo-code textarea:focus,
.demo-call textarea:focus,
.demo-output textarea:focus {
    border-color: #4f46e5;
}

/* ===== Mobile responsive ===== */
@media (max-width: 768px) {
    .demo-row {
        flex-direction: column;
    }
    .demo-params,
    .demo-code,
    .demo-call,
    .demo-output {
        flex: 0 0 100%;
    }
    .demo-code textarea,
    .demo-call textarea,
    .demo-output textarea {
        min-height: 200px;
        font-size: 11px;
    }
}
@media (max-width: 480px) {
    .demo-wrap {
        padding: 0 12px;
    }
    .trigger-input {
        width: 100%;
        max-width: 100%;
    }
    .demo-params,
    .demo-code,
    .demo-call,
    .demo-output {
        padding: 14px 14px;
    }
    .param-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .param-row select {
        min-width: 0;
        flex: 1 1 100%;
    }
    .param-radio-group label {
        font-size: 12px;
        padding: 3px 8px;
    }
}
@media (max-width: 360px) {
    .demo-wrap {
        padding: 0 8px;
    }
    .trigger-input {
        height: 44px;
        font-size: 16px;
    }
    .demo-params,
    .demo-code,
    .demo-call,
    .demo-output {
        padding: 10px 10px;
    }
    .demo-code textarea,
    .demo-call textarea,
    .demo-output textarea {
        min-height: 150px;
        padding: 10px 12px;
    }
    .param-row label {
        font-size: 13px;
    }
}
