/* HexWords Board Styles - Adapted from RedQueen hex chess */

.hex-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    user-select: none;
    background: #2d4a6f;
    padding: 10px;
    border-radius: 10px;
}

.hex-row {
    display: flex;
    margin: -8px 0;
    position: relative;
    justify-content: center;
}

.hex-cell {
    width: 70px;
    height: 80px;
    margin: 0 3px;
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #2d4a6f;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.hex-content {
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    margin: 1px;
    position: relative;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hex Cell Colors - Amber/yellow tiles */
.hex-cell.hex-red .hex-content,
.hex-cell.hex-blue .hex-content,
.hex-cell.hex-green .hex-content {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
}

/* Letter Display - black on beige (matching hexlandia) */
.hex-letter {
    font-size: 28px;
    font-weight: bold;
    color: #1f2937;
    text-transform: uppercase;
    z-index: 2;
}

.hex-letter.qu {
    font-size: 20px;
}

/* Hover State */
.hex-cell:hover {
    transform: scale(1.08);
    z-index: 10;
}

.hex-cell:hover .hex-content {
    filter: brightness(1.1);
}

/* Selected State - Currently in word path */
.hex-cell.selected {
    transform: scale(1.12);
    z-index: 20;
}

.hex-cell.selected .hex-content {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.6);
}

.hex-cell.selected .hex-letter {
    color: white;
}

/* Valid Neighbor - Can select next */
.hex-cell.valid-neighbor .hex-content {
    animation: pulse-neighbor 1s infinite;
}

@keyframes pulse-neighbor {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

/* Path Order Number */
.hex-cell.selected::after {
    content: attr(data-order);
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

/* Used in current word (can't reuse) */
.hex-cell.used {
    opacity: 0.5;
    pointer-events: none;
}

/* Invalid word flash */
.hex-cell.invalid {
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Word submission feedback */
.word-feedback {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    z-index: 1000;
    animation: feedbackSlide 1.5s ease forwards;
}

.word-feedback.valid {
    background: rgba(46, 204, 113, 0.95);
    color: white;
}

.word-feedback.invalid {
    background: rgba(231, 76, 60, 0.95);
    color: white;
}

.word-feedback.duplicate {
    background: rgba(241, 196, 15, 0.95);
    color: #333;
}

@keyframes feedbackSlide {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Game UI Elements */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
}

.timer {
    font-size: 32px;
    font-weight: bold;
    font-family: monospace;
}

.timer.warning {
    color: #f1c40f;
    animation: pulse 1s infinite;
}

.timer.danger {
    color: #e74c3c;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.score-display {
    font-size: 24px;
}

.current-word {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 60px;
}

.word-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    border: 3px solid #667eea;
    border-radius: 25px;
    outline: none;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.word-input:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.3);
}

.word-input::placeholder {
    color: #aaa;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
}

.current-word-text {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #333;
}

.current-word-text.empty {
    color: #999;
    font-size: 16px;
}

.current-word-text.invalid-path {
    color: #e74c3c;
    font-size: 18px;
}

/* Word List */
.word-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border-radius: 5px;
    border-left: 4px solid #2ecc71;
}

.word-item.first-finder {
    border-left-color: #f39c12;
    background: linear-gradient(90deg, rgba(243, 156, 18, 0.1), white);
}

.word-item.first-finder .star {
    color: #f39c12;
    margin-right: 4px;
}

.word-item .word {
    font-weight: bold;
    text-transform: uppercase;
}

.word-item .points {
    color: #2ecc71;
    font-weight: bold;
}

.word-item.first-finder .points {
    color: #f39c12;
}

.word-feedback.first-finder {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

/* Controls */
.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.btn-submit {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.btn-submit:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-clear {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-rotate {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-rotate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
}

/* Responsive */
@media (max-width: 600px) {
    .hex-cell {
        width: 44px;
        height: 50px;
    }

    .hex-letter {
        font-size: 20px;
    }

    .hex-letter.qu {
        font-size: 16px;
    }

    .timer {
        font-size: 24px;
    }

    .current-word-text {
        font-size: 22px;
    }
}

/* Chat Styles */
.chat-container {
    background: #f8f9fa;
    border-radius: 10px;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
}

.chat-message .sender {
    font-weight: bold;
    color: #667eea;
}

.chat-message .text {
    color: #333;
}

.chat-message .time {
    font-size: 11px;
    color: #999;
}

.chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-right: 10px;
}

.chat-input button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    width: 350px;
    padding: 20px;
    background: linear-gradient(135deg, #ffd700, #f39c12);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    z-index: 2000;
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-notification.show {
    right: 20px;
}

.achievement-icon {
    font-size: 48px;
    margin-right: 15px;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    color: #8b6914;
    margin-bottom: 4px;
}

.achievement-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 12px;
    color: #666;
}

/* Leaderboard */
.leaderboard {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin: 4px 0;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.leaderboard-row.current-user {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1), #f8f9fa);
    border-left-color: #2ecc71;
    font-weight: bold;
}

.leaderboard-row .rank {
    width: 30px;
    font-weight: bold;
    text-align: center;
}

.leaderboard-row .name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-row .score {
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
    text-align: right;
}

/* Rating change display */
.rating-change {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
}

.rating-change.positive {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}

.rating-change.negative {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.rating-change.neutral {
    background: rgba(149, 165, 166, 0.15);
    color: #7f8c8d;
}

/* Clickable player names */
.player-link {
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
}

.player-link:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

/* Player dropdown menu */
.player-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
}

.player-menu-header {
    padding: 10px 12px;
    font-weight: bold;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    color: #333;
}

.player-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s ease;
}

.player-menu-item:hover {
    background: #667eea;
    color: white;
}

.player-menu-item span {
    font-size: 14px;
}
