* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: white;
    justify-content: center;
}

.main-container {
    max-width: 800px;
    margin: auto;
    padding: 20px;
    flex: 0 1 auto;
    width: 100%;
}

.game-container {
    background-color: #000;
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    color: #FFD700;
    font-size: 48px;
    text-align: center;
    margin: 0;
    padding: 20px 0;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ── Form styles ── */
.form-section {
    margin: 16px 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

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

select, input[type="number"], input[type="text"], textarea {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    padding: 10px 14px;
    font-size: 16px;
    width: 100%;
    outline: none;
}

select:focus, input:focus, textarea:focus {
    border-color: #FFD700;
}

textarea {
    resize: vertical;
    min-height: 140px;
    font-family: Arial, sans-serif;
}

input[type="number"] {
    width: 100px;
}

/* ── Toggle group ── */
.toggle-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    width: fit-content;
}

.toggle-group label {
    padding: 10px 28px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    background: #1a1a1a;
    color: #aaa;
    transition: all 0.2s;
    user-select: none;
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-group label:has(input:checked) {
    background: #FFD700;
    color: #000;
}

/* ── Buttons ── */
.game-button {
    padding: 15px 30px;
    font-size: 20px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    margin: 10px 10px;
    text-transform: uppercase;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.game-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.game-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.game-button.secondary {
    background-color: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: none;
    color: #aaa;
    font-size: 16px;
    padding: 10px 20px;
}

.game-button.secondary:hover {
    border-color: #FFD700;
    color: #FFD700;
    box-shadow: none;
}

.game-button.danger {
    background-color: #c0392b;
    box-shadow: none;
    font-size: 14px;
    padding: 8px 14px;
    margin: 0;
    border-radius: 8px;
}

.game-button.danger:hover {
    background-color: #e74c3c;
    box-shadow: none;
    transform: none;
}

.controls {
    text-align: center;
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* ── Setup screen ── */
#setupScreen .start-btn {
    width: 100%;
    margin: 10px 0 0 0;
    border-radius: 12px;
    font-size: 22px;
    padding: 16px;
}

#setupScreen .copy-link-btn {
    width: 100%;
    margin: 8px 0 0 0;
}

#copyConfirm {
    text-align: center;
    font-size: 13px;
    color: #FFD700;
    min-height: 18px;
    margin-top: 6px;
}

/* ── Manage screen ── */
.list-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.list-entry-info {
    font-size: 16px;
    font-weight: bold;
}

.list-entry-count {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 20px 0;
}

/* ── Game screen ── */
#roundInfo {
    text-align: center;
    font-size: 16px;
    color: #aaa;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 4px 0 0 0;
}

#timer {
    font-size: 72px;
    font-weight: bold;
    color: #FFD700;
    text-align: center;
    margin: 10px 0;
    font-family: 'Impact', sans-serif;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

#timer.urgent {
    color: #ff4444;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}

.item-card {
    background-color: #FFD700;
    color: black;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.item-card.completed {
    background: #e0e0e0;
    text-decoration: line-through;
    opacity: 0.7;
}

.item-card:hover {
    transform: translateY(-2px);
}

/* ── List checkboxes ── */
.list-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s;
}

.list-checkbox-item:has(input:checked) {
    border-color: #FFD700;
}

.list-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #FFD700;
    cursor: pointer;
    /* reset the global input rule */
    padding: 0;
    border: unset;
    border-radius: unset;
    background: unset;
    font-size: unset;
}

.list-checkbox-name {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
}

.list-checkbox-count {
    font-size: 13px;
    color: #888;
}

/* ── Autofill row ── */
.autofill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

#autofillStatus {
    font-size: 13px;
    color: #aaa;
}

.autofill-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 0;
    transition: color 0.2s;
}

.autofill-btn:hover   { color: #FFD700; }
.autofill-btn:disabled { color: #444; cursor: not-allowed; }

/* ── Teams setup ── */
.team-row {
    margin-bottom: 8px;
}

.team-remove {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 16px;
    margin: 0;
    border-radius: 8px;
}

.add-team-btn {
    margin: 4px 0 0 0;
    font-size: 15px;
    padding: 8px 16px;
}

/* ── Game over ── */
.game-over-msg {
    text-align: center;
    padding: 20px 0 10px;
}

.game-over-msg h2 {
    font-size: 36px;
    color: #FFD700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.game-over-msg p {
    color: #aaa;
    font-size: 16px;
    margin-bottom: 20px;
}

.score-table {
    margin: 10px 0 20px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 18px;
}

.score-winner {
    background: #FFD700;
    color: #000;
    font-weight: bold;
    border-color: #FFD700;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 20px;
    background: linear-gradient(to right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.05) 75%,
        rgba(255,255,255,0) 100%);
    font-size: 14px;
    margin-top: auto;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.7);
    backdrop-filter: blur(5px);
    transition: color 0.3s ease;
}

.footer:hover { color: rgba(255,255,255,0.9); }

.footer .heart {
    color: #ff4444;
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255,68,68,0.5);
}

@keyframes heartbeat {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ── Touch device improvements ── */
.game-button,
.item-card,
.list-checkbox-item,
.toggle-group label,
.autofill-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.item-card:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.game-button:active:not(:disabled) {
    transform: scale(0.97);
}

/* ── Logo ── */
.logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 0 4px;
}

.logo-img {
    width: 64px;
    height: 64px;
    image-rendering: auto;
}

.logo-wrap h1 {
    padding: 0;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .main-container { margin: 0; padding: 8px; }
    .game-container { padding: 14px 12px; border-radius: 10px; }

    h1 { font-size: 32px; padding: 8px 0; }

    #timer { font-size: 80px; margin: 4px 0; }

    /* Bigger tap targets for item cards — primary in-game interaction */
    .item-card {
        font-size: 20px;
        padding: 18px 14px;
        margin: 8px 0;
        border-radius: 10px;
    }

    /* Only stack/full-width the main action buttons inside .controls */
    .controls {
        flex-direction: column;
        margin: 8px 0;
    }
    .controls .game-button {
        width: 100%;
        margin: 4px 0;
        font-size: 18px;
        padding: 14px 20px;
        border-radius: 12px;
    }

    /* Setup form */
    .form-section { margin: 12px 0; }
    .toggle-group label { padding: 12px 24px; font-size: 17px; }
    input[type="number"] { width: 90px; font-size: 17px; }

    /* Manage page list entries: stack info and buttons on small screens */
    .list-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Score table */
    .score-row { font-size: 16px; padding: 10px 12px; }
    .game-over-msg h2 { font-size: 28px; }

    /* Round info */
    #roundInfo { font-size: 14px; letter-spacing: 1px; }

    .footer { padding: 14px; font-size: 12px; }
}
