/* static/css/games/ownership.css */

/* ── Layout ── */
.ownership-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 5px 16px;
}

/* ── Nickname form ── */
.nickname-form {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 32px 24px;
    max-width: 400px;
    margin: 40px auto;
    text-align: center;
}

.nickname-form h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #e0e0e0;
    font-size: 1.4rem;
}

.nickname-form input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #111;
    color: #eee;
    font-size: 1rem;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.nickname-form button {
    width: 100%;
    padding: 11px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.nickname-form button:hover {
    background: #2980b9;
}

.nickname-form .error-msg {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* ── Color picker ── */
.color-picker {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.color-btn {
    padding: 9px 22px;
    border: 3px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, opacity 0.15s;
    color: #fff;
    min-width: 80px;
}

.color-btn.color-red   { background: #e74c3c; }
.color-btn.color-blue  { background: #3498db; }
.color-btn.color-green { background: #2ecc71; }

.color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

.color-btn:hover {
    opacity: 0.85;
}

/* ── Canvas grid ── */
.canvas-section {
    margin-bottom: 18px;
}

.canvas-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background: #222;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 4px;
}

.cell {
    width: 100%;
    aspect-ratio: 1;
    background: #2a2a3e;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    position: relative;
    min-width: 0;
}

.cell:hover {
    transform: scale(1.08);
    z-index: 1;
}

.cell[data-color="red"]   { background: #e74c3c; }
.cell[data-color="blue"]  { background: #3498db; }
.cell[data-color="green"] { background: #2ecc71; }

/* Mine indicator */
.cell.is-mine::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
}

/* Tooltip */
.cell[data-owner]:hover::before {
    content: attr(data-owner);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

/* ── Stats bar ── */
.stats-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}

.stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-bar .stat-ownership {
    font-weight: 700;
    font-size: 1.2rem;
}

.fill-bar-wrap {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.fill-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ── Status message ── */
.status-msg {
    text-align: center;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 10px;
    min-height: 1.2em;
}

.status-msg.error   { color: #e74c3c; }
.status-msg.success { color: #2ecc71; }

/* ── Leaderboard ── */
.ownership-leaderboard {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

.ownership-leaderboard h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #ccc;
    text-align: center;
}

.ownership-leaderboard table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ownership-leaderboard th {
    text-align: left;
    padding: 6px 8px;
    color: #777;
    border-bottom: 1px solid #333;
    font-weight: 600;
}

.ownership-leaderboard td {
    padding: 6px 8px;
    color: #ddd;
    border-bottom: 1px solid #2a2a3e;
}

.ownership-leaderboard tr:last-child td {
    border-bottom: none;
}

.ownership-leaderboard tr.is-me td {
    color: #2ecc71;
    font-weight: 600;
}

.rank-1 { color: #f1c40f; font-weight: 700; }
.rank-2 { color: #95a5a6; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

/* ── Canvas archived (grid modifier) ── */
.canvas-grid.canvas-archived {
    border-color: #2ecc71;
    opacity: 0.92;
}

.canvas-grid.canvas-archived .cell {
    cursor: default;
}

.canvas-grid.canvas-archived .cell:hover {
    transform: none;
}

/* ── Ownership Records ── */
.ownership-records {
    margin-bottom: 36px;
}

.ownership-records-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 4px;
    border-bottom: 2px solid #3a3a5a;
    padding-bottom: 8px;
}

.ownership-records-sub {
    font-size: 0.8rem;
    color: #666;
    margin: 0 0 14px;
}

.ownership-records-empty {
    color: #555;
    font-size: 0.85rem;
    margin: 10px 0;
}

.ownership-records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ownership-records-table th {
    text-align: left;
    padding: 8px 10px;
    color: #888;
    border-bottom: 1px solid #3a3a5a;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ownership-records-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #22223a;
}

.ownership-records-table tr:last-child td {
    border-bottom: none;
}

.rec-rank {
    color: #555;
    width: 32px;
    font-size: 0.8rem;
}

.rec-player {
    font-weight: 600;
}

.rec-cells {
    font-variant-numeric: tabular-nums;
}

.rec-games {
    color: #666;
    font-size: 0.82rem;
}

/* ── Archive list table ── */
.ownership-archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 10px;
}

.ownership-archive-table th {
    text-align: left;
    padding: 8px 10px;
    color: #777;
    border-bottom: 1px solid #333;
    font-weight: 600;
}

.ownership-archive-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #2a2a3e;
}

.ownership-archive-table tr:last-child td {
    border-bottom: none;
}

/* ── Archive nav button ── */
.btn-ownership-nav {
    display: inline-block;
    padding: 6px 16px;
    background: #1e3a5f;
    color: #7ec8f7;
    border: 1px solid #2e6da0;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-ownership-nav:hover {
    background: #2a4f7a;
    color: #aad8ff;
}

/* ── Banner claim form ── */
.banner-claim-form {
    background: #edf0f8;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.banner-claim-label {
    font-size: 0.82rem;
    color: #888;
    margin: 0 0 10px;
}

.banner-claim-form input[type="text"],
.banner-claim-form input[type="url"] {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #dcdcf5;
    border: 1px solid #333;
    border-radius: 6px;
    color: #141414;
    font-size: 0.88rem;
    box-sizing: border-box;
}

.banner-claim-form button {
    padding: 7px 20px;
    background: #1e3a5f;
    color: #7ec8f7;
    border: 1px solid #2e6da0;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.banner-claim-form button:hover {
    background: #2a4f7a;
}

.banner-pending {
    font-size: 0.82rem;
    color: #ff0000;
    text-align: center;
    margin-bottom: 16px;
}

/* ── Champion notice ── */
.champion-notice {
    background: linear-gradient(135deg, #1a1600 0%, #1a1a00 100%);
    border: 2px solid #f1c40f;
    border-radius: 10px;
    padding: 14px 20px;
    margin: 0 0 16px;
    text-align: center;
    color: #f1c40f;
    font-size: 0.95rem;
    line-height: 1.6;
}

.champion-notice strong {
    color: #fff;
}

.champion-notice a {
    display: inline-block;
    margin-top: 8px;
    color: #f1c40f;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #f1c40f;
    padding: 5px 16px;
    border-radius: 6px;
    transition: background 0.2s;
}

.champion-notice a:hover {
    background: rgba(241, 196, 15, 0.15);
}

.champion-notice-gold {
    background: linear-gradient(135deg, #1a1000, #2d1f00);
    border-color: #d4af37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
    color: #d4af37;
}
.champion-notice-gold strong {
    color: #f4d03f;
}
.champion-notice-gold a {
    color: #d4af37;
    border-color: #d4af37;
}

.champion-crown {
    font-size: 1.6rem;
    display: block;
    margin-bottom: 4px;
}

.lb-crown {
    font-size: 0.85rem;
    margin-left: 3px;
}

/* ── Responsive 480px ── */
@media (max-width: 480px) {
    .ownership-wrap {
        padding: 2px 2px;
    }

    .nickname-form {
        padding: 20px 12px;
        margin: 20px auto;
    }

    .canvas-grid {
        gap: 1px;
        padding: 2px;
    }

    .color-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
        min-width: 64px;
    }

    .stats-bar {
        font-size: 0.8rem;
        gap: 8px;
    }

    .ownership-leaderboard {
        padding: 10px 8px;
    }

    .ownership-leaderboard table {
        font-size: 0.78rem;
    }

    .ownership-archive-table {
        font-size: 0.78rem;
    }

    .ownership-archive-table th,
    .ownership-archive-table td {
        padding: 6px 6px;
    }

    .ownership-records-table {
        font-size: 0.78rem;
    }

    .ownership-records-table th,
    .ownership-records-table td {
        padding: 6px 6px;
    }

    .btn-ownership-nav {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .banner-claim-form {
        padding: 10px 12px;
    }

    .champion-notice {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}
