* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}

#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    transform: translate(-50%, -50%);
    object-fit: contain;
    filter: brightness(0.75);
}

#bg-static-img {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -100;
    background-image: url('/static/image/main-page-background.webp');, url('image/static-background.jpg');
    background-size: cover;
    background-position: center;
    filter: brightness(0.5);
}

.container {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 2rem;
    width: 95%;
    max-width: 1100px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    max-height: 90vh;
    overflow-y: auto;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.6rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

.tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-bottom-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.triple-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sub-label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #334155;
    background: rgba(30, 41, 59, 0.8);
    color: white;
    font-size: 1rem;
}

input:focus, select:focus {
    outline: 2px solid #38bdf8;
}

.btn-add {
    width: 100%;
    padding: 0.8rem;
    background: #0284c7;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add:hover {
    background: #0369a1;
}

.roster-section {
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.6rem 0.6rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    color: #94a3b8;
    font-size: 0.85rem;
}

.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.btn-top-control {
    background: rgba(15, 23, 42, 0.8);
    color: #38bdf8;
    border: 1px solid #38bdf8;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.btn-top-control:hover {
    background: #38bdf8;
    color: #0f172a;
}

.highlight-val {
    color: #38bdf8;
    font-weight: bold;
    font-size: 1.1rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container span {
    font-size: 0.85rem;
    color: #94a3b8;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 10px #38bdf8;
    transition: transform 0.1s ease-in-out;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.gaia-badge {
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid #38bdf8;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: #38bdf8;
    white-space: nowrap;
    display: inline-block;
}

.auto-help-cell {
    text-align: center;
}

.auto-help-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    background-color: #22c55e;
    border-radius: 50%;
    font-size: 0.85rem;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.action-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-lock {
    background: #22c55e;
    border: none;
    color: #0f172a;
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-lock:hover {
    background: #16a34a;
}

.btn-lock.active {
    background: #15803d;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

tr.locked-row {
    background: rgba(34, 197, 94, 0.15);
}

tr.locked-row td {
    border-bottom: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-edit {
    background: #eab308;
    border: none;
    color: #0f172a;
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-edit:hover {
    opacity: 0.85;
}

.btn-delete {
    background: #ef4444;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-delete:hover {
    opacity: 0.85;
}

.btn-cancel {
    width: 100%;
    margin-top: 8px;
    padding: 0.6rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    font-weight: bold;
    cursor: pointer;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.4);
}

.status-banner {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.status-banner.pass {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #4ade80;
}

.status-banner.fail {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #f87171;
}

.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-tyrant { background: #eab308; color: #0f172a; }
.badge-leader { background: #38bdf8; color: #0f172a; }
.badge-joiner { background: #22c55e; color: #0f172a; }
.badge-gatherer { background: #9333ea; color: #ffffff; }
.badge-patrol { background: #d97706; color: #ffffff; }
.badge-reserve { background: #eab308; border: 1px solid #ca8a04; color: #0f172a; }
.badge-nonparticipant { background: rgba(100, 116, 139, 0.2); border: 1px solid #64748b; color: #94a3b8; }

.tyrant-row {
    background: rgba(234, 179, 8, 0.2) !important;
}

.status-locked {
    color: #22c55e;
    font-size: 0.85rem;
    font-weight: bold;
}

.roster-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1rem;
}

.roster-header h2 {
    font-size: 1.25rem;
    color: #e2e8f0;
    margin: 0;
}

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

.btn-random {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid #a855f7;
    color: #c084fc;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-random:hover {
    background: #a855f7;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.btn-clear-all {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #f87171;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-all:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.tyrant-showcase-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tyrant-video-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    border: 2px solid #38bdf8;
    border-bottom: none;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.tyrant-video-card video {
    width: 100%;
    display: block;
    object-fit: cover;
}

.tyrant-overlay-name {
    position: absolute;
    top: 42.0%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    background: transparent;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px #38bdf8;
    letter-spacing: 0.5px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tyrant-stats-card {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(10, 30, 60, 0.95) 100%);
    border: 2px solid #38bdf8;
    border-radius: 0 0 12px 12px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
    box-sizing: border-box;
}

.tyrant-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #eab308;
    color: #facc15;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
}

.tyrant-stats-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 0.5rem;
}

.tyrant-stat-item {
    background: rgba(15, 23, 42, 0.7);
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #cbd5e1;
    font-size: 0.9rem;
}

.tyrant-stat-item strong {
    color: #38bdf8;
    font-weight: 700;
}

.map-container {
    position: relative;
    width: 100%;
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #38bdf8;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

#strategy-map-img {
    width: 100%;
    display: block;
    height: auto;
}

#strategy-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}