* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(135deg, #f2f5f7 0%, #dbe7ee 100%);
    color: #173042;
}

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.hero, .page-header, .card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(23, 48, 66, 0.1);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(23, 48, 66, 0.08);
}

.hero, .page-header {
    padding: 28px;
    margin-bottom: 24px;
}

.hero h1,
.page-header h1 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.15;
}

.hero p,
.page-header p {
    margin: 0;
    line-height: 1.6;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.grid {
    display: grid;
    gap: 20px;
}

.two-col {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: 20px;
}

.card { padding: 24px; }

.card h2 {
    margin-top: 0;
}

.link-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(23, 48, 66, 0.12);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.text-input {
    border: 1px solid #c6d5df;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 16px;
    width: 100%;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.primary-button, .secondary-button, .secondary-link, input[type="submit"] {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button { background: #0e7490; color: #fff; }
.secondary-button, .secondary-link { background: #dbeafe; color: #0f172a; }
.status, .hint { margin-top: 14px; color: #355468; }

.camera {
    width: 100%;
    min-height: 260px;
    background: #09151d;
    border-radius: 18px;
    object-fit: cover;
}

.hidden-canvas { display: none; }

.grid-view {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    margin-top: 14px;
}

.grid-view th, .grid-view td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.grid-view th { background: #eff6ff; }

.result-box {
    border-radius: 16px;
    background: #eff6ff;
    padding: 16px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
}

.table-wrap .grid-view {
    margin-top: 0;
}

@media (max-width: 900px) {
    .shell {
        padding: 20px 14px 32px;
    }

    .hero,
    .page-header,
    .card {
        border-radius: 16px;
    }

    .hero,
    .page-header,
    .card {
        padding: 18px;
    }

    .camera {
        min-height: 220px;
    }
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header,
    .hero,
    .card {
        padding: 16px;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .button-row {
        flex-direction: column;
    }

    .primary-button,
    .secondary-button,
    .secondary-link,
    input[type="submit"] {
        width: 100%;
    }

    .camera {
        min-height: 180px;
    }

    .grid-view {
        min-width: 560px;
    }

    .grid-view th,
    .grid-view td {
        padding: 9px 10px;
        white-space: nowrap;
    }
}
