/* ============================================================
   style.css — Dota 2 Turbo Analyzer — Dark Theme
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-primary: #1a1c23;
    --bg-secondary: #21242b;
    --bg-card: #282b33;
    --bg-card-hover: #2f323b;
    --bg-input: #1e2028;
    --border-color: #3a3d45;
    --border-focus: #4a90d9;
    --text-primary: #e0e0e0;
    --text-secondary: #9098a8;
    --text-muted: #606878;
    --color-win: #4caf50;
    --color-win-bg: rgba(76, 175, 80, 0.08);
    --color-loss: #f44336;
    --color-loss-bg: rgba(244, 67, 54, 0.08);
    --color-gold: #ffd700;
    --color-blue: #4a90d9;
    --color-turbo: #e67e22;
    --color-warning: #ff9800;
    --color-error: #f44336;
    --max-width: 1200px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-blue);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Header --- */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.site-title .logo-icon {
    font-size: 1.4rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sidebar toggle button (hidden on desktop) */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--border-radius-sm);
    line-height: 1;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,0.08);
}
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: block;
    }
}

/* --- Rate Limit Indicator --- */
.rate-indicator {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.rate-ok {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.rate-warn {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
}

.rate-danger {
    background: rgba(244, 67, 54, 0.15);
    color: #e57373;
}

/* --- Search Section --- */
.search-section {
    max-width: var(--max-width);
    margin: 40px auto 0;
    padding: 0 20px;
    text-align: center;
    transition: margin 0.3s;
}

.search-section.has-data {
    margin-top: 24px;
    margin-bottom: 24px;
}

.search-section h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.search-section .subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.search-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.search-input.input-error {
    border-color: var(--color-error);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.input-error-msg {
    display: block;
    font-size: 0.8rem;
    color: var(--color-error);
    text-align: left;
    margin-top: 4px;
    margin-left: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-search {
    background: var(--color-turbo);
    color: #fff;
}

.btn-search:hover {
    background: #d35400;
}

.btn-retry {
    background: var(--border-color);
    color: var(--text-primary);
    margin-top: 12px;
}

.btn-retry:hover {
    background: #4a4d55;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
}

.help-text code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

/* --- Dashboard --- */
.dashboard {
    display: none;
    max-width: var(--max-width);
    margin: 0 auto 60px;
    padding: 0 20px;
}

.dashboard.loaded {
    display: block;
}

/* --- Section Cards --- */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 18px;
    background: var(--color-turbo);
    border-radius: 2px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

/* --- Player Profile --- */
.player-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.profile-avatar.avatar-text {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, #3a3d45, #4a4d55);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.profile-link {
    font-size: 0.85rem;
}

.profile-rank {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.rank-icon {
    width: 48px;
    height: 48px;
}

.rank-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gold);
}

.leaderboard-rank {
    font-size: 0.85rem;
    background: var(--color-gold);
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
}

/* --- Summary Grid --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: background 0.2s;
}

.summary-card:hover {
    background: var(--bg-card-hover);
}

.card-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.card-value.win {
    color: var(--color-win);
}

.card-value.loss {
    color: var(--color-loss);
}

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

/* --- Chart Grid --- */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- Data Tables --- */
.table-wrapper,
.matches-table-wrapper,
.hero-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: auto;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
    font-size: 0.875rem;
}

.data-table th.sortable {
    cursor: pointer;
    transition: color 0.15s;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    font-size: 0.875rem;
}

.hero-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-icon-sm {
    width: 32px;
    height: 18px;
    border-radius: 2px;
    object-fit: cover;
}

.hero-icon-fallback {
    display: none;
    width: 32px;
    height: 18px;
    border-radius: 2px;
    background: #3a3d45;
    color: #9098a8;
    font-size: 0.65rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Show fallback when image fails — the image gets display:none via onerror */
.hero-cell img[style*="display: none"] + .hero-icon-fallback,
.hero-cell img[src=""] + .hero-icon-fallback {
    display: flex;
}

/* --- Match Rows --- */
.match-row {
    transition: background 0.15s;
}

.match-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.match-win {
    background: var(--color-win-bg);
}

.match-loss {
    background: var(--color-loss-bg);
}

.match-win:hover {
    background: rgba(76, 175, 80, 0.14);
}

.match-loss:hover {
    background: rgba(244, 67, 54, 0.14);
}

.result-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-win {
    background: rgba(76, 175, 80, 0.2);
    color: var(--color-win);
}

.badge-loss {
    background: rgba(244, 67, 54, 0.2);
    color: var(--color-loss);
}

.col-link a {
    font-size: 0.75rem;
    margin-right: 6px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.col-link a:hover {
    opacity: 1;
}

.db-link {
    color: var(--color-gold);
}

/* --- Hero Table --- */
.hero-row {
    cursor: pointer;
    transition: background 0.15s;
}

.hero-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.hero-row.selected {
    background: rgba(74, 144, 217, 0.1);
}

.wr-good { color: var(--color-win); }
.wr-avg { color: var(--text-secondary); }
.wr-bad { color: var(--color-loss); }

.hero-count,
.match-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

/* --- States: Loading, Error, Empty --- */
.state-loading,
.state-error,
.state-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.state-error-dashboard {
    padding: 60px 20px;
}

.state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.state-text {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.state-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.8;
    margin-top: 8px;
}

.state-sub {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.mode-list {
    list-style: none;
    text-align: left;
    margin-top: 8px;
}

.mode-list li {
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-turbo);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.dashboard-loading {
    margin-top: 20px;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.site-footer a {
    color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .app-layout {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        height: 100dvh;
        z-index: 200;
        background: var(--bg-secondary);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 1px solid var(--border-color);
        box-shadow: 2px 0 12px rgba(0,0,0,0.3);
        overflow-y: auto;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }

    /* Overlay behind sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 199;
    }

    .sidebar-overlay.open {
        display: block;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 10px 14px;
    }

    .site-title {
        font-size: 0.9rem;
        gap: 4px;
    }

    .site-title .logo-icon {
        font-size: 1.1rem;
    }

    .header-right {
        gap: 8px;
    }

    .search-section {
        margin-top: 20px;
        padding: 0 14px;
    }

    .search-section h2 {
        font-size: 1.15rem;
    }

    .search-section .subtitle {
        font-size: 0.8rem;
        margin-bottom: 14px;
    }

    .search-form {
        flex-direction: row;
        gap: 8px;
    }

    .btn-search {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .help-text {
        font-size: 0.7rem;
    }

    .help-text br {
        display: none;
    }

    .dashboard {
        padding: 0 10px;
    }

    .section {
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    /* Summary */
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .summary-card {
        padding: 12px 8px;
    }

    .card-icon {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .card-value {
        font-size: 1.15rem;
    }

    .card-label {
        font-size: 0.7rem;
    }

    /* Player profile */
    .player-profile {
        padding: 16px;
        gap: 14px;
        flex-wrap: wrap;
    }

    .profile-avatar {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }

    .profile-name {
        font-size: 1.1rem;
    }

    .profile-meta {
        font-size: 0.75rem;
        gap: 8px;
    }

    .profile-rank .rank-name {
        font-size: 0.85rem;
    }

    /* Sleep card */
    .sleep-card {
        padding: 16px;
    }

    .sleep-header {
        margin-bottom: 12px;
    }

    .sleep-title {
        font-size: 1rem;
    }

    .sleep-body {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        margin-bottom: 14px;
    }

    .sleep-score-ring {
        width: 90px;
        height: 90px;
    }

    .sleep-score-num {
        font-size: 1.5rem;
    }

    .sleep-message {
        padding: 12px 14px;
    }

    .sleep-message p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .sleep-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding-top: 12px;
    }

    .detail-value {
        font-size: 0.85rem;
    }

    /* Session advice */
    .session-advice {
        padding: 12px 14px;
        gap: 10px;
        margin-bottom: 16px;
    }

    .advice-emoji {
        font-size: 1.6rem;
    }

    .advice-message {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    /* Chart containers */
    .chart-container {
        height: 220px;
    }

    /* Tables */
    .data-table {
        font-size: 0.78rem;
    }
    .data-table th,
    .data-table td {
        font-size: 0.78rem;
        padding: 7px 8px;
    }

    .hero-icon-sm {
        width: 24px;
        height: 14px;
    }

    .hero-count,
    .match-count {
        font-size: 0.7rem;
    }

    /* Hide less important columns on mobile */
    .matches-table .col-xpm,
    .matches-table .col-hero-dmg {
        display: none;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 0.85rem;
    }

    .search-section {
        margin-top: 14px;
    }

    .search-section h2 {
        font-size: 1.05rem;
    }

    .search-form {
        flex-direction: column;
        gap: 6px;
    }

    .btn-search {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .summary-card {
        padding: 10px 6px;
    }

    .card-value {
        font-size: 1.05rem;
    }

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

    .profile-avatar {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .profile-name {
        font-size: 1rem;
    }

    .data-table {
        font-size: 0.72rem;
    }
    .data-table th,
    .data-table td {
        font-size: 0.72rem;
        padding: 5px 6px;
    }

    .hero-icon-sm {
        width: 20px;
        height: 12px;
    }

    .hero-cell span {
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Hide more columns on very small screens */
    .matches-table .col-gpm,
    .matches-table .col-duration {
        display: none;
    }

    .hero-table .col-gpm,
    .hero-table .col-xpm {
        display: none;
    }

    .sleep-details {
        grid-template-columns: 1fr 1fr;
    }

    .session-advice {
        flex-direction: column;
        text-align: center;
    }

    .sleep-body {
        flex-direction: column;
    }

    .chart-container {
        height: 180px;
    }

    .site-footer {
        font-size: 0.65rem;
        padding: 14px 10px;
    }
}

/* ============================================================
   App Layout — Sidebar + Main (desktop only)
   ============================================================ */

@media (min-width: 1025px) {
    .app-layout {
        display: grid;
        grid-template-columns: 240px 1fr;
        max-width: var(--max-width);
        margin: 0 auto;
        min-height: calc(100vh - 180px);
    }

    .sidebar {
        background: var(--bg-secondary);
        border-right: 1px solid var(--border-color);
        padding: 20px 16px;
        position: sticky;
        top: 48px;
        height: calc(100vh - 48px);
        overflow-y: auto;
    }

    .main-content {
        min-width: 0;
    }
}

/* ============================================================
   Player List Panel
   ============================================================ */

.player-list-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.player-list-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    transition: color 0.15s;
}

.collapsible-header:hover {
    color: var(--text-secondary);
}

.collapse-arrow {
    display: inline-block;
    font-size: 0.7rem;
    margin-right: 4px;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.collapse-arrow.open {
    transform: rotate(-90deg);
}

.collapsible-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
}

.collapsible-body.open {
    max-height: 600px;
    opacity: 1;
}

.note-input {
    max-width: 100px;
    font-size: 0.7rem;
}

.player-item-display {
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-card);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85rem;
}

.player-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.player-item.my-player {
    border-color: var(--color-blue);
    background: rgba(74, 144, 217, 0.1);
}

.player-item.no-player {
    cursor: default;
    background: transparent;
    border: 1px dashed var(--border-color);
}

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

.player-item-id {
    font-family: monospace;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.player-item-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
}

.player-item-badge.me {
    background: rgba(74, 144, 217, 0.2);
    color: var(--color-blue);
}

.enemy-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.enemy-item {
    border-color: transparent;
    background: rgba(244, 67, 54, 0.04);
}

.enemy-item:hover {
    border-color: rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.08);
}

.enemy-item.active {
    border-color: var(--color-loss);
    background: rgba(244, 67, 54, 0.12);
}

.btn-remove-enemy {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.15s;
    opacity: 0;
}

.enemy-item:hover .btn-remove-enemy {
    opacity: 1;
}

.btn-remove-enemy:hover {
    color: var(--color-loss);
    background: rgba(244, 67, 54, 0.15);
}

.btn-add-enemy {
    background: rgba(244, 67, 54, 0.15);
    border: 1px dashed rgba(244, 67, 54, 0.3);
    color: var(--color-loss);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}

.btn-add-enemy:hover {
    background: rgba(244, 67, 54, 0.25);
}

.player-list-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-sm:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-set-my {
    flex: 1;
    border-color: var(--color-blue);
    color: var(--color-blue);
}

.btn-set-my:hover {
    background: rgba(74, 144, 217, 0.15);
}

.btn-refresh {
    flex-shrink: 0;
}

.player-id-input-row {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.player-id-input {
    flex: 1;
    padding: 5px 8px;
    font-size: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
    font-family: monospace;
    min-width: 0;
}

.player-id-input:focus {
    border-color: var(--border-focus);
}

.player-id-input::placeholder {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.btn-set-my {
    padding: 5px 10px;
    font-size: 0.7rem;
    white-space: nowrap;
    background: rgba(74, 144, 217, 0.15);
    border: 1px solid rgba(74, 144, 217, 0.3);
    color: var(--color-blue);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-set-my:hover {
    background: rgba(74, 144, 217, 0.25);
}

.btn-add-enemy-inline {
    padding: 5px 10px;
    font-size: 0.7rem;
    white-space: nowrap;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.25);
    color: var(--color-loss);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-add-enemy-inline:hover {
    background: rgba(244, 67, 54, 0.2);
}

/* ============================================================
   Sleep Evaluation Card
   ============================================================ */

.sleep-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.sleep-card-self {
    border-top: 3px solid var(--color-blue);
}

.sleep-card-enemy {
    border-top: 3px solid var(--color-loss);
}

.sleep-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sleep-icon {
    font-size: 2rem;
}

.sleep-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.sleep-body {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 20px;
}

/* SVG Ring */
.sleep-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.sleep-ring-svg {
    width: 100%;
    height: 100%;
}

.sleep-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 6;
}

.sleep-ring-fg {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.sleep-score-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sleep-score-num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.sleep-score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Message */
.sleep-message {
    flex: 1;
    padding: 16px 20px;
    border-left: 3px solid;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.sleep-message p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Details */
.sleep-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sleep-detail-item {
    text-align: center;
}

.detail-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.detail-value {
    font-size: 1rem;
    font-weight: 700;
}

.detail-value.win { color: var(--color-win); }
.detail-value.loss { color: var(--color-loss); }

/* ============================================================
   Enemy View Dashboard
   ============================================================ */

.dashboard.enemy-view {
    /* subtle red tint */
    --player-accent: var(--color-loss);
}

.dashboard.enemy-view .player-profile {
    border-color: rgba(244, 67, 54, 0.3);
}

/* ============================================================
   Current Session Advice Banner
   ============================================================ */

.session-advice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    animation: adviceIn 0.5s ease;
}

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

.session-advice.advice-win {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.05));
    border: 1px solid rgba(76, 175, 80, 0.25);
}

.session-advice.advice-loss {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.12), rgba(255, 152, 0, 0.04));
    border: 1px solid rgba(255, 152, 0, 0.25);
}

.session-advice.advice-enemy {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.12), rgba(244, 67, 54, 0.04));
    border: 1px solid rgba(244, 67, 54, 0.25);
}

.advice-emoji {
    font-size: 2.2rem;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

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

.advice-content {
    flex: 1;
    min-width: 0;
}

.advice-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.advice-message {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
}

/* ============================================================
   Patch Filter
   ============================================================ */

.patch-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 8px;
}

.patch-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.patch-select {
    padding: 5px 10px;
    font-size: 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.patch-select:focus {
    border-color: var(--border-focus);
}

