:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --panel-soft: #f8fbfe;
    --line: #d9e2ec;
    --text: #15314b;
    --muted: #61758a;
    --blue: #0057b8;
    --blue-strong: #004396;
    --blue-soft: rgba(0, 87, 184, 0.12);
    --success: #1e8e5a;
    --danger: #d14343;
    --shadow: 0 18px 45px rgba(13, 52, 88, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Sora", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(0, 87, 184, 0.14), transparent 26%),
        linear-gradient(180deg, #f7faff 0%, var(--bg) 100%);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
}

.page-shell {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 140px;
}

.hero-card,
.content-card {
    background: var(--panel);
    border: 1px solid rgba(0, 87, 184, 0.08);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.7fr);
    gap: 24px;
    padding: 34px;
    margin-bottom: 24px;
}

.hero-copy h1 {
    margin: 10px 0 14px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(180deg, var(--blue), var(--blue-strong));
    color: #ffffff;
    box-shadow: 0 18px 30px rgba(0, 87, 184, 0.22);
}

.brand-mark img {
    display: block;
    width: 48px;
    height: 48px;
}

.brand-text {
    display: grid;
    gap: 3px;
}

.brand-name {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

.brand-subtitle {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-copy p {
    margin: 0;
    max-width: 72ch;
    color: var(--muted);
    line-height: 1.75;
}

.eyebrow {
    display: flex;
    align-items: center;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-accent {
    align-self: stretch;
    justify-self: end;
    width: min(100%, 280px);
    min-height: 180px;
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(0, 87, 184, 0.95), rgba(90, 168, 255, 0.72)),
        linear-gradient(180deg, #ffffff, #d7e9ff);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        0 24px 44px rgba(0, 69, 150, 0.28);
}

.content-card {
    padding: 28px;
}

.crawl-form {
    display: grid;
    gap: 12px;
}

.crawl-form label {
    font-size: 0.95rem;
    font-weight: 600;
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
}

.crawl-form input {
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfdff;
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.crawl-form input:focus {
    outline: none;
    border-color: rgba(0, 87, 184, 0.65);
    box-shadow: 0 0 0 4px rgba(0, 87, 184, 0.12);
    background: #ffffff;
}

.crawl-form button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 22px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--blue), var(--blue-strong));
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 16px 30px rgba(0, 87, 184, 0.22);
}

.secondary-button {
    background: linear-gradient(180deg, #eef3f8, #dce6f0);
    color: var(--text);
    box-shadow: none;
    border: 1px solid #c5d2df;
}

.secondary-button:hover {
    box-shadow: none;
}

.secondary-button:disabled {
    background: linear-gradient(180deg, #f5f8fb, #e8eef5);
    color: #8a99aa;
    border-color: #d5dee8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.crawl-form button:hover,
.download-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 34px rgba(0, 87, 184, 0.26);
}

.download-button.is-disabled {
    background: linear-gradient(180deg, #d7e1ec, #c2cfdd);
    color: #f8fbff;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

.download-button.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.button-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.crawl-form button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.table-toolbar-top {
    margin-bottom: 16px;
}

.table-card {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, var(--panel-soft) 100%);
    overflow: hidden;
}

.table-scroll {
    overflow: auto;
}

table {
    width: 100%;
    min-width: 1220px;
    border-collapse: collapse;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 16px 14px;
    background: #edf5ff;
    color: var(--blue-strong);
    text-align: left;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #cfddee;
}

tbody td {
    padding: 16px 14px;
    border-bottom: 1px solid #e7edf4;
    vertical-align: top;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text);
    background: rgba(255, 255, 255, 0.78);
}

tbody tr:nth-child(even) td {
    background: rgba(248, 251, 254, 0.98);
}

tbody tr:hover td {
    background: rgba(224, 238, 255, 0.55);
}

th:first-child,
td:first-child {
    width: 94px;
    white-space: nowrap;
}

th:nth-child(2),
td:nth-child(2) {
    width: 280px;
    word-break: break-word;
}

.empty-row td {
    padding: 38px 18px;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.96);
}

.status-sticky {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(640px, calc(100vw - 24px));
    padding: 18px 20px;
    border: 1px solid rgba(0, 87, 184, 0.14);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 36px rgba(8, 41, 72, 0.16);
}

.status-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.status-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.debug-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid #c7d5e4;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #eef5fc);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.debug-trigger:disabled {
    color: #8a99aa;
    background: linear-gradient(180deg, #f6f8fb, #edf2f7);
    border-color: #d8e1eb;
    cursor: not-allowed;
}

.status-copy strong {
    font-size: 0.98rem;
}

.status-copy span {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.status-dot {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c8d3df;
}

.status-sticky.is-running .status-dot {
    background: var(--blue);
    box-shadow: 0 0 0 0 rgba(0, 87, 184, 0.42);
    animation: pulse 1.5s infinite;
}

.status-sticky.is-success {
    border-color: rgba(30, 142, 90, 0.22);
}

.status-sticky.is-success .status-dot {
    background: var(--success);
}

.status-sticky.is-error {
    border-color: rgba(209, 67, 67, 0.22);
}

.status-sticky.is-error .status-dot {
    background: var(--danger);
}

.debug-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
}

.debug-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 33, 56, 0.5);
    backdrop-filter: blur(4px);
}

