@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Cairo:wght@400;700;900&family=Almarai:wght@300;400;700;800&family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary-bg: #f8fafc;
    --emerald-deep: #064e3b;
    --emerald-mid: #059669;
    --emerald-light: #10b981;
    --gold: #d4af37;
    --gold-bright: #fbbf24;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-heavy: rgba(255, 255, 255, 0.9);
    --border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Almarai', 'Cairo', sans-serif;
    background: var(--primary-bg);
    color: #1e293b;
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
}

#app-container {
    background: radial-gradient(circle at top right, #ecfdf5, transparent),
                radial-gradient(circle at bottom left, #fff7ed, transparent);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Redesign */
header {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-section h1 {
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn-header {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 700;
    color: var(--emerald-deep);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.btn-header:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--emerald-deep);
    color: white;
}

/* Home Section Layout */
#view-home {
    padding: 2rem 5%;
}

.hero-dashboard {
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald-mid));
    border-radius: 24px;
    padding: 2.5rem;
    color: white;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-dashboard::after {
    content: '👑';
    position: absolute;
    left: -20px;
    bottom: -20px;
    font-size: 10rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

.hero-content h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-family: 'Cairo', sans-serif;
}

.progress-overview {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold-bright);
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Unit Cards Carousel/Grid */
.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.unit-card {
    background: var(--glass-heavy);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.unit-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--emerald-light);
}

.unit-card .unit-badge {
    position: absolute;
    top: -15px;
    right: 20px;
    background: var(--gold);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.4);
}

.unit-card h3 {
    font-size: 1.6rem;
    color: var(--emerald-deep);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1rem;
}

.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lesson-item {
    background: white;
    padding: 12px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #f1f5f9;
}

.lesson-item:hover {
    background: #f0fdf4;
    border-color: var(--emerald-light);
    transform: scale(1.02);
}

.lesson-item.completed {
    background: #f0fdf4;
    border-right: 4px solid var(--emerald-mid);
}

.lesson-item .lesson-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lesson-item .status-icon {
    font-size: 1.2rem;
    color: #cbd5e1;
}

.lesson-item.completed .status-icon {
    color: var(--emerald-mid);
}

/* Achievements Sidebar */
#achievements-sidebar {
    position: fixed;
    top: 0;
    left: -400px;
    width: 350px;
    height: 100vh;
    background: var(--glass-heavy);
    backdrop-filter: blur(20px);
    z-index: 2000;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem;
    overflow-y: auto;
}

#achievements-sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.badge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.badge-item {
    background: white;
    padding: 15px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0.4;
    filter: grayscale(1);
    transition: all 0.4s ease;
}

.badge-item.unlocked {
    opacity: 1;
    filter: grayscale(0);
    border: 2px solid var(--gold);
    background: linear-gradient(to bottom, #fff, #fefce8);
}

.badge-item .badge-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Lesson Active View */
.lesson-card {
    background: white;
    border-radius: 32px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 0 auto;
}

.tabs-container {
    display: flex;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 18px;
    margin-bottom: 2rem;
    gap: 5px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    font-size: 1.1rem;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: var(--emerald-deep);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 2.2rem;
    color: var(--emerald-deep);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(to left, var(--emerald-light), transparent);
}

/* Animations */
.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    #achievements-sidebar {
        width: 100%;
        left: -100%;
    }
    .hero-dashboard h2 { font-size: 1.6rem; }
    .units-grid { grid-template-columns: 1fr; }
}

.audio-hint {
    text-align: center;
    color: var(--emerald-deep);
    font-size: 1.1rem;
    margin-bottom: 20px;
    background: rgba(46, 125, 50, 0.05);
    padding: 10px;
    border-radius: 30px;
    display: inline-block;
    width: auto;
    border: 1px dashed var(--emerald-mid);
    padding: 10px 25px;
}

/* Hadith Audio Styles */
.hadith-actions {
    margin-bottom: 15px;
    text-align: left;
}

.hadith-play-btn {
    background: var(--gold);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.2);
}

.hadith-play-btn:hover {
    background: #c5a021;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.3);
}

.hadith-play-btn i {
    font-size: 1.4rem;
}

.audio-hint i {
    font-size: 0.8rem;
}

/* Global Font Enhancements */
.surah-text {
    font-family: 'Amiri', serif;
    font-size: 2.2rem;
    line-height: 1.8;
    text-align: center;
    color: var(--emerald-deep);
    background: rgba(255, 255, 255, 0.5);
    padding: 2rem;
    border-radius: 20px;
    margin: 1rem 0;
}

.verse-item {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 10px;
    display: inline-block;
}

.verse-item:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald-mid);
}

