:root {
    --kitten-pink: #FF6B9D;
    --kitten-dark: #C44569;
    --kitten-light: #FFE5EC;
    --explode-orange: #FF9F43;
    --explode-dark: #EE5A24;
    --card-bg: #FFF8F0;
    --card-border: #E8D5C4;
    --text-dark: #2D3436;
    --text-muted: #636E72;
    --success: #00B894;
    --danger: #D63031;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    padding-bottom: 3rem;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Lobby */
.lobby-content {
    text-align: center;
    max-width: 420px;
}

.game-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 0.25rem;
}

.title-icon {
    display: inline-block;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.game-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.setup-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.setup-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: var(--kitten-pink);
}

.player-names {
    margin: 1.5rem 0;
}

.player-name-group {
    margin-bottom: 0.75rem;
}

.player-name-group input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    font-size: 0.95rem;
}

.player-name-group input:focus {
    outline: none;
    border-color: var(--kitten-pink);
}

.btn {
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-block { width: 100%; margin-bottom: 0.5rem; }
.btn-primary {
    background: linear-gradient(135deg, var(--kitten-pink), var(--kitten-dark));
    color: white;
    width: 100%;
    margin-top: 0.5rem;
}
.btn-secondary {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    width: 100%;
}
.btn-ghost {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.8);
    margin-top: 1rem;
}
.mode-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; margin-bottom: 1rem; }
.divider { text-align: center; margin: 1rem 0; color: var(--text-muted); }
.input-code { text-transform: uppercase; letter-spacing: 0.2em; font-size: 1.25rem; text-align: center; }
.party-code-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.party-code { font-size: 2rem; font-weight: 700; letter-spacing: 0.3em; color: var(--kitten-dark); margin: 0.5rem 0; }
.copy-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.room-players-list { list-style: none; margin: 1rem 0; text-align: left; }
.room-players-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--card-border); }
.room-card .btn-primary { margin-top: 1rem; }
.room-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }
.form-group input { width: 100%; padding: 0.75rem 1rem; border: 2px solid var(--card-border); border-radius: 12px; font-size: 1rem; }
.form-group input:focus { outline: none; border-color: var(--kitten-pink); }

.rules-link {
    margin-top: 1.5rem;
}

.rules-link a {
    color: white;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Game Screen */
#game.screen.active {
    display: block;
    padding-top: 1rem;
}

.turn-banner {
    background: linear-gradient(135deg, var(--kitten-pink), var(--kitten-dark));
    color: white;
    text-align: center;
    padding: 0.75rem 1.5rem;
    margin: 0 auto 1rem;
    max-width: 1200px;
    border-radius: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.turn-banner-label {
    opacity: 0.95;
}

.turn-banner-name {
    margin: 0 0.35em;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.eliminated-msg {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--danger);
}

.winner-popup-msg {
    font-size: 1.35rem;
    color: var(--text-dark);
    margin: 0.5rem 0;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    padding: 0 1rem;
}

.btn-icon {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: white;
}

.game-header h2 {
    font-family: 'Fredoka', sans-serif;
    color: white;
    font-size: 1.5rem;
}

.turn-indicator {
    background: rgba(255,255,255,0.95);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    color: var(--kitten-dark);
}

.game-board {
    max-width: 1200px;
    width: calc(100% - 2rem);
    margin: 0 auto;
    background: rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.players-area {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.game-board.local-two-player .players-area {
    display: none;
}
}

.opponent-info {
    text-align: center;
}

.opponent-info.eliminated {
    opacity: 0.65;
    filter: grayscale(0.25);
}

.opponent-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.opponent-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.4rem;
    border: 1px dashed var(--card-border);
    border-radius: 10px;
    background: rgba(255,255,255,0.75);
}

.opponent-cards {
    display: flex;
    gap: 2px;
}

.opponent-card {
    width: 36px;
    height: 50px;
    background: linear-gradient(135deg, var(--kitten-light), #FFD1DC);
    border: 2px solid var(--card-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.center-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
}

.draw-pile {
    cursor: pointer;
}

.card {
    width: 90px;
    height: 126px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem;
    transition: transform 0.2s;
    border: 3px solid var(--card-border);
}

.card:hover:not(.disabled) {
    transform: translateY(-4px);
}

.card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.card.has-image {
    padding: 0;
    background: transparent !important;
    border: none !important;
    color: inherit;
}

.card-img,
.card-img-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.card-small {
    width: 50px;
    height: 70px;
    font-size: 1.2rem;
}

.card.pending {
    cursor: pointer;
}

.card-back {
    background: linear-gradient(145deg, var(--kitten-pink), var(--kitten-dark));
    color: white;
    cursor: pointer;
}

.card-back .pile-count {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.play-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.play-area-label, .discard-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.pending-cards {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 50px;
}

.discard-cards {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-height: 50px;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.play-area-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-ghost-small {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--card-border);
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.opponent-card.clickable {
    cursor: pointer;
    border-color: var(--kitten-pink);
    box-shadow: 0 0 0 2px var(--kitten-pink);
}

.opponent-card.clickable:hover {
    transform: scale(1.05);
}

.discard-pile {
    min-width: 90px;
    min-height: 80px;
    border: 3px dashed var(--card-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.discard-cards .card.clickable {
    cursor: pointer;
    border-color: var(--kitten-pink);
    box-shadow: 0 0 0 2px var(--kitten-pink);
}

.discard-cards .card.clickable:hover {
    transform: scale(1.05);
}

.card-name-small {
    display: block;
    font-size: 0.5rem;
    margin-top: 0.2rem;
    line-height: 1.1;
}

.current-player-area {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--card-border);
}

.current-player-area h3,
.current-player-area .hand-section-label {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* Single hand (default / online / 3+ local): only one section visible */
.hand-sections.single .hand-section {
    display: none;
}
.hand-sections.single .hand-section.active {
    display: block;
}

/* Two hands side by side (local 2-player) */
.hand-sections.two {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    align-items: flex-start;
    width: 100%;
}
.hand-sections.two .hand-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--card-border);
}
.hand-sections.two .hand-section.current-turn {
    border-color: var(--kitten-dark, #C44569);
    box-shadow: 0 0 0 2px rgba(196, 69, 105, 0.3);
}
.hand-sections.two .hand-section .hand {
    justify-content: center;
}
.hand-sections.two .hand-section .hand .card.disabled {
    opacity: 0.85;
}

.hand {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    min-height: 140px;
    margin-bottom: 1rem;
}

.hand .card {
    cursor: pointer;
}

.hand-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-draw {
    background: linear-gradient(135deg, var(--explode-orange), var(--explode-dark));
    color: white;
    padding: 0.75rem 2rem;
}

/* Card types styling */
.card-exploding { background: linear-gradient(145deg, #ff6b6b, #ee5a24); color: white; }
.card-defuse { background: linear-gradient(145deg, #00b894, #00cec9); color: white; }
.card-skip { background: linear-gradient(145deg, #74b9ff, #0984e3); color: white; }
.card-attack { background: linear-gradient(145deg, #fd79a8, #e84393); color: white; }
.card-see-future { background: linear-gradient(145deg, #a29bfe, #6c5ce7); color: white; }
.card-shuffle { background: linear-gradient(145deg, #ffeaa7, #fdcb6e); color: #2d3436; }
.card-nope { background: linear-gradient(145deg, #dfe6e9, #b2bec3); color: #2d3436; }
.card-favor { background: linear-gradient(145deg, #81ecec, #00cec9); color: #2d3436; }
.card-cat { background: linear-gradient(145deg, #fab1a0, #ff7675); color: white; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 1rem;
}

#modal-content .card {
    margin: 0.5rem;
    display: inline-flex;
}

.exploding-reveal-card {
    width: 140px;
    height: 196px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    overflow: hidden;
}

.exploding-reveal-card .card {
    width: 100%;
    height: 100%;
    margin: 0;
}

.exploding-reveal-msg {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0;
    text-align: center;
}

.winner-modal-msg {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin: 0.5rem 0;
}

.winner-modal-sub {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--text-muted, #666);
}

.winner-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.winner-modal-buttons .btn {
    margin-top: 0;
}

.defuse-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.defuse-options .btn {
    margin-top: 0;
}

.favor-notify-msg {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.favor-notify-msg .btn,
#favor-notify-ok {
    margin-top: 0.5rem;
}

.favor-pick-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.favor-pick-cards .favor-pick-card {
    cursor: pointer;
    margin: 0;
}

.favor-pick-cards .favor-pick-card:hover {
    transform: translateY(-2px);
}

.defuse-positions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.alter-future-slots {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    margin: 1rem 0;
    padding: 0.5rem;
}

.alter-future-slot {
    min-width: 90px;
    min-height: 126px;
    border: 2px dashed var(--card-border, #E8D5C4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 240, 0.5);
}

.alter-future-slot .card {
    margin: 0;
    cursor: grab;
}

.alter-future-slot .card:active {
    cursor: grabbing;
}

.alter-future-slot .card.alter-future-dragging {
    opacity: 0.7;
}

.modal .btn {
    margin-top: 1rem;
    width: 100%;
}

.rules-modal {
    max-width: 500px;
}

.rules-content h4 {
    margin: 1rem 0 0.5rem;
}

.rules-content ul {
    margin-left: 1.25rem;
    margin-bottom: 1rem;
}

.rules-content li {
    margin-bottom: 0.5rem;
}

/* Winner */
.winner-content {
    text-align: center;
}

#winner-message {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 0.5rem;
}

.winner-subtitle {
    color: rgba(255,255,255,0.9);
    margin-bottom: 2rem;
}

.winner-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.spectator-msg {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 1rem;
    text-align: center;
}

.opponent-cards.spectator-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
}

.opponent-cards.spectator-cards .card-small {
    width: 48px;
    height: 68px;
    font-size: 0.65rem;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer a:hover {
    text-decoration: underline;
}

.github-link::before {
    content: "🐙 ";
}

/* Responsive */
@media (max-width: 600px) {
    .game-title { font-size: 1.75rem; }
    .card { width: 70px; height: 98px; font-size: 0.7rem; }
    .hand .card { width: 65px; height: 91px; }
    .opponent-card { width: 28px; height: 38px; }
}
