/* ============================================================
   DESIGN SYSTEM - SAAS CRUCIVERBA MEDICI (Redstone Style UI)
   ============================================================ */

:root {
    --bg-main: #141414;
    --bg-surface: #1e1e1e;
    --bg-card: #27272a;
    --bg-card-header: #3f3f46;
    
    --primary: #0288d1;
    --primary-hover: #0277bd;
    --secondary: #00e5ff;
    --accent-yellow: #fbc02d;
    --accent-red: #e53935;
    --accent-green: #4caf50;
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --border-color: #333333;
    --border-card: #3f3f46;
    --shadow-3d: 0 6px 0px #09090b;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header / Topbar --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: #1a1a1a;
    border-bottom: 2px solid #2a2a2a;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffffff;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-red);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-remove-ads {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(229, 57, 53, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-remove-ads:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(229, 57, 53, 0.6);
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
}

.btn-icon:hover {
    background: #333;
}

/* --- Filter & Category Bar (Redstone Packs Bar) --- */
.filter-container {
    background-color: #222225;
    padding: 12px 20px;
    border-bottom: 1px solid #2d2d30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn {
    padding: 8px 20px;
    background: #2e2e32;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.tab-btn.active {
    background: #3a3a40;
    color: #ffffff;
    border-bottom: 3px solid var(--secondary);
}

.filter-dropdowns {
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-filter {
    background: #2a2a2e;
    color: #ffffff;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* --- Grid of Level Cards (Redstone 3D Card List) --- */
.main-content {
    flex: 1;
    padding: 25px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.card-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-3d);
    border: 1px solid var(--border-card);
    position: relative;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 0px #09090b;
}

.card-item.locked {
    opacity: 0.8;
}

.badge-new {
    position: absolute;
    top: -5px;
    right: 15px;
    background: #e91e63;
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 4px 10px;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    z-index: 2;
}

.card-header-bg {
    background: #333338;
    padding: 15px;
    border-bottom: 2px solid #222;
    text-align: center;
}

.card-title {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.card-puzzles-count {
    background: #3a3a40;
    color: #e0e0e0;
    padding: 6px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.card-difficulty {
    padding: 6px;
    font-size: 13px;
    font-weight: 800;
    background: #ffffff;
    color: #111111;
    border-radius: var(--radius-sm);
}

.card-difficulty.cat-anatomia { background: #81c784; color: #000000; }
.card-difficulty.cat-patologia { background: #ffb74d; color: #000000; }
.card-difficulty.cat-farmacologia { background: #e57373; color: #ffffff; }
.card-difficulty.cat-procedure { background: #64b5f6; color: #000000; }
.card-difficulty.cat-sintomi { background: #ba68c8; color: #ffffff; }

.card-footer {
    background: #1e1e22;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.card-size-icon {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- PLAY PAGE (Interactive Game UI) --- */
.play-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: #181818;
}

.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #111111;
    border-bottom: 1px solid #2a2a2a;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.timer-box {
    background: #252528;
    padding: 4px 10px;
    border-radius: 4px;
    color: #ffffff;
    font-family: monospace;
    font-size: 15px;
}

.circle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #555;
    background: #252528;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
}

.circle-btn:hover {
    background: #38383c;
    transform: scale(1.08);
}

.hint-target-btn {
    border-color: #00e5ff;
    background: #102a3a;
}

/* --- Hint Menu Popup (Redstone Target Icon Menu) --- */
.hint-menu-popup {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: #222226;
    border: 2px solid #00e5ff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: 12px;
    width: 280px;
}

.hint-menu-popup.active {
    display: flex;
    transform: translateX(-50%) scale(1);
}

.hint-menu-header {
    font-size: 15px;
    font-weight: 900;
    color: #00e5ff;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
}

.hint-menu-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hint-menu-title {
    font-size: 11px;
    font-weight: 800;
    color: #aaaaaa;
    letter-spacing: 1px;
}

.game-canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 15px;
    position: relative;
}

.crossword-grid {
    display: grid;
    background-color: #000000;
    border: 2px solid #000000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    user-select: none;
}

.crossword-cell {
    width: 32px;
    height: 32px;
    background-color: #ffffff;
    border: 1px solid #444444;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
    color: #000000;
    cursor: pointer;
}

.crossword-cell.black {
    background-color: #000000;
    cursor: default;
}

.crossword-cell .cell-num {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 9px;
    font-weight: normal;
    color: #222;
}

.crossword-cell.active-word {
    background-color: #b3e5fc !important;
}

.crossword-cell.active-cell {
    background-color: #fff59d !important;
    outline: 3px solid var(--accent-yellow);
    z-index: 2;
}

.crossword-cell.cell-correct {
    background-color: #c8e6c9 !important;
    border-color: #2e7d32 !important;
}
.crossword-cell.cell-correct .cell-user-letter {
    color: #1b5e20 !important;
    font-weight: 900;
}

.crossword-cell.cell-wrong {
    background-color: #ffcdd2 !important;
    border-color: #c62828 !important;
}
.crossword-cell.cell-wrong .cell-user-letter {
    color: #b71c1c !important;
    font-weight: 900;
}

/* --- Center Clue Box (Redstone Clue Box UI) --- */
.clue-nav-container {
    padding: 10px 20px;
    background: #222226;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.nav-arrow {
    background: #333338;
    border: 1px solid #444;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

.nav-arrow:hover {
    background: #44444d;
}

.clue-text-display {
    flex: 1;
    background: #18181c;
    border: 2px solid #00e5ff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Reveal & Error Buttons (Redstone Action Controls) --- */
.action-controls-bar {
    background: #1a1a1c;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.action-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.action-column-title {
    font-size: 14px;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    text-align: center;
}

.btn-action {
    background: #ffffff;
    color: #111111;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 0 #cccccc;
}

.btn-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #cccccc;
}

/* --- Virtual Keyboard (Mobile & Web) --- */
.virtual-keyboard {
    background: #252528;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key-btn {
    flex: 1;
    max-width: 44px;
    height: 42px;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 0 #999;
}

.key-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #999;
}

/* --- Modal Paywall --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #ffffff;
    color: #111111;
    width: 90%;
    max-width: 420px;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

.modal-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 12px;
}

.modal-desc {
    font-size: 14px;
    color: #555555;
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn-buy {
    width: 100%;
    padding: 14px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-buy:hover {
    background: #0077b3;
}

.btn-cancel {
    background: transparent;
    border: 2px solid #ccc;
    color: #333;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
