/* =========================================
   BASE EXTENSION STYLES
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh; 
    color: #1a252f;
    overflow: hidden;
    background-color: transparent; 
}

/* Generative Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* The Glassmorphism Card */
.glass-panel {
    width: 90%;
    max-width: 750px;
    background: rgba(255, 255, 255, 0.45); 
    backdrop-filter: blur(14px); 
    -webkit-backdrop-filter: blur(14px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 1.5rem 3rem; 
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    min-height: 520px; 
}

/* LAYOUT FREEZE FIX */
.card-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.2rem 0;
}

.card-section:first-child { 
    padding-top: 0; 
    height: 230px; 
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.card-section:last-child { 
    padding-bottom: 0; 
    margin-top: auto; 
}

.card-section:nth-child(2) {
    flex-grow: 1; 
    justify-content: center; 
}

.border-bottom {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.title-wrapper {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 0.5rem;
    min-height: 50px; 
}

#virtue-title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    padding: 0 50px; 
}

.inline-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%); 
    z-index: 50; 
}

.content-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Layout Lockers */
.text-container {
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    width: 100%;
}

.def-container { text-align: center; }
.ety-container { text-align: center; margin-top: 15px; }
.quote-container { text-align: center; }
.aff-container { text-align: center; }

#virtue-definition {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #2c3e50;
}

#virtue-etymology {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #576574;
    font-style: italic;
}

.ety-label {
    font-weight: 600;
    color: #2c3e50; 
    font-style: normal;
}

#virtue-quote {
    font-size: 1.15rem;
    font-style: italic;
    color: #2c3e50;
    padding: 0 1rem;
    width: 100%;
}

/* Updated Author Styling: Elegant Italics instead of harsh Caps */
.quote-author {
    display: block; 
    margin-top: 10px;
    font-size: 1.05rem;
    color: #576574; 
    font-style: normal; /* The Fix: Removed italics to contrast the quote */
    font-weight: 600;   /* Slightly bolder to anchor the text */
    text-transform: none;
    letter-spacing: normal;
}










#virtue-affirmation {
    font-size: 1.2rem;
    font-weight: 500;
    color: #2980b9;
}

/* =========================================
   SVG REFRESH ICON ANIMATIONS
   ========================================= */
.refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #7f8c8d;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.refresh-btn svg {
    width: 22px;
    height: 22px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

@media (hover: hover) {
    .refresh-btn:hover svg {
        color: #1a252f;
        transform: rotate(180deg);
    }
}

.refresh-btn:active svg {
    color: #1a252f;
    transform: rotate(360deg) scale(0.8);
    transition: transform 0.1s ease; 
}

/* =========================================
   BOTTOM ACTION TOOLBAR
   ========================================= */

.bottom-bar {
    position: absolute;
    bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center; 
    z-index: 20;
}

.action-cluster {
    display: flex;
    align-items: center;
    gap: 20px; 
}

.bottom-btn {
    color: #576574;
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 18px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.2s ease;
    cursor: pointer;
}

.bg-refresh-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    color: #2c3e50;
}

/* The Anti-Wobble Center Anchoring */
.bg-refresh-btn .icon-primary,
.bg-refresh-btn .icon-hover {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-refresh-btn .icon-hover svg {
    width: 22px;
    height: 22px;
    color: #1a252f;
}

.bg-refresh-btn .icon-primary { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
.bg-refresh-btn .icon-hover { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-90deg); }

/* Desktop Hover */
@media (hover: hover) {
    .bottom-btn:hover {
        background: rgba(255, 255, 255, 0.8);
        color: #1a252f;
        transform: translateY(-2px);
    }
    .bg-refresh-btn:hover {
        background: rgba(255, 255, 255, 0.8);
        transform: scale(1.08);
    }
    .bg-refresh-btn:hover .icon-primary { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(90deg); }
    .bg-refresh-btn:hover .icon-hover { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* Mobile Tap (Active state triggers the visual switch when pressed) */
.bg-refresh-btn:active .icon-primary { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(90deg); transition: 0.1s ease; }
.bg-refresh-btn:active .icon-hover { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); transition: 0.1s ease; }

/* =========================================
   MODALS
   ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 37, 47, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    max-width: 500px;
    padding: 2.5rem;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #ffffff; 
    backdrop-filter: none; 
    -webkit-backdrop-filter: none;
    border-radius: 24px;
}

.modal-overlay.show .modal-panel {
    transform: translateY(0);
}

.modal-panel h2 {
    font-size: 1.8rem;
    color: #1a252f;
    margin-bottom: 1rem;
}

.modal-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #34495e;
    margin-bottom: 2rem;
}

.action-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tip-btn { background-color: #2980b9; color: #ffffff; border: 1px solid #2980b9; }
.promo-btn { background-color: #2c3e50; color: #ffffff; border: 1px solid #2c3e50; }
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .tip-btn:hover { background-color: #3498db; transform: scale(1.05); }
    .promo-btn:hover { background-color: #1a252f; transform: scale(1.05); }
    .close-modal-btn:hover { color: #1a252f; }
}

/* =========================================
   WEB VERSION OVERRIDES (Injected via PHP)
   ========================================= */

body.web-version {
    display: flex; 
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    min-height: 100dvh;
    overflow-y: auto; 
    overflow-x: hidden;
}

.web-version #bg-canvas { position: fixed; }

.hero-viewport {
    position: relative;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.web-footer {
    position: relative;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    padding: 3rem 2rem 5rem; 
    text-align: center;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.05);
}

.up-arrows {
    font-size: 2.5rem;
    color: #2980b9;
    margin-bottom: 0.5rem;
    letter-spacing: 15px;
    animation: floatUp 2s infinite ease-in-out;
}

@keyframes floatUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.cta-container h2 { font-size: 2.5rem; color: #1a252f; margin-bottom: 1rem; font-weight: 700; }
.cta-container p { font-size: 1.25rem; color: #576574; margin-bottom: 2.5rem; }

.store-btn {
    display: inline-block;
    background-color: #2980b9;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 18px 36px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(41, 128, 185, 0.25);
    transition: all 0.3s ease;
}

.footer-links {
    margin-top: 5rem;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.footer-links a {
    color: #576574;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    transition: color 0.2s;
}

@media (hover: hover) {
    .store-btn:hover {
        background-color: #1a252f;
        transform: translateY(-3px);
        box-shadow: 0 15px 25px rgba(26, 37, 47, 0.25);
    }
    .footer-links a:hover { color: #1a252f; }
}

/* =========================================
   AGGRESSIVE MOBILE RESPONSIVE FIXES
   ========================================= */

@media (max-width: 768px) {
    .glass-panel {
        width: 95%; 
        padding: 1.5rem 1rem; 
        margin-top: -60px; 
        height: 580px; 
    }

    .card-section:first-child { 
        height: 270px; 
    }

    #virtue-title { font-size: 2rem; padding: 0 45px; }
    #virtue-definition { font-size: 1.05rem; }
    #virtue-etymology { font-size: 0.85rem; }
    #virtue-quote { font-size: 1rem; padding: 0 0.5rem; }
    #virtue-affirmation { font-size: 1.05rem; }

    .web-footer { padding: 1.5rem 1.5rem 4rem; }
    .up-arrows { margin-bottom: 0; }
    .cta-container h2 { font-size: 1.8rem; }
    .cta-container p { font-size: 1.1rem; }
    .footer-links { flex-direction: column; gap: 15px; }
    .divider { display: none; }
}