/* ===========================================
   Jogar Dominó Online - Styles
   =========================================== */

/* CSS Variables - Theme */
:root {
    /* Background colors */
    --bg-dark: #0a0a1a;
    --bg-medium: #12122a;
    --bg-light: #1a1a3a;
    --bg-card: rgba(26, 26, 58, 0.8);

    /* Accent colors */
    --accent: #ff6b7a;
    --accent-hover: #ff8a97;
    --accent-glow: rgba(255, 107, 122, 0.3);

    /* Secondary accent */
    --secondary: #4a9eff;
    --secondary-hover: #6db3ff;
    --secondary-glow: rgba(74, 158, 255, 0.3);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Status colors */
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(255, 107, 122, 0.3);

    /* Domino piece colors */
    --domino-bg: #f5f5dc;
    --domino-border: #2c2c2c;
    --domino-pip: #1a1a1a;
    --domino-divider: #8b8b7a;
    --domino-selected: rgba(74, 158, 255, 0.5);
    --domino-playable: rgba(74, 222, 128, 0.5);

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-light) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screen Management */
.screen {
    display: none;
    flex: 1;
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: flex;
}

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

/* Container */
.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

/* Typography */
h1 {
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.screen-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

/* Logo Section */
.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 40px;
}

.domino-logo {
    margin-bottom: 20px;
}

.domino-piece.logo-piece {
    width: 80px;
    height: 160px;
    background: var(--domino-bg);
    border: 3px solid var(--domino-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 107, 122, 0.2);
    animation: floatPiece 3s ease-in-out infinite;
}

@keyframes floatPiece {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.domino-half {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    gap: 4px;
}

.domino-half .pip {
    width: 12px;
    height: 12px;
    background: var(--domino-pip);
    border-radius: 50%;
    justify-self: center;
    align-self: center;
    display: none;
}

/* Grid positions for 9 pips (3x3 grid) */
.domino-half .pip:nth-child(1) { grid-area: 1 / 1; }
.domino-half .pip:nth-child(2) { grid-area: 1 / 2; }
.domino-half .pip:nth-child(3) { grid-area: 1 / 3; }
.domino-half .pip:nth-child(4) { grid-area: 2 / 1; }
.domino-half .pip:nth-child(5) { grid-area: 2 / 2; }
.domino-half .pip:nth-child(6) { grid-area: 2 / 3; }
.domino-half .pip:nth-child(7) { grid-area: 3 / 1; }
.domino-half .pip:nth-child(8) { grid-area: 3 / 2; }
.domino-half .pip:nth-child(9) { grid-area: 3 / 3; }

/* Show pips based on value classes */
.domino-half.value-1 .pip:nth-child(5) { display: block; }

.domino-half.value-2 .pip:nth-child(3),
.domino-half.value-2 .pip:nth-child(7) { display: block; }

.domino-half.value-3 .pip:nth-child(3),
.domino-half.value-3 .pip:nth-child(5),
.domino-half.value-3 .pip:nth-child(7) { display: block; }

.domino-half.value-4 .pip:nth-child(1),
.domino-half.value-4 .pip:nth-child(3),
.domino-half.value-4 .pip:nth-child(7),
.domino-half.value-4 .pip:nth-child(9) { display: block; }

.domino-half.value-5 .pip:nth-child(1),
.domino-half.value-5 .pip:nth-child(3),
.domino-half.value-5 .pip:nth-child(5),
.domino-half.value-5 .pip:nth-child(7),
.domino-half.value-5 .pip:nth-child(9) { display: block; }

.domino-half.value-6 .pip:nth-child(1),
.domino-half.value-6 .pip:nth-child(3),
.domino-half.value-6 .pip:nth-child(4),
.domino-half.value-6 .pip:nth-child(6),
.domino-half.value-6 .pip:nth-child(7),
.domino-half.value-6 .pip:nth-child(9) { display: block; }

.domino-divider {
    height: 3px;
    background: var(--domino-divider);
    margin: 0 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #ff8a97 100%);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.3em;
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast);
}

