/* =========================================
   GLOBAL VARIABLES & BASE STYLES
   ========================================= */
:root {
    --aalto-red: #ff0000;
    --dark-bg: #121212;
    --card-bg: #1e1e1e;
    --text-color: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

h1 { 
    color: var(--aalto-red); 
    margin-bottom: 5px; 
}

p { 
    opacity: 0.7; 
    font-size: 0.9rem; 
}

/* =========================================
   FRONT PAGE STYLES
   ========================================= */
/* --- Modified Aalto Branding Header Wrapper --- */
header {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    max-width: 500px;
    margin-bottom: 35px;
    padding-top: 10px;
}

.aalto-logo-box {
    display: flex;
    flex-direction: column;
    text-transform: uppercase;
    font-weight: 900;
    line-height: 0.95;
    font-size: 1.8rem;
    letter-spacing: -1px;
    padding-left: 15px; /* Moved padding to left */
    text-align: left;
    /* Fllipped vertical line from right to left! */
    border-left: 8px solid var(--aalto-red); 
}

.logo-line {
    display: block;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    grid-auto-rows: 1fr;
    gap: 15px;
    width: 100%;
    max-width: 500px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 15px; /* Slightly adjusted padding to make room for bottom elements */
    text-align: center;
    text-decoration: none;
    color: white;
    border: 1px solid #333;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes tags to top and languages to bottom */
    align-items: center;
    aspect-ratio: 1 / 1;
    position: relative; /* Context anchor for absolute tags */
}

.card:active {
    transform: scale(0.95);
    border-color: var(--aalto-red);
}

.card i,
.card .card-icon {
    height: 40px;
    width: auto;
    font-size: 2.2rem;
    line-height: 40px;
    margin: 0 auto 10px auto;
    display: block;
    font-style:normal;
    object-fit: contain;
}

.card span { 
    font-weight: bold; 
    font-size: 1.1rem; 
}

.status-tag {
    font-size: 0.7rem;
    background: var(--aalto-red);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 10px;
    display: inline-block;
}

/* --- New Card Structural Fixes & Language Badges --- */
.card-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 4px;
    margin-top: auto; /* Push above language row cleanly */
}

.lang-tags {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
    width: 100%;
}

.lang-tag {
    background: #2d2d2d;
    color: #b3b3b3;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 100px;
    border: 1px solid #3d3d3d;
    text-transform: uppercase;
}

/* Modifying status tags so they absolute-snap over image assets cleanly */
.status-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 3px 6px;
    border-radius: 4px;
    margin: 0;
    display: inline-block;
}

/* =========================================
   RUUSU GAME STYLES
   ========================================= */
#table {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 20px auto;
    border-radius: 50%;
    background: radial-gradient(circle, #2a2a2a 0%, #121212 100%);
    overflow: visible; /* Allows transformed cards to exceed the radius slightly */
}

#table::before {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border-radius: 50%;
    background: url('rose_symbol.png') no-repeat center;
    background-size: contain;
    opacity: 0.15;
    pointer-events: none; 
}

.card-btn {
    position: absolute;
    color: transparent; 
    border: none;
    border-radius: 4px;
    width: 60px;
    height: 85px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    transform-origin: 50% 50%;
    background-image: url('ruusu_card.png');
    background-size: 100% 100%; 
    background-position: center;
    background-color: transparent; 
}

.card-btn:active { transform: scale(0.9); }

.card-btn:disabled { 
    opacity: 0.55; 
    cursor: not-allowed; 
}


#deck-btn {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    z-index: 10;
    
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.5),
        -2px 2px 0 1px #333,
        -4px 4px 0 1px #1a1a1a;
}

.petal { transform: translate(-50%, -50%); }

#petal-0 { top: 10%; left: 50%; transform: translate(-50%, -50%) rotate(0deg); }
#petal-1 { top: 21%; left: 78%; transform: translate(-50%, -50%) rotate(45deg); }
#petal-2 { top: 50%; left: 90%; transform: translate(-50%, -50%) rotate(90deg); }
#petal-3 { top: 79%; left: 78%; transform: translate(-50%, -50%) rotate(135deg); }
#petal-4 { top: 90%; left: 50%; transform: translate(-50%, -50%) rotate(180deg); }
#petal-5 { top: 79%; left: 22%; transform: translate(-50%, -50%) rotate(225deg); }
#petal-6 { top: 50%; left: 10%; transform: translate(-50%, -50%) rotate(270deg); }
#petal-7 { top: 21%; left: 22%; transform: translate(-50%, -50%) rotate(315deg); }

#dashboard {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
    min-height: 150px;
}

.multiplier { 
    color: var(--aalto-red); 
    font-weight: bold; 
    font-size: 1.5rem; 
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.pop-anim {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: inline-block; /* Required for the transform to work */
}

.mult-2x {
    color: #ff4444; /* Bright Red */
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8);
}

.mult-4x {
    color: #ffeb3b; /* Yellow */
    text-shadow: 0 0 15px rgba(255, 235, 59, 0.8);
}

.mult-8x {
    color: #d500f9; /* Purple */
    text-shadow: 0 0 20px rgba(213, 0, 249, 1);
}

.card-display { 
    font-size: 2rem; 
    margin: 10px 0; 
}

.red-suit { color: red; }
.black-suit { 
    color: black; 
    text-shadow: 1px 1px 2px white; 
}
/* --- Header Flex Layout & Patch Notes Button --- */
header.aalto-branding-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-bottom: 30px;
}

.patch-btn {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
}

.patch-btn:active {
    transform: scale(0.95);
    background: #333;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background-color: var(--aalto-red);
    border-radius: 50%;
    display: inline-block;
}

/* --- Patch Notes Modal Styling --- */
.patch-modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    background: transparent;
    max-width: 90vw;
    width: 380px;
}

.patch-modal::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg, #1e1e1e);
    color: #fff;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--aalto-red);
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-body {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.5;
}

.version-tag {
    display: inline-block;
    background: #2a2a2a;
    color: #bbb;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: bold;
}

.modal-body ul {
    margin: 0;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

.btn-primary {
    background: var(--aalto-red);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
}

.btn-primary:active {
    opacity: 0.85;
}