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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #1a1a2e;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: #1a1a2e;
}

.bg-icons {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-icons img {
    position: absolute;
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 12px;
    opacity: 0.08;
}

.container {
    text-align: center;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    width: 95%;
}

h1 {
    margin-bottom: 1rem;
}

h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Main menu cards */
.menu {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.menu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 1rem;
    width: 160px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.menu-card img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #1a1a2e;
}

.menu-card {
    position: relative;
}

.menu-card span {
    font-weight: 600;
}

.delete-card-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(200, 0, 0, 0.8);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.menu-card:hover .delete-card-btn {
    display: flex;
}

.delete-card-btn:hover {
    background: #c00;
}

.card-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.game-hero-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* Game hero banner */
.game-hero {
    width: 100%;
    height: 180px;
    border-radius: 10px;
    margin-bottom: 1.2rem;
    position: relative;
    overflow: hidden;
}

.game-hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(6px) brightness(0.5);
    transform: scale(1.15);
}

.game-hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.game-hero-icon {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 14px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.game-hero-overlay h2 {
    color: #fff;
    margin: 0;
    font-size: 1.3rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Submenu */
.submenu {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.submenu-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    background: #2a7;
    border-radius: 8px;
    padding: 0.8rem 1.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s, background 0.2s;
    min-width: 130px;
}

.submenu-icon {
    margin-right: 0.4rem;
    font-size: 1.1rem;
}

.submenu-card:hover {
    transform: translateY(-2px);
    background: #1f8c5e;
}

.submenu-card.demon-card {
    background: #c33;
}

.submenu-card.demon-card:hover {
    background: #a22;
}

.submenu-card.rlcs-card {
    background: #0b6ec5;
}

.submenu-card.rlcs-card:hover {
    background: #094f8e;
}

/* RLCS hero section */
.rlcs-hero {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: url('/static/rlcs.png') center/cover no-repeat;
    position: relative;
    overflow: hidden;
}

.rlcs-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.rlcs-overlay h2 {
    color: #fff;
    font-size: 1.2rem;
    margin: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.rlcs-logo {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.rlcs-content ul {
    margin: 0.5rem 0 0.8rem 1.5rem;
    line-height: 1.8;
}

.rlcs-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.7rem 1.5rem;
    background: #0b6ec5;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.rlcs-link:hover {
    background: #094f8e;
}

/* Back button */
.back-btn {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f9f9f9;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #eee;
}

/* Content box */
.content-box {
    text-align: left;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
    max-height: 500px;
    overflow-y: auto;
}

.content-box.story p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

/* Tables */
.history-table,
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table td,
.leaderboard-table th,
.leaderboard-table td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.leaderboard-table th {
    background: #f0f0f0;
    font-weight: 700;
}

.history-table td:first-child {
    white-space: nowrap;
    width: 1%;
    padding-right: 1.2rem;
}

.leaderboard-table td:first-child,
.leaderboard-table th:first-child {
    width: 1%;
    text-align: center;
}

/* Demon list info */
.demonlist-info {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.8rem;
}

/* Sort buttons */
.sort-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border: 2px solid #2a7;
    border-radius: 6px;
    background: #fff;
    color: #2a7;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.sort-btn:hover {
    background: #e8f5ee;
}

.sort-btn.active {
    background: #2a7;
    color: #fff;
}

/* Add game section */
.add-game-section {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background: #111;
    border-radius: 10px;
}

.add-game-title {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.add-game-input-wrap {
    display: flex;
    gap: 0.5rem;
}

#game-search {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 2px solid #333;
    border-radius: 6px;
    background: #222;
    color: #fff;
    outline: none;
}

#game-search:focus {
    border-color: #2a7;
}

#game-search-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    background: #2a7;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

#game-search-btn:hover {
    background: #1f8c5e;
}

/* Card add animation */
@keyframes cardPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.menu-card.new-card {
    animation: cardPop 0.5s ease-out forwards;
}

/* Red flash overlay */
#flash-overlay {
    position: fixed;
    inset: 0;
    background: rgba(200, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
}

@keyframes flashRed {
    0%, 100% { opacity: 0; }
    25% { opacity: 1; }
    50% { opacity: 0; }
    75% { opacity: 1; }
}

#flash-overlay.flash {
    animation: flashRed 0.6s ease-out forwards;
}

/* Game screenshots */
.game-screenshots {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.game-screenshot {
    width: 200px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Game stats */
.game-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-card {
    background: #f0f0f0;
    border-radius: 10px;
    padding: 1.2rem 2rem;
    text-align: center;
    min-width: 140px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.3rem;
}

.stat-card.mc-green { background: #e6f9e6; }
.stat-card.mc-green .stat-number { color: #2a7; }
.stat-card.mc-yellow { background: #fff8e1; }
.stat-card.mc-yellow .stat-number { color: #b8860b; }
.stat-card.mc-red { background: #fde8e8; }
.stat-card.mc-red .stat-number { color: #c33; }

#status {
    color: #666;
}

#status.ok {
    color: #2a7;
}

#status.error {
    color: #c33;
}
