:root {
    --bg: #f1f5f1;
    --card: #ffffff;
    --text: #17251f;
    --muted: #5f6f66;
    --primary: #0f6b4f;
    --accent: #cc8b1f;
    --danger: #b33a3a;
    --ok: #247a43;
    --line: #d8e1db;
    --hot-pink: #ff4f9f;
    --sky: #33c7ff;
    --lime: #7ee05a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
}

.bg-main {
    background: radial-gradient(circle at 15% 10%, #f9f8d8, #e7f7ef 35%, #dff5ff 70%, #f7f8f7);
    min-height: 100vh;
}

.projector-bg {
    background: linear-gradient(130deg, #13251f, #17362d 40%, #204538);
    color: #ffffff;
    min-height: 100vh;
}

.container {
    width: min(1160px, 92vw);
    margin: 24px auto;
}

.page-center {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(18, 27, 22, 0.08), 0 0 0 1px rgba(255, 79, 159, 0.08);
}

.auth-card {
    width: min(520px, 100%);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 4vw;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(110deg, #f9fbfa, #ecf7ff 55%, #fff2e6);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(8px);
}

.topbar-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-nav a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid rgba(15, 107, 79, 0.22);
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.8);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
}

.station-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.stack {
    display: grid;
    gap: 10px;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(100deg, var(--primary), #16a079);
    color: #fff;
}

.btn-light {
    background: #eff4f1;
    color: #1f352c;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(100deg, #ffd168, #ff9d4f);
    color: #22190b;
}

.alert {
    padding: 10px;
    border-radius: 10px;
    background: #fff8db;
    border: 1px solid #f0e3a0;
}

.alert-error {
    background: #ffe5e5;
    border-color: #e9b7b7;
}

.alert-ok {
    background: #e2f3e7;
    border-color: #b9dbbf;
}

.path-list,
.ranking-list,
.leaderboard {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.path-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fbfdfc;
}

.path-item.active {
    border-color: #97cab2;
    box-shadow: 0 0 0 3px rgba(15, 107, 79, 0.1);
}

.path-item.done {
    background: #ecf8ee;
}

.path-title {
    font-weight: 700;
}

.path-desc {
    color: var(--muted);
    font-size: 0.9rem;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(60px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.map-tile {
    display: grid;
    place-items: center;
    height: 68px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid var(--line);
    color: #204133;
}

.map-tile.active {
    background: #d7f0df;
    border-color: #8dc3a5;
}

.map-tile.done {
    background: #e4f6ea;
}

.map-tile.locked {
    background: #f3f4f3;
    color: #87948d;
}

.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    background: linear-gradient(110deg, var(--hot-pink), #ff7f50);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.feature-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-user-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 10px;
    align-items: center;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.checkbox-inline input {
    width: auto;
}

.table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 8px;
    vertical-align: middle;
}

.users-table tbody tr:hover {
    background: #f7fbfa;
}

.users-table thead th {
    background: #f2f8f5;
    position: sticky;
    top: 0;
    z-index: 2;
}

.actions-cell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 160px;
}

.projector-embed {
    width: 100%;
    min-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.login-logo {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

.plant-map {
    position: relative;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
}

.plant-map img {
    width: 100%;
    display: block;
}

.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    text-decoration: none;
    font-weight: 700;
    color: #13211b;
    border: 2px solid #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    animation: pulse 2s infinite;
}

.map-pin.done {
    background: var(--lime);
}

.map-pin.active {
    background: var(--sky);
}

.map-pin.locked {
    background: #dce5df;
}

.station-image,
.station-video {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.hidden {
    display: none !important;
}

.station-hero {
    padding: 22px 4vw;
    background: linear-gradient(120deg, #fffef0 0%, #e7f9ff 45%, #ffe8f1 100%);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.station-hero-inner h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.station-kicker {
    display: inline-block;
    background: linear-gradient(100deg, #33c7ff, #ff4f9f);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 8px;
}

.station-hero-lead {
    margin: 6px 0;
    font-weight: 700;
}

.station-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.meta-chip {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.86rem;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.collapsible-panel {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fcfdfc;
}

.wow-switch-grid {
    gap: 12px;
}

.wow-switch-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    background: linear-gradient(105deg, #ffffff, #f7fbff);
}

.wow-switch-text strong {
    text-transform: capitalize;
}

.toggle-wrap {
    position: relative;
    width: 56px;
    height: 32px;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    z-index: 2;
    cursor: pointer;
}

.toggle-ui {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #dae2de;
    transition: background 0.2s ease;
}

.toggle-ui::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.toggle-input:checked + .toggle-ui {
    background: linear-gradient(90deg, #1ab88a, #0f6b4f);
}

.toggle-input:checked + .toggle-ui::after {
    transform: translateX(24px);
}

.stations-toolbar {
    margin-bottom: 10px;
}

.map-coords-readout {
    font-size: 0.86rem;
    color: var(--muted);
    background: #f3f7f5;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 7px 9px;
}

.map-picker-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 13, 0.62);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 60;
}

.map-picker-dialog {
    width: min(980px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 14px;
}

.map-picker-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.map-picker-canvas {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    cursor: crosshair;
}

.map-picker-canvas img {
    display: block;
    width: 100%;
    height: auto;
}

.map-picker-existing-pin,
.map-picker-active-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    display: grid;
    place-items: center;
}

.map-picker-existing-pin {
    width: 15px;
    height: 15px;
    background: #8eb7a2;
    color: transparent;
}

.map-picker-active-pin {
    width: 26px;
    height: 26px;
    background: linear-gradient(145deg, #ff4f9f, #ff8a3d);
}

.star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #c8d1cb;
    transition: transform 0.12s ease, color 0.2s ease;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #ffb433;
}

.star-rating label:hover {
    transform: scale(1.07);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(51, 199, 255, 0.45); }
    70% { box-shadow: 0 0 0 14px rgba(51, 199, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(51, 199, 255, 0); }
}

.projector-wrap {
    width: min(1400px, 96vw);
    margin: 20px auto;
}

.projector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.metric {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.progress-item {
    display: grid;
    grid-template-columns: 1fr 1.5fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #7de0b0;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.13);
    margin-bottom: 8px;
}

.finale-screen {
    text-align: center;
    padding: 40px 10px;
}

.countdown {
    font-size: clamp(80px, 20vw, 240px);
    font-weight: 800;
    line-height: 1;
    margin: 30px 0;
}

.podium {
    display: flex;
    justify-content: center;
    align-items: end;
    gap: 14px;
}

.podium-col {
    width: min(220px, 30vw);
    padding: 12px;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, #f6dc8f, #b48822);
    color: #2e1c04;
}

.place-1 {
    min-height: 240px;
}

.place-2 {
    min-height: 190px;
}

.place-3 {
    min-height: 150px;
}

.hidden {
    display: none;
}

@media (max-width: 920px) {
    .grid-layout,
    .station-layout,
    .projector-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .grid-user-form {
        grid-template-columns: 1fr;
    }

    .map-picker-dialog {
        width: 100%;
        max-height: 92vh;
    }
}
