/* ─── Variables (ACTotal Theme) ─── */
:root {
    --bg: #050506;
    --surface: #111827;
    --surface-light: #1f2937;
    --surface-hover: #374151;
    --accent: #00A7E1;
    --accent-glow: rgba(0, 167, 225, 0.35);
    --accent-soft: rgba(0, 167, 225, 0.15);
    --text: #ffffff;
    --text-dim: #9ca3af;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --radius: 20px;
    --radius-sm: 12px;
}

/* ─── Base Reset ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* ─── Layout ─── */
.app-view {
    display: none;
    flex-direction: column;
    min-height: 100dvh;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.app-view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Header ─── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #007bb5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .08);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all .2s;
}

.btn-icon:hover {
    background: var(--surface-light);
    color: var(--text);
}

/* ─── Setup View ─── */
.setup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.setup-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.setup-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.counter-control {
    display: flex;
    align-items: center;
    background: var(--surface-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.btn-counter {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-counter:active {
    background: rgba(255, 255, 255, 0.1);
}

.counter-control input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.names-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for names grid */
.names-grid::-webkit-scrollbar {
    width: 6px;
}

.names-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.names-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.names-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.name-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.name-input:focus {
    border-color: var(--accent);
}

.name-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for category grid */
.category-grid::-webkit-scrollbar {
    width: 6px;
}

.category-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.category-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.category-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.category-label {
    display: inline-flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem 0.8rem;
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.category-label:hover {
    background: var(--surface-hover);
}

.category-label:has(input:checked) {
    border-color: var(--accent);
    background: rgba(0, 167, 225, 0.1);
}

.category-label input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    margin: 0 10px 0 0;
    border: 2px solid var(--text-dim);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.category-label span {
    flex: 1;
    text-align: left;
    white-space: normal;
    overflow: visible;
    min-width: 0;
    line-height: 1.1;
}

.category-label input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.category-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: #fff;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* ─── Buttons ─── */
.btn-primary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #007bb5);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 1rem;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-large {
    padding: 1.2rem;
    font-size: 1.2rem;
    border-radius: var(--radius);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: none;
}

.btn-vote {
    width: 100%;
    padding: 1.2rem;
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-vote:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.winner-success {
    color: var(--accent) !important;
}

.winner-danger {
    color: var(--danger) !important;
}

/* ─── Pass / Reveal Views ─── */
.pass-content,
.reveal-content,
.game-content,
.results-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    gap: 2rem;
}

.turn-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}

.turn-subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
}

.lock-icon {
    font-size: 5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ─── Role Card ─── */
.role-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.role-card.is-impostor {
    background: linear-gradient(180deg, var(--surface), rgba(239, 68, 68, 0.1));
    border-color: rgba(239, 68, 68, 0.3);
}

.role-badge {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.role-card.is-impostor .role-badge {
    background: var(--danger-soft);
    color: var(--danger);
}

.role-word {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: #fff;
}

.role-hint-label {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-card.is-impostor .role-hint-label {
    color: var(--danger);
}

.role-desc {
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1.4;
    max-width: 80%;
    margin: 0 auto;
}

.warning-text {
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: var(--danger-soft);
    border-radius: var(--radius-sm);
}

.hidden {
    display: none !important;
}

/* ─── Game / Results Views ─── */
.pulse-icon {
    font-size: 5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.action-buttons {
    width: 100%;
}

.impostor-reveal,
.word-reveal {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    width: 100%;
}

.impostor-reveal {
    border-left: 4px solid var(--danger);
}

.word-reveal {
    border-left: 4px solid var(--accent);
}

.reveal-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.impostor-name {
    font-size: 2rem;
    color: var(--danger);
    font-weight: 800;
}

.secret-word {
    font-size: 1.8rem;
    color: #fff;
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: auto;
    padding-top: 2rem;
    padding-bottom: 0.5rem;
    line-height: 1.5;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}