:root {
    --bg-main: #09090b;
    --bg-sidebar: #000000;
    --bg-panel: #121214;
    --bg-input: #18181b;

    --border-color: #27272a;
    --border-light: #3f3f46;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --accent: #fff;
    --accent-fg: #000;

    --success: #10b981;
    --error: #ef4444;
    --record: #ef4444;

    --font-sans: "Inter", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    --sidebar-width: 260px;
    --header-height: 56px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100%;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 50;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-label {
    padding: 0 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.nav-item {
    padding: 8px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-input);
    border-left-color: var(--text-primary);
}

.verb-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 38px;
    text-align: center;
}
.verb-GET {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}
.verb-POST {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-main);
    height: 100vh;
}

.top-bar {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-main);
    flex-shrink: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.token-input-wrapper {
    position: relative;
    width: 240px;
}

.input-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    display: flex;
}

#api-token {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 32px;
    padding: 0 10px 0 30px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: border-color 0.2s;
}

#api-token:focus {
    border-color: var(--text-secondary);
}

.btn-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-text:hover {
    color: var(--text-primary);
}

.content-area {
    flex: 1;
    overflow: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.method-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.method-header {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.path-text {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 13px;
}

#current-method-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#current-method-desc {
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 800px;
}

.playground-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.panel {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.panel-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    flex-shrink: 0;
}

.panel-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.panel-content {
    flex: 1;
    position: relative;
    min-height: 0;
}

.panel-content.scrollable-desktop {
    overflow-y: auto;
    padding: 16px;
}

.panel-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.01);
    flex-shrink: 0;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.req {
    color: var(--error);
    margin-left: 2px;
}

.std-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: border-color 0.2s;
}
.std-input:focus {
    border-color: var(--text-tertiary);
}

textarea.std-input {
    min-height: 80px;
    resize: vertical;
    line-height: 1.4;
}

.btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border: 1px solid transparent;
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-ghost:hover {
    background: var(--border-color);
}

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}
.btn-primary.loading .spinner {
    display: block;
}
.btn-primary.loading span {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.code-wrapper {
    background: #0d0d0d;
    overflow: hidden;
}

.code-block {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: #e4e4e7;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.array-container {
    border-left: 1px solid var(--border-color);
    padding-left: 12px;
    margin-left: 4px;
}
.array-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}
.array-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.array-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--text-tertiary);
}
.btn-add,
.btn-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 11px;
}
.btn-add:hover {
    color: var(--text-primary);
}
.btn-remove:hover {
    color: var(--error);
}

.file-drop {
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-input);
    transition: all 0.2s;
    position: relative;
}
.file-drop:hover {
    border-color: var(--text-secondary);
}
.file-drop.drag-active {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.file-preview {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    border-radius: 6px;
    padding: 10px;
}

.preview-content {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
.preview-content img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}
.preview-content audio {
    width: 100%;
    height: 32px;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    gap: 8px;
}
.file-name {
    color: var(--success);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}
.btn-remove-file:hover {
    color: var(--error);
}

.audio-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-record {
    flex: 1;
    height: 32px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--record);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-record:hover {
    background: rgba(239, 68, 68, 0.2);
}

.recording-ui {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--record);
    border-radius: 6px;
    padding: 6px 12px;
    margin-top: 8px;
}

.pulsing-dot {
    width: 8px;
    height: 8px;
    background: var(--record);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.recording-text {
    font-size: 12px;
    color: var(--text-primary);
    flex: 1;
}

.btn-stop-record {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 600;
}
.btn-stop-record:hover {
    color: var(--text-primary);
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-head {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-head h3 {
    font-size: 14px;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
}
.modal-close:hover {
    color: var(--text-primary);
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}
.tab-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
}
.tab-btn.active {
    background: var(--bg-panel);
    color: var(--text-primary);
}

.modal-body {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: #0d0d0d;
}
.code-block-modal {
    margin: 0;
    padding: 16px;
    height: 100%;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #e4e4e7;
    white-space: pre-wrap;
}

.token-kwd {
    color: #569cd6;
    font-weight: bold;
}
.token-str {
    color: #ce9178;
}
.token-cmt {
    color: #6a9955;
    font-style: italic;
}
.token-num {
    color: #b5cea8;
}
.token-key {
    color: #9cdcfe;
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
}
.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.2s ease;
}
@keyframes slideIn {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.json-key {
    color: #9cdcfe;
}
.json-string {
    color: #ce9178;
}
.json-number {
    color: #b5cea8;
}
.json-boolean {
    color: #569cd6;
}
.json-null {
    color: #569cd6;
}
.status-ok {
    color: var(--success);
    font-weight: 600;
    font-size: 12px;
}
.status-err {
    color: var(--error);
    font-weight: 600;
    font-size: 12px;
}

.mobile-only {
    display: none;
}
.desktop-only {
    display: flex;
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.mobile-auth-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    .mobile-only {
        display: block;
    }
    .desktop-only {
        display: none;
    }

    .icon-btn {
        background: none;
        border: none;
        color: var(--text-primary);
        padding: 8px;
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        height: auto;
        overflow: visible;
    }
    .content-area {
        padding: 16px;
        overflow: visible;
        height: auto;
    }
    .top-bar {
        padding: 0 16px;
    }

    .playground-grid {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding-bottom: 30px;
    }
    .panel {
        height: auto;
        flex-shrink: 0;
        overflow: visible;
    }
    .panel-content.scrollable-desktop {
        overflow: visible;
        height: auto;
    }
    .response-panel {
        height: auto;
    }
    .code-wrapper {
        position: relative;
        height: auto;
        min-height: 100px;
    }
    .code-block {
        position: static;
        inset: auto;
        height: auto;
        overflow: visible;
        white-space: pre-wrap;
    }

    .mobile-logo {
        font-weight: 600;
        color: var(--text-primary);
    }
}

.hidden {
    display: none !important;
}