.btn-back:hover {
    color: var(--text-primary);
}

.btn-back span {
    font-size: 1.2em;
}

/* Add space for h2 after back button */
.btn-back ~ h2 {
    margin-top: 30px;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
    margin-top: 24px;
}

/* Menu Links */
.menu-links {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    align-items: center;
}

.link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.link:hover {
    color: var(--accent);
}

.link-divider {
    color: var(--text-muted);
}

/* Player Count Options */
.player-count-options {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-player-count {
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.btn-player-count:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.btn-player-count.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 122, 0.1);
}

.player-count-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.player-count-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Ad Container */
.ad-container {
    width: 100%;
    min-height: 100px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    overflow: hidden;
}

.ad-game {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 60px;
    border-radius: 0;
    margin: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

/* Join Form */
.join-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
    margin-top: 24px;
}

.input-code {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: border-color var(--transition-fast);
}

.input-code:focus {
    outline: none;
    border-color: var(--accent);
}

.input-code::placeholder {
    color: var(--text-muted);
    letter-spacing: 2px;
    font-size: 1rem;
}

/* Lobby */
.lobby-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 0;
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 24px;
}

.loading-spinner.small {
    width: 24px;
    height: 24px;
    border-width: 3px;
    margin-bottom: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.lobby-message {
    color: var(--text-secondary);
    margin-top: 8px;
}

.lobby-players {
    color: var(--secondary);
    font-weight: 600;
    margin-top: 16px;
}

/* Invite Screen */
.invite-info {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.invite-code-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.invite-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.invite-code {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--accent);
}

.invite-link-box {
    display: flex;
    gap: 8px;
}

.invite-link-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.btn-copy {
    padding: 12px 20px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-copy:hover {
    background: var(--secondary-hover);
}

.btn-copy.copied {
    background: var(--success);
}

.players-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.player-slot.filled {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.player-slot-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.player-slot.filled .player-slot-icon {
    background: var(--success);
}

.player-slot-name {
    flex: 1;
    font-weight: 500;
}

.player-slot-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.player-slot.filled .player-slot-status {
    color: var(--success);
}

/* Game Screen */
.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-bottom: 70px; /* Space for ad */
}

.players-bar {
    padding: 8px 12px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

.opponent-slots {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.opponent-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    min-width: 100px;
}

.opponent-card.active-turn {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.opponent-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.opponent-info {
    display: flex;
    flex-direction: column;
}

.opponent-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.opponent-pieces {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Game Board */
.game-board-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
    position: relative;
}

.game-board {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Domino pieces on board */
.board-piece {
    position: absolute;
    transition: left 0.3s ease-out, top 0.3s ease-out;
    transform-origin: center center;
}

/* Animation for new tiles entering from the left */
@keyframes tile-enter-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation for new tiles entering from the right */
@keyframes tile-enter-right {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.board-piece.new-tile-left {
    animation: tile-enter-left 0.3s ease-out;
}

.board-piece.new-tile-right {
    animation: tile-enter-right 0.3s ease-out;
}

/* Animation for new hand tiles (when buying from stock) */
@keyframes hand-tile-enter {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.domino-tile.new-hand-tile {
    animation: hand-tile-enter 0.3s ease-out;
}

/* Board reshuffle fade animation */
@keyframes board-reshuffle {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.game-board.reshuffling {
    animation: board-reshuffle 0.3s ease-out;
}

/* Highlight playable end tiles */
.board-piece.playable-end {
    cursor: pointer;
    z-index: 5;
}

.board-piece.playable-end .domino-tile {
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.8), 0 0 40px rgba(74, 222, 128, 0.4);
    border-color: #4ade80 !important;
}

/* Board pieces use dynamic sizing via CSS custom properties */
.board-piece .domino-tile {
    border-radius: calc(var(--tile-h, 30px) * 0.2);
    border-width: calc(var(--tile-h, 30px) * 0.07);
}

/* Fixed tile sizes - Desktop: 60×30, Mobile: 50×25 */
.board-piece .domino-tile.horizontal {
    width: 60px;
    height: 30px;
}

.board-piece .domino-tile.vertical {
    width: 30px;
    height: 60px;
}

.board-piece .tile-half {
    padding: calc(var(--tile-h, 30px) * 0.1);
    gap: calc(var(--tile-h, 30px) * 0.03);
}

.board-piece .tile-half .pip {
    width: calc(var(--tile-h, 30px) * 0.16);
    height: calc(var(--tile-h, 30px) * 0.16);
}

.board-piece .tile-divider {
    flex-shrink: 0;
}

.board-piece .domino-tile.horizontal .tile-divider {
    width: calc(var(--tile-h, 30px) * 0.07);
    height: 100%;
}

.board-piece .domino-tile.vertical .tile-divider {
    width: 100%;
    height: calc(var(--tile-h, 30px) * 0.07);
}

.domino-tile {
    display: flex;
    background: var(--domino-bg);
    border: 2px solid var(--domino-border);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.domino-tile.horizontal {
    flex-direction: row;
    width: 60px;
    height: 30px;
}

.domino-tile.vertical {
    flex-direction: column;
    width: 30px;
    height: 60px;
}

.domino-tile.selected {
    box-shadow: 0 0 15px var(--domino-selected), var(--shadow-md);
    border-color: var(--secondary);
    transform: scale(1.1);
    z-index: 10;
}

.domino-tile.playable {
    cursor: pointer;
}

.domino-tile.playable:hover {
    box-shadow: 0 0 15px var(--domino-playable), var(--shadow-md);
    transform: scale(1.05);
}

.tile-half {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 3px;
    gap: 1px;
}

.tile-half .pip {
    width: 5px;
    height: 5px;
    background: var(--domino-pip);
    border-radius: 50%;
    justify-self: center;
    align-self: center;
    display: none;
}

/* Grid positions for 9 pips (3x3 grid) */
.tile-half .pip:nth-child(1) { grid-area: 1 / 1; }
.tile-half .pip:nth-child(2) { grid-area: 1 / 2; }
.tile-half .pip:nth-child(3) { grid-area: 1 / 3; }
.tile-half .pip:nth-child(4) { grid-area: 2 / 1; }
.tile-half .pip:nth-child(5) { grid-area: 2 / 2; }
.tile-half .pip:nth-child(6) { grid-area: 2 / 3; }
.tile-half .pip:nth-child(7) { grid-area: 3 / 1; }
.tile-half .pip:nth-child(8) { grid-area: 3 / 2; }
.tile-half .pip:nth-child(9) { grid-area: 3 / 3; }

/* Show pips based on value classes */
.tile-half.value-1 .pip:nth-child(5) { display: block; }

.tile-half.value-2 .pip:nth-child(3),
.tile-half.value-2 .pip:nth-child(7) { display: block; }

.tile-half.value-3 .pip:nth-child(3),
.tile-half.value-3 .pip:nth-child(5),
.tile-half.value-3 .pip:nth-child(7) { display: block; }

.tile-half.value-4 .pip:nth-child(1),
.tile-half.value-4 .pip:nth-child(3),
.tile-half.value-4 .pip:nth-child(7),
.tile-half.value-4 .pip:nth-child(9) { display: block; }

.tile-half.value-5 .pip:nth-child(1),
.tile-half.value-5 .pip:nth-child(3),
.tile-half.value-5 .pip:nth-child(5),
.tile-half.value-5 .pip:nth-child(7),
.tile-half.value-5 .pip:nth-child(9) { display: block; }

.tile-half.value-6 .pip:nth-child(1),
.tile-half.value-6 .pip:nth-child(3),
.tile-half.value-6 .pip:nth-child(4),
.tile-half.value-6 .pip:nth-child(6),
.tile-half.value-6 .pip:nth-child(7),
.tile-half.value-6 .pip:nth-child(9) { display: block; }

/* Fix 6-pip orientation for horizontal tiles - use 2 rows instead of 2 columns */
.domino-tile.horizontal .tile-half.value-6 .pip:nth-child(4),
.domino-tile.horizontal .tile-half.value-6 .pip:nth-child(6) { display: none; }
.domino-tile.horizontal .tile-half.value-6 .pip:nth-child(2),
.domino-tile.horizontal .tile-half.value-6 .pip:nth-child(8) { display: block; }

.tile-divider {
    background: var(--domino-divider);
}

.domino-tile.horizontal .tile-divider {
    width: 2px;
    height: 100%;
}

.domino-tile.vertical .tile-divider {
    width: 100%;
    height: 2px;
}

/* Game Status */
.game-status {
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

#turn-indicator {
    font-weight: 600;
    color: var(--accent);
}

#turn-indicator.waiting {
    color: var(--text-secondary);
}

/* Player Section */
.player-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-subtle);
}

.player-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.player-pieces {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.game-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stock-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stock-indicator .stock-icon {
    font-size: 1rem;
}

.btn-pass, .btn-buy {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-pass {
    background: var(--bg-light);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-pass:hover:not(:disabled) {
    background: var(--warning);
    color: var(--bg-dark);
    border-color: var(--warning);
}

.btn-buy {
    background: var(--secondary);
    border: none;
    color: white;
}

.btn-buy:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-pass:disabled, .btn-buy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Pulse animation for available buttons */
@keyframes button-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.08);
    }
}

.btn-buy.available,
.btn-pass.available {
    animation: button-pulse 1s ease-in-out infinite;
}

/* Player Hand */
.player-hand {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    justify-content: center;
    flex-wrap: wrap;
}

.player-hand .domino-tile {
    flex-shrink: 0;
}

.player-hand .tile-divider {
    flex-shrink: 0;
    min-height: 2px;
    height: 2px;
}

.player-hand .domino-tile:hover:not(.selected) {
    transform: translateY(-4px);
}

/* Hidden pieces indicator */
.hidden-pieces {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Result Screen */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    text-align: center;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

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

.result-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 8px;
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 300px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--accent);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-weight: 500;
    animation: slideUp 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.toast.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 400px) {
    h1 {
        font-size: 2rem;
    }

    .logo-section {
        padding-top: 24px;
    }

    .domino-piece.logo-piece {
        width: 60px;
        height: 120px;
    }

    .domino-half .pip {
        width: 8px;
        height: 8px;
    }

    .btn-large {
        padding: 16px 24px;
        font-size: 1rem;
    }

    .btn-player-count {
        width: 85px;
        height: 85px;
    }

    .player-count-number {
        font-size: 2rem;
    }

    .invite-code {
        font-size: 1.5rem;
    }

    .opponent-card {
        min-width: 80px;
        padding: 6px 10px;
    }

    .opponent-name {
        font-size: 0.75rem;
    }

    .player-hand {
        gap: 6px;
        padding: 10px 12px;
    }

    .domino-tile.horizontal {
        width: 50px;
        height: 25px;
    }

    .domino-tile.vertical {
        width: 25px;
        height: 50px;
    }

    /* Board tiles - fixed mobile size */
    .board-piece .domino-tile.horizontal {
        width: 50px;
        height: 25px;
    }

    .board-piece .domino-tile.vertical {
        width: 25px;
        height: 50px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* End indicators on board */
.board-end-indicator {
    position: absolute;
    padding: 4px 8px;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    z-index: 5;
}

.board-end-indicator:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Blocked game state */
.game-blocked {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--warning);
    text-align: center;
    z-index: 20;
}

.game-blocked h3 {
    color: var(--warning);
    margin-bottom: 8px;
}

.game-blocked p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
