* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:       #D4A464;
    --white:    #ffffff;
    --w80:      rgba(255, 255, 255, 0.80);
    --w30:      rgba(255, 255, 255, 0.30);
    --w15:      rgba(255, 255, 255, 0.15);
}

body {
    font-family: 'Agdasima', sans-serif;
    background: var(--bg);
    color: var(--white);
    height: 100vh;
    overflow: hidden;
}

/* ─────────────────────────────────
   Layout: sidebar + main
───────────────────────────────── */
.layout {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* ─────────────────────────────────
   Sidebar
───────────────────────────────── */
.sidebar {
    width: 290px;
    flex-shrink: 0;
    border: 1.5px solid var(--w80);
    border-radius: 22px;
    padding: 30px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-self: flex-start;
}

.config-label {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.api-input {
    width: 100%;
    padding: 14px 22px;
    background: transparent;
    border: 1.5px solid var(--w80);
    border-radius: 100px;
    font-family: 'Agdasima', sans-serif;
    font-size: 1.1rem;
    color: var(--white);
    outline: none;
    transition: border-color 0.2s;
}

.api-input::placeholder {
    color: var(--w80);
}

.api-input:focus {
    border-color: var(--white);
}

.test-btn {
    width: 100%;
    justify-content: center;
}

#test-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.95rem;
}

.test-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--w15);
    border: 1px solid var(--w30);
}

.test-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.test-dot.ok  { background: #6ddf8a; }
.test-dot.err { background: #e8605a; }
.test-dot.checking { background: var(--w80); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ─────────────────────────────────
   Sidebar footer buttons
───────────────────────────────── */
.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sys-design-btn {
    width: 100%;
    padding: 14px 22px;
    background: var(--w80);
    color: #6b4e1e;
    border: none;
    border-radius: 100px;
    font-family: 'Agdasima', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.sys-design-btn:hover { background: var(--white); }

.dev-info-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    background: var(--w80);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.dev-info-btn:hover { background: var(--white); }

#particle-cone-btn {
    display: block;
    flex-shrink: 0;
}

.dev-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dev-info-name {
    font-family: 'Agdasima', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #6b4e1e;
}

.dev-info-sub {
    font-family: 'Agdasima', sans-serif;
    font-size: 0.95rem;
    color: rgba(107, 78, 30, 0.75);
}

/* ─────────────────────────────────
   Modals
───────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal-card {
    position: relative;
    background: var(--bg);
    border: 1.5px solid var(--w80);
    border-radius: 24px;
    padding: 36px 32px 32px;
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modal-card--iframe {
    padding: 0;
    overflow: hidden;
    height: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--w80);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--white); }

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.modal-img-wrap {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--w30);
}

.modal-img-wrap img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 24px;
    color: var(--w80);
    font-size: 1rem;
    text-align: center;
    background: var(--w15);
}

.img-placeholder span { font-size: 2.5rem; }

.dev-iframe {
    width: 100%;
    height: 450px;
    border: none;
    border-radius: 24px;
    display: block;
}

.ratelimit-card {
    text-align: center;
    max-width: 380px;
    gap: 16px;
}

.ratelimit-icon {
    font-size: 2.8rem;
    opacity: 0.85;
}

.ratelimit-title {
    font-size: 1.6rem;
    font-weight: 700;
}

.ratelimit-msg {
    font-size: 1rem;
    opacity: 0.75;
    line-height: 1.5;
}

/* ─────────────────────────────────
   Main area
───────────────────────────────── */
.main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

.main-inner {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 38px;
    padding-top: 22vh;
    padding-bottom: 60px;
}

/* Scrollbar */
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--w30); border-radius: 4px; }

/* ─────────────────────────────────
   Hero content
───────────────────────────────── */
.site-title {
    font-size: 5.5rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}

.topic-input {
    width: 100%;
    padding: 24px 36px;
    background: transparent;
    border: 1.5px solid var(--w80);
    border-radius: 100px;
    font-family: 'Agdasima', sans-serif;
    font-size: 1.4rem;
    color: var(--white);
    outline: none;
    transition: border-color 0.2s;
}

.topic-input::placeholder {
    color: var(--w80);
}

.topic-input:focus {
    border-color: var(--white);
}

/* ─────────────────────────────────
   Loading spinner
───────────────────────────────── */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
}

.spinner-ring {
    width: 36px;
    height: 36px;
    border: 2.5px solid var(--w30);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─────────────────────────────────
   Progress
───────────────────────────────── */
#progress-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-item {
    font-size: 1rem;
    padding: 10px 18px;
    background: var(--w15);
    border: 1px solid var(--w30);
    border-radius: 12px;
}

/* ─────────────────────────────────
   Report
───────────────────────────────── */
.report-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.pill-btn {
    background: transparent;
    color: var(--white);
    border: 1.5px solid var(--w80);
    padding: 10px 26px;
    border-radius: 100px;
    font-family: 'Agdasima', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pill-btn:hover {
    border-color: var(--white);
    background: var(--w15);
}

#report-output {
    font-size: 1rem;
    line-height: 1.75;
}

#report-output h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--w30);
}

#report-output h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 10px;
}

#report-output h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 18px;
    margin-bottom: 8px;
}

#report-output p  { margin-bottom: 14px; }

#report-output ul {
    padding-left: 24px;
    margin-bottom: 14px;
}

#report-output li { margin-bottom: 6px; }

#report-output a {
    color: var(--white);
    opacity: 0.85;
    text-decoration: underline;
}

#report-output hr {
    border: none;
    border-top: 1px solid var(--w30);
    margin: 24px 0;
}

#report-output em {
    opacity: 0.75;
    font-size: 0.9rem;
}

/* ─────────────────────────────────
   Hamburger (mobile only)
───────────────────────────────── */
.hamburger {
    display: none;
    position: fixed;
    top: 20px;
    left: 22px;
    z-index: 300;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 7px;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.25);
}

.overlay.open {
    display: block;
}

/* ─────────────────────────────────
   Mobile
───────────────────────────────── */
@media (max-width: 768px) {
    body { overflow: auto; height: auto; }

    .hamburger { display: flex; }

    .layout {
        padding: 0;
        gap: 0;
        height: auto;
        min-height: 100vh;
    }

    /* Sidebar becomes a left drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 250;
        border-radius: 0 22px 22px 0;
        border-left: none;
        background: var(--bg);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        width: 100%;
        min-height: 100vh;
        overflow-y: visible;
        padding: 0;
    }

    .main-inner {
        padding: 100px 28px 60px;
        gap: 28px;
        max-width: 100%;
    }

    .site-title {
        font-size: 3.4rem;
        text-align: left;
    }
}