.verse-item.active {
    background: var(--emerald-mid);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.prose-p {
    font-size: 1.4rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: #334155;
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.2s;
}

.prose-p:hover {
    background: #f1f5f9;
}

.vocab-card .word {
    font-size: 1.5rem;
    font-weight: 800;
}

.vocab-card .meaning {
    font-size: 1.25rem;
}

/* Word Ordering Game */
.game-container {
    background: white;
    padding: 30px;
    border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-top: 30px;
    text-align: center;
    border: 2px solid var(--gold);
    animation: slideUp 0.5s ease;
}

.game-title {
    color: var(--emerald-deep);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.8rem;
}

.drop-zone {
    min-height: 120px;
    border: 3px dashed var(--gold-light);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    background: rgba(212, 175, 55, 0.05);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    align-items: center;
}

.shuffled-zone {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.word-brick {
    background: white;
    border: 2px solid var(--emerald-mid);
    color: var(--emerald-deep);
    padding: 12px 25px;
    border-radius: 12px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    user-select: none;
    font-family: 'Amiri', serif;
}

.word-brick:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.2);
    border-color: var(--gold);
}

.word-brick:active {
    transform: scale(0.95);
}

.word-brick.placed {
    background: var(--emerald-mid);
    color: white;
    border-color: var(--emerald-deep);
}

.game-actions {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.game-btn {
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
}

.btn-check {
    background: var(--gold);
    color: white;
}

.btn-reset {
    background: #e2e8f0;
    color: #475569;
}

.game-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.success-card {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 400px;
    border: 5px solid var(--gold);
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.game-trigger-btn {
    background: var(--emerald-light);
    color: var(--emerald-deep);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
    transition: all 0.2s;
}

.game-trigger-btn:hover {
    background: var(--gold-light);
    transform: scale(1.05);
}

.hadith-actions {
    display: flex;
    gap: 15px;
}

/* Vocabulary Table */
.vocab-container {
    margin-top: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 2px solid var(--gold-light);
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Amiri', serif;
}

.vocab-table th {
    background: linear-gradient(135deg, var(--emerald-deep), var(--emerald-mid));
    color: white;
    padding: 15px;
    font-size: 1.4rem;
    text-align: right;
}

.vocab-table td {
    padding: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--emerald-deep);
}

.vocab-table tr:last-child td {
    border-bottom: none;
}

.vocab-table tr:nth-child(even) {
    background-color: rgba(212, 175, 55, 0.03);
}

.vocab-table .word-cell {
    font-weight: bold;
    color: var(--emerald-mid);
    border-left: 4px solid var(--gold);
    width: 30%;
}

/* Enhanced Memory Game */
.memory-card {
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease, visibility 0.5s;
    cursor: pointer;
}

.memory-card.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.5);
}

.card-front {
    background: linear-gradient(135deg, var(--gold), #c5a021);
    color: white;
    font-size: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.card-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/arabesque.png');
    opacity: 0.2;
}

.card-back {
    background: white;
    color: var(--emerald-deep);
    transform: rotateY(180deg);
    border: 4px solid var(--gold);
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.1);
}

.memory-grid {
    perspective: 1500px;
}

/* Memory Game (تطابق النور) */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    perspective: 1000px;
    margin-bottom: 30px;
}

.memory-card {
    height: 150px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card.matched {
    transform: rotateY(180deg) scale(0.9);
    opacity: 0.7;
    cursor: default;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    font-weight: bold;
}

.card-front {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: white;
    font-size: 2rem;
}

.card-back {
    background: white;
    color: var(--emerald-deep);
    transform: rotateY(180deg);
    border: 3px solid var(--gold);
    font-size: 1.1rem;
    line-height: 1.4;
}

/* Sorting Game (طريق الصلاح) */
.sorting-bins {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    margin-top: 30px;
}

.sort-bin {
    flex: 1;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.8);
    border: 3px dashed var(--emerald-light);
    border-radius: 25px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sort-bin.hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--emerald-mid);
    transform: scale(1.02);
}

.bin-title {
    font-weight: bold;
    color: var(--emerald-deep);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.sort-item {
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    border: 2px solid var(--gold);
    color: var(--emerald-deep);
    cursor: grab;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    font-size: 1.3rem;
    max-width: 300px;
    margin: 10px auto;
    animation: slideUp 0.3s ease;
}

.sort-item:active {
    cursor: grabbing;
}

.success-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--gold);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* --- Premium Themes & Backgrounds --- */
body {
    transition: background 1s ease, color 0.5s ease;
    background-attachment: fixed;
}

body.theme-quran {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
}
body.theme-quran::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    pointer-events: none;
    z-index: -1;
}

body.theme-hadith {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}
body.theme-hadith::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://www.transparenttextures.com/patterns/arabesque.png');
    opacity: 0.1;
    pointer-events: none;
    z-index: -1;
}