.debug-dialog {
    position: relative;
    z-index: 1;
    width: min(1040px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 87, 184, 0.12);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 30px 70px rgba(8, 41, 72, 0.22);
}

.debug-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 24px 18px;
    border-bottom: 1px solid #e3ebf3;
}

.debug-header-copy {
    display: grid;
    gap: 10px;
}

.debug-header-copy h2 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.15;
}

.debug-header-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.debug-close {
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid #c7d5e4;
    border-radius: 14px;
    background: #f6faff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.debug-body {
    overflow: auto;
    padding: 20px 24px 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
}

.debug-empty {
    padding: 18px;
    border: 1px dashed #c7d5e4;
    border-radius: 18px;
    color: var(--muted);
    background: #ffffff;
}

.debug-list {
    display: grid;
    gap: 14px;
}

.debug-entry {
    border: 1px solid #d9e4ef;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
}

.debug-entry summary {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
}

.debug-entry summary::-webkit-details-marker {
    display: none;
}

.debug-entry-title {
    font-weight: 700;
    color: var(--text);
}

.debug-entry-meta {
    color: var(--muted);
    font-size: 0.84rem;
}

.debug-entry-body {
    display: grid;
    gap: 10px;
    padding: 0 18px 18px;
    border-top: 1px solid #edf2f7;
}

.debug-field {
    display: grid;
    gap: 4px;
}

.debug-field-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--blue-strong);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.debug-field-value {
    color: var(--text);
    line-height: 1.65;
    word-break: break-word;
}

.debug-attempts {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.debug-attempts h3 {
    margin: 0;
    font-size: 0.95rem;
}

.debug-attempt {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid #e3ebf3;
    border-radius: 16px;
    background: #f9fbfd;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 87, 184, 0.38);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(0, 87, 184, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 87, 184, 0);
    }
}

@media (max-width: 980px) {
    .hero-card {
        grid-template-columns: 1fr;
    }

    .hero-accent {
        width: 100%;
        min-height: 120px;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .crawl-form button {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 20px, 1440px);
        padding-top: 18px;
    }

    .hero-card,
    .content-card {
        border-radius: 20px;
        padding: 20px;
    }

    .status-sticky {
        right: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
        border-radius: 18px;
        align-items: stretch;
        flex-direction: column;
    }

    .download-button {
        width: 100%;
    }

    .table-toolbar {
        justify-content: stretch;
    }

    .debug-dialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        margin: 8px auto;
        border-radius: 18px;
    }

    .debug-header {
        flex-direction: column;
        align-items: stretch;
    }
}
