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

html, body { height: 100%; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

h1, h2 { margin-bottom: 15px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }

ul { list-style: none; }
li { margin: 8px 0; }

.btn {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    margin: 5px 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.25);
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(230, 126, 34, 0.4);
}
.btn:active { transform: translateY(0); }
.btn:disabled {
    background: #4a5568;
    cursor: default;
    transform: none;
    box-shadow: none;
}
.btn-sm { padding: 5px 12px; font-size: 0.85rem; }

#game-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

#board-area canvas {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #0d1b2a;
    display: block;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#hand-container {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    padding: 6px;
    min-width: 120px;
}

.hand-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}
.hand-card:last-child { margin-bottom: 0; }
.hand-card.selected {
    background: rgba(243, 156, 18, 0.7);
    border-color: #e67e22;
}
.hand-card.queued {
    background: rgba(44, 110, 73, 0.7);
    border-color: #27ae60;
}
.hand-card.disabled {
    opacity: 0.4;
    cursor: default;
}
.hand-card:not(.disabled):not(.selected):hover {
    background: rgba(255, 255, 255, 0.1);
}

.hand-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.hand-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.hand-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ecf0f1;
}
.hand-sub {
    font-size: 0.7rem;
    color: #7f8c8d;
}
.hand-sub.queued-text {
    color: #2ecc71;
}

#info-panel {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    font-size: 0.85rem;
    line-height: 1.4;
}

#scoreboard {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}
.score-label { color: #7f8c8d; font-size: 0.8rem; }
.score-value { color: #f1c40f; font-weight: bold; font-size: 1rem; }

#opponent-status {
    padding: 4px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}
#opponent-status.disconnected {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
    color: #e74c3c;
}
#opponent-status.reconnected {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.5);
    color: #2ecc71;
}

#help-text { margin-bottom: 8px; }
#turn-info { margin-bottom: 6px; font-weight: bold; }

#unit-info {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    font-size: 0.85rem;
    line-height: 1.6;
}
#unit-info .unit-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 4px;
}
#unit-info .stat-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
#unit-info .stat-label { color: #7f8c8d; }
#unit-info .stat-value { color: #ecf0f1; font-weight: bold; }
#unit-info .deploy-note { color: #f39c12; margin-top: 4px; font-style: italic; }

#scoring-help {
    margin-top: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: 480px;
    overflow-y: auto;
}
#scoring-help strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    color: #ecf0f1;
}
#scoring-help .help-section {
    margin-bottom: 10px;
}
#scoring-help .help-section em {
    color: #f1c40f;
    font-style: normal;
    font-weight: bold;
    font-size: 0.85rem;
}
#scoring-help .help-section p {
    color: #95a5a6;
    margin: 3px 0 0;
}
#scoring-help ul {
    list-style: disc;
    padding-left: 18px;
}
#scoring-help li {
    margin: 2px 0;
    color: #95a5a6;
}
#scoring-help .help-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}
#scoring-help .help-table th,
#scoring-help .help-table td {
    padding: 4px 8px;
    text-align: center;
    color: #95a5a6;
}
#scoring-help .help-table th {
    color: #7f8c8d;
    font-weight: normal;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#scoring-help .help-table td:first-child {
    text-align: left;
    color: #ecf0f1;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    color: #f1c40f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 28px;
    height: 28px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    transition: background 0.15s ease;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.12); }
