:root {
    --pitch-green: #1b4332;
    --pitch-green-dark: #12302322;
    --willow-cream: #f5efe0;
    --oak-brown: #6b4423;
    --amber: #e8a33d;
    --amber-dark: #c8842a;
    --ink: #1a1a1a;
    --red-card: #a4342c;
    --danger: #8b2e28;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--pitch-green);
    color: var(--willow-cream);
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Login page ---------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: var(--ink);
    border: 1px solid #33402c;
    border-radius: 10px;
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-eyebrow {
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--amber);
    margin-bottom: 6px;
}

.login-card h1 {
    font-size: 1.5rem;
    margin: 0 0 24px;
    font-family: Georgia, 'Times New Roman', serif;
}

.badge {
    width: 88px;
    height: auto;
    margin-bottom: 10px;
}

.badge-small {
    width: 44px;
    height: auto;
}

.login-card form {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.login-card label {
    font-size: 0.8rem;
    margin: 12px 0 4px;
    color: #cfc7ae;
}

.login-card input {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #101010;
    color: var(--willow-cream);
    font-size: 1rem;
}

.login-card button {
    margin-top: 22px;
    padding: 13px;
    border: none;
    border-radius: 6px;
    background: var(--amber);
    color: var(--ink);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.login-card button:hover {
    background: var(--amber-dark);
}

.flash {
    background: var(--danger);
    color: var(--willow-cream);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* ---------- Control panel ---------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--ink);
    border-bottom: 3px solid var(--amber);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eyebrow {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--amber);
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: 1.2rem;
    font-family: Georgia, 'Times New Roman', serif;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: #cfc7ae;
}

.logout-link {
    color: var(--amber);
    text-decoration: none;
    border: 1px solid var(--amber);
    padding: 6px 10px;
    border-radius: 6px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.card {
    background: var(--ink);
    border: 1px solid #33402c;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
}

.card-wide {
    grid-column: 1 / -1;
}

.card h2 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #cfc7ae;
}

.value {
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: 700;
    color: var(--amber);
    margin-bottom: 12px;
    line-height: 1;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 56px;
    color: var(--willow-cream);
    background: var(--oak-brown);
}

.btn:active {
    transform: scale(0.96);
}

.btn.run {
    background: var(--pitch-green-dark, #1e3d2f);
    background: #2f5d44;
}

.btn.run.six {
    background: var(--red-card);
}

.btn.plus {
    background: #2f5d44;
}

.btn.undo {
    background: #4a4a4a;
}

.btn.reset {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    background: var(--danger);
    color: var(--willow-cream);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    opacity: 0.85;
}

.btn.reset:hover {
    background: #a83a33;
    opacity: 1;
}

/* Per-field colour accents: a top border + tinted value colour, so the
   dark pavilion cards stay consistent but each field is easy to tell
   apart at a glance. */
.card-red {
    border-top: 3px solid #a4342c;
}
.card-red .value {
    color: #e07b73;
}

.card-blue {
    border-top: 3px solid #2f6690;
}
.card-blue .value {
    color: #6fb3dd;
}

.card-teal {
    border-top: 3px solid #1d9e75;
}
.card-teal .value {
    color: #5dcaa5;
}

.card-purple {
    border-top: 3px solid #7f77dd;
}
.card-purple .value {
    color: #afa9ec;
}

.card-amber {
    border-top: 3px solid var(--amber);
}
.card-amber .value {
    color: var(--amber);
}

.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.reset-all {
    background: var(--danger);
    color: var(--willow-cream);
    padding: 14px 22px;
    border-radius: 8px;
}

.sync-indicator {
    font-size: 0.75rem;
    color: #8fae9c;
}

@media (max-width: 480px) {
    .value {
        font-size: 2.4rem;
    }
    .btn {
        flex: 1 1 auto;
        padding: 16px 10px;
    }
}

/* ---------- Admin dashboard ---------- */

.admin-main {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

.admin-section {
    background: var(--ink);
    border: 1px solid #33402c;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
}

.admin-section h2 {
    margin: 0 0 14px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--amber);
}

.admin-flash {
    background: #2f5d44;
    color: var(--willow-cream);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.admin-flash p {
    margin: 2px 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th {
    text-align: left;
    color: #cfc7ae;
    font-weight: 400;
    padding: 6px 8px;
    border-bottom: 1px solid #33402c;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.admin-table td {
    padding: 8px;
    border-bottom: 1px solid #262f22;
    vertical-align: middle;
}

.role-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.role-admin {
    background: var(--amber);
    color: var(--ink);
}

.role-standard {
    background: #444;
    color: var(--willow-cream);
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form input,
.inline-form select,
.admin-form input,
.admin-form select {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #101010;
    color: var(--willow-cream);
    font-size: 0.85rem;
}

.btn.small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.color-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}

.color-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #cfc7ae;
}

.color-row input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #101010;
    padding: 2px;
}

.color-sample {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.4rem;
    text-align: center;
}

.color-form .btn {
    grid-column: 1 / -1;
}

.admin-hint {
    font-size: 0.8rem;
    color: #8fae9c;
    display: block;
    margin-top: 8px;
}

.panel-preview-frame {
    background: #000;
    border-radius: 4px;
    padding: 8px;
    display: inline-flex;
    margin-top: 14px;
}

.panel-preview-screen {
    background-color: #000;
    background-image: radial-gradient(circle, #141414 1px, transparent 1.5px);
    background-size: 6px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    /* width/height/font-sizes set dynamically via JS based on panel count */
}

.panel-preview-top {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #ffb000;
    letter-spacing: 1px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.panel-preview-top.scrolling {
    animation: admin-scroll-left 8s linear infinite;
}

@keyframes admin-scroll-left {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.panel-preview-bottom {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #50c8ff;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* ---------- Display mode toggle (control panel) ---------- */

.mode-toggle {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--willow-cream);
    cursor: pointer;
}

#custom-message-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #101010;
    color: var(--willow-cream);
    font-size: 1rem;
    box-sizing: border-box;
}
