:root {
    --bg: #f3f7fb;
    --bg-deep: #003b5c;
    --panel: rgba(255, 255, 255, 0.94);
    --panel-strong: #ffffff;
    --text: #16212b;
    --muted: #556270;
    --accent: #ffb81c;
    --accent-dark: #c98e08;
    --accent-alt: #1baec8;
    --success: #74c043;
    --danger: #a42828;
    --line: rgba(0, 59, 92, 0.14);
    --shadow: 0 18px 50px rgba(0, 41, 70, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 184, 28, 0.24), transparent 24%),
        radial-gradient(circle at bottom right, rgba(27, 174, 200, 0.14), transparent 24%),
        linear-gradient(135deg, #eef5fb 0%, #f9fbfd 100%);
}

a {
    color: var(--bg-deep);
}

.shell {
    min-height: 100vh;
    padding: 32px;
}

.hero-layout,
.teacher-layout,
.student-layout,
.center-layout {
    max-width: 1180px;
    margin: 0 auto;
}

.hero-layout {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 24px;
    align-items: stretch;
    padding-top: 48px;
}

.hero-card,
.form-card,
.summary-card,
.table-card,
.question-card,
.progress-card,
.timer-card,
.insight-card,
.ranking-card {
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-card,
.form-card,
.table-card {
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.hero-card::before,
.form-card::before,
.table-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--bg-deep), var(--accent), var(--accent-alt));
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
}

.hero-card h1,
.form-card h1,
.teacher-header h1,
.student-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 3vw, 3.4rem);
    line-height: 1.05;
}

.lead {
    font-size: 1.05rem;
    max-width: 42rem;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: var(--bg-deep);
    font-weight: 700;
}

.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.status-strip span,
.helper-box,
.summary-card span {
    font-size: 0.95rem;
    color: var(--muted);
}

.helper-box {
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(0, 59, 92, 0.05);
}

.stack-form {
    display: grid;
    gap: 16px;
}

.stack-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
button {
    font: inherit;
}

input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
}

button,
.ghost-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 14px;
    padding: 14px 18px;
    background: var(--bg-deep);
    color: white;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--bg-deep), #00557f);
    color: white;
}

button:hover,
.ghost-link:hover {
    transform: translateY(-1px);
    background: #002944;
}

.ghost-btn,
.ghost-link {
    background: rgba(0, 59, 92, 0.08);
    color: var(--bg-deep);
}

.danger-btn {
    background: var(--danger);
}

.error-text {
    color: var(--danger);
    font-weight: 700;
}

.narrow {
    max-width: 420px;
    margin: 12vh auto 0;
}

.teacher-header,
.student-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.teacher-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    padding: 20px;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.4rem;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th,
.table-card td {
    padding: 16px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

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

.insight-list.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insight-card,
.ranking-card {
    padding: 18px;
    border-radius: 20px;
}

.insight-card p,
.ranking-card p {
    margin: 8px 0 0;
    color: var(--muted);
}

.mini-pill,
.tag,
.tag.neutral {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.mini-pill,
.tag {
    background: rgba(0, 59, 92, 0.1);
    color: var(--bg-deep);
}

.tag.neutral {
    background: rgba(91, 91, 91, 0.12);
    color: var(--muted);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ranking-board {
    display: grid;
    gap: 14px;
}

.ranking-card {
    display: grid;
    gap: 6px;
    background: linear-gradient(135deg, rgba(0, 59, 92, 0.96), rgba(27, 174, 200, 0.88));
    color: white;
}

.ranking-card p {
    color: rgba(255, 255, 255, 0.88);
}

.ranking-position {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.presentation-layout {
    max-width: 1320px;
}

.student-layout {
    padding-top: 28px;
}

.review-card {
    margin-top: 24px;
}

.waiting-card {
    margin-bottom: 24px;
}

.hidden {
    display: none;
}

.progress-card {
    min-width: 260px;
    padding: 20px;
}

.timer-card {
    min-width: 220px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-deep), #00557f);
    color: white;
}

.timer-card span,
.timer-card p {
    color: rgba(255, 255, 255, 0.85);
}

.timer-card strong {
    display: block;
    font-size: 2rem;
    margin: 8px 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    margin-top: 10px;
    border-radius: 999px;
    background: rgba(0, 59, 92, 0.12);
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--bg-deep), var(--accent-alt), var(--accent));
}

.question-list {
    display: grid;
    gap: 18px;
}

.question-card {
    padding: 22px;
}

.question-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
}

.option-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.option-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel-strong);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.option-item input {
    width: auto;
    margin-top: 4px;
}

.save-indicator {
    margin-top: 10px;
    font-size: 0.92rem;
    color: var(--success);
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(116, 192, 67, 0.16);
    color: #4a8529;
    font-size: 0.86rem;
    font-weight: 700;
}

.pill.closed {
    background: rgba(164, 40, 40, 0.14);
    color: var(--danger);
}

.pill.warning {
    background: rgba(255, 184, 28, 0.26);
    color: #8a6200;
}

.pill.neutral {
    background: rgba(0, 59, 92, 0.1);
    color: var(--bg-deep);
}

.is-waiting .option-item {
    opacity: 0.72;
    pointer-events: none;
}

.is-expired .option-item {
    opacity: 0.75;
    pointer-events: none;
}

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

    .hero-layout,
    .teacher-summary,
    .analytics-grid,
    .insight-list.wide {
        grid-template-columns: 1fr;
    }

    .teacher-header,
    .student-header {
        flex-direction: column;
    }

    .progress-card {
        width: 100%;
    }
}