body.theme-nature {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

/* --- Smooth Transitions --- */
.animate-view-change {
    animation: slideInFade 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

/* --- Renal's Room --- */
.room-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    min-height: 80vh;
}

.room-display {
    border-radius: 30px;
    border: 8px solid var(--gold);
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    background: #f1f5f9;
    height: 600px;
    perspective: 1200px; /* Essential for 3D effect */
}

/* --- Isometric Room Anatomy --- */
.room-scene {
    position: absolute;
    top: 50%; left: 50%;
    transform-style: preserve-3d;
    transform: translate(-50%, -45%);
    width: 600px; height: 400px;
}

.room-floor {
    position: absolute;
    bottom: 0; width: 100%; height: 300px;
    background: linear-gradient(45deg, #78350f 25%, #92400e 25%, #92400e 50%, #78350f 50%, #78350f 75%, #92400e 75%, #92400e 100%);
    background-size: 40px 40px;
    transform: rotateX(65deg);
    transform-origin: bottom;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.room-wall-back {
    position: absolute;
    top: 0; width: 100%; height: 350px;
    background: #f8fafc;
    border-bottom: 5px solid #e2e8f0;
    box-shadow: inset 0 -50px 100px rgba(0,0,0,0.05);
}

.room-window {
    position: absolute;
    top: 50px; left: 50%;
    transform: translateX(-50%);
    width: 250px; height: 180px;
    background: #38bdf8;
    border: 10px solid white;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.4), inset 0 0 50px rgba(0,0,0,0.1);
    overflow: hidden;
}

.window-nature {
    width: 100%; height: 100%;
    background: linear-gradient(to bottom, #7dd3fc, #ecfdf5);
    position: relative;
    animation: windowGlow 10s infinite;
}

@keyframes windowGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.room-display.dark-mode {
    background: #0f172a;
}
.room-display.dark-mode .room-wall-back { background: #1e293b; }
.room-display.dark-mode .room-floor { filter: brightness(0.4); }
.room-display.dark-mode .room-window { background: #1e3a8a; }
.room-display.dark-mode .window-nature { background: linear-gradient(to bottom, #1e3a8a, #0f172a); }

/* --- Items & Labels Fix --- */
.avatar-placeholder {
    font-size: 8rem;
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.3));
}

.placed-item {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: bottom center;
}

.item-visual {
    font-size: 5rem; /* The icon size */
    transition: transform 0.3s;
}

.item-shadow {
    width: 60px; height: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    margin-top: -10px;
    filter: blur(5px);
}

.item-label {
    font-size: 0.9rem !important; /* Force small size */
    background: rgba(255,255,255,0.9);
    color: var(--emerald-deep);
    padding: 2px 12px;
    border-radius: 20px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--gold);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    white-space: nowrap;
    pointer-events: none;
}

.placed-item:hover .item-label {
    opacity: 1;
}

.placed-item:active .item-visual {
    cursor: grabbing;
    transform: scale(1.1);
}

/* Floor Item Logic */
.placed-item.floor-mode .item-visual {
    transform: rotateX(60deg);
}

/* --- Luxury Shop Drawer --- */
.room-display {
    border-radius: 30px;
    border: 8px solid var(--gold);
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    background: #f1f5f9;
    height: 600px;
    perspective: 1200px;
}

.shop-trigger-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--emerald-deep);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    border: 3px solid var(--gold);
    font-weight: bold;
    cursor: pointer;
    z-index: 500;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shop-trigger-btn:hover {
    transform: scale(1.05);
    background: var(--gold);
}

.shop-drawer {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    max-height: 450px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 2000;
    transition: bottom 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    border-top: 5px solid var(--gold);
    border-radius: 30px 30px 0 0;
    padding: 20px;
    box-shadow: 0 -20px 40px rgba(0,0,0,0.2);
    overflow-y: auto;
}

.shop-drawer.open {
    bottom: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--emerald-light);
    padding-bottom: 10px;
}

.drawer-header h3 {
    margin: 0;
    color: var(--emerald-deep);
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    padding-bottom: 20px;
}

.shop-card {
    background: white;
    border: 2px solid #eee;
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.shop-card:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.shop-card.owned {
    background: #f8fafc;
    border-color: var(--emerald-mid);
}

.shop-icon {
    font-size: 3rem;
    margin-bottom: 5px;
}

.shop-info strong {
    display: block;
    font-size: 0.95rem;
    color: var(--emerald-deep);
}

.shop-info p {
    margin: 5px 0;
    color: var(--gold);
    font-weight: bold;
}

.buy-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: none;
    background: var(--emerald-mid);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.buy-btn:disabled {
    background: #cbd5e1;
    cursor: default;
}

.buy-btn:hover:not(:disabled) {
    background: var(--gold);
}

/* --- Certificates --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.certificate-container {
    background: white;
    width: 95%;
    max-width: 800px;
    min-height: 500px;
    height: auto;
    padding: 50px;
    border: 15px double var(--gold);
    position: relative;
    background-image: radial-gradient(circle at 100% 100%, rgba(212,175,55,0.05) 0%, transparent 40%);
    text-align: center;
    box-shadow: 0 30px 70px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.cert-header {
    border-bottom: 2px solid var(--gold);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.cert-title {
    font-family: 'Amiri', serif;
    font-size: 3rem;
    color: var(--emerald-deep);
    margin: 0;
}

.cert-body {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    line-height: 1.6;
    color: #334155;
}

@media print {
    .no-print { display: none !important; }
    body { background: white !important; }
    .modal-overlay { position: absolute; background: white; }
    .certificate-container { box-shadow: none; border-width: 10px; }
}
