:root {
    --primary: #FF9F1C;
    --secondary: #2EC4B6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --spacing: 2vmin;
    --radius: 3vmin;
}

/* Size Safety Overlay */
#size-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    /* Controlled by JS */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.warning-box {
    background: #1e293b;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 159, 28, 0.3);
    border: 2px solid var(--primary);
    max-width: 400px;
}

.warning-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 20px;
}

#size-warning h2 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 28px;
}

#size-warning p {
    color: #94a3b8;
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    font-family: 'Comic Neue', sans-serif;
    color: var(--text);
    overflow-x: hidden;
}

#app-root {
    min-height: 100vh;
    /* Fallback */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 5vmin;
    max-width: 1400px;
    margin: 0 auto;
}

#main-header {
    text-align: center;
    margin-bottom: 6vmin;
}

#main-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 8vmin;
    margin: 0;
    background: linear-gradient(135deg, #FF9F1C, #FF6B35);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 800;
}

#main-header p {
    font-size: 3vmin;
    color: var(--text-muted);
    margin-top: 1vmin;
}

#dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4vmin;
    flex: 1;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5vmin;
    /* Reduced from 4vmin */
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 2vmin;
    /* Reduced from 4vmin */
    border: 1px solid var(--border);
    box-shadow: 0 1vmin 3vmin rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.category-card.active {
    border-color: var(--primary);
    cursor: pointer;
}

.category-card.active:hover {
    transform: translateY(-0.8vmin) scale(1.02);
    box-shadow: 0 3vmin 6vmin rgba(255, 159, 28, 0.15);
}

.category-card.disabled {
    opacity: 0.6;
    filter: grayscale(0.8);
    background: #f1f5f9;
    border-style: dashed;
}

.card-icon {
    font-size: 8vmin;
    /* Reduced from 10vmin */
    filter: drop-shadow(0 0.5vmin 1vmin rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}

.card-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(20px, 4vmin, 36px);
    /* Slightly smaller max/min */
    margin: 0;
    line-height: 1.1;
    color: var(--text);
    overflow-wrap: normal;
    /* Allow natural break if needed */
    white-space: nowrap;
    /* Tries to keep in one line */
}

.card-content p {
    font-size: clamp(14px, 2.3vmin, 20px);
    color: var(--text-muted);
    margin: 0.5vmin 0 0 0;
}

/* --- STATUS BADGE (Updated to +67% size) --- */
.status-badge {
    position: absolute;
    top: 2vmin;
    right: 2vmin;
    background: var(--primary);
    color: white;
    font-size: 3vmin;
    /* 1.8 * 1.67 */
    padding: 0.8vmin 2.5vmin;
    /* 0.5 * 1.67 */
    border-radius: 8.5vmin;
    /* 5 * 1.67 */
    font-weight: bold;
    z-index: 2;
    /* Increased z-index to stay above links if needed */
}

/* --- INSTRUCTION BADGE (Global) --- */
.instruction-badge {
    position: absolute;
    top: 2vmin;
    left: 2vmin;
    background: var(--secondary);
    color: white;
    font-size: 3vmin;
    /* 1.8 * 1.67 */
    padding: 0.8vmin 2.5vmin;
    /* 0.5 * 1.67 */
    border-radius: 8.5vmin;
    /* 5 * 1.67 */
    font-weight: bold;
    z-index: 10;
    cursor: pointer;
    box-shadow: 0 0.5vmin 1vmin rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.instruction-badge:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* --- MODAL STYLES (Global) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 15px;
    background: var(--bg-color);
}

.btn-modal {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-cancel {
    background: #e2e8f0;
    color: var(--text);
}

.btn-action {
    background: var(--primary);
    color: white;
}

.btn-modal:active {
    opacity: 0.8;
    transform: scale(0.98);
}

footer {
    text-align: center;
    padding-top: 6vmin;
    color: var(--text-muted);
    font-size: 2vmin;
}

/* --- RATIO SPECIFICS --- */

.layout-portrait #dashboard-grid {
    grid-template-columns: 1fr;
}

.layout-portrait #main-header h1 {
    font-size: 12vmin;
}

.layout-portrait .card-icon {
    font-size: 14vmin;
}

.layout-portrait .card-content h2 {
    font-size: 7vmin;
}

.layout-portrait .card-content p {
    font-size: 4vmin;
}

.layout-compact #dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
}

.layout-wide #dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
}