/* --- THEME DEFINITIONS --- */
:root {
    /* Mystic Theme (Default) */
    --bg-gradient: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
    --accent-text: linear-gradient(to right, #ff6a88, #ff99ac);
    --accent-active: #ff6a88;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #ffffff;
    --text-soft: #d1d5db;
    
    /* Special Gradients */
    --gold-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --chaos-gradient: linear-gradient(135deg, #00dbde 0%, #fc00ff 100%);
    --magic-gradient: linear-gradient(135deg, #abecd6 0%, #fbed96 100%);
}

/* Themes Override */
body.theme-ocean { --bg-gradient: linear-gradient(to bottom, #051937, #004d7a, #008793); --accent-text: linear-gradient(to right, #4facfe, #00f2fe); --accent-active: #4facfe; }
body.theme-sunset { --bg-gradient: linear-gradient(to bottom, #2b0505, #621708, #94330c); --accent-text: linear-gradient(to right, #f09819, #edde5d); --accent-active: #f09819; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 20px;
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: var(--bg-gradient); background-size: 400% 400%;
    color: var(--text-white); min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding-bottom: 140px;
    transition: background 0.5s ease;
}

body.vibing-mode { animation: bg-pulse 4s ease infinite alternate; }
@keyframes bg-pulse { 0% { background-position: 50% 0%; } 100% { background-position: 50% 100%; } }

/* --- SHAKE LOCKED STATE --- */
body.shake-locked .vibe-btn, 
body.shake-locked .magic-touch-area,
body.shake-locked .clock-area {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed;
}

header { text-align: center; margin-bottom: 15px; width: 100%; max-width: 500px; }
h1 { margin: 10px 0 5px 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.5px; text-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.name-part { display: block; font-size: 1.8rem; color: var(--text-white); }
.title-part { background: var(--accent-text); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 2.4rem; }
p.subline { font-size: 0.95rem; color: var(--text-soft); opacity: 0.8; margin-bottom: 15px; font-weight: 300; }

/* --- THEME DOTS --- */
.theme-picker { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; }
.theme-dot { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(255,255,255,0.3); transition: 0.3s; }
.theme-dot.active { border-color: white; transform: scale(1.2); box-shadow: 0 0 15px rgba(255,255,255,0.5); }

/* --- VIEW SWITCHER --- */
.view-switcher {
    display: flex; background: rgba(0,0,0,0.2); border-radius: 50px;
    padding: 5px; margin-bottom: 20px; width: 100%; max-width: 350px;
}
.view-btn {
    flex: 1; padding: 10px; border-radius: 40px; border: none; background: transparent;
    color: #aaa; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: 0.3s;
}
.view-btn.active { background: var(--glass-bg); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }

/* --- CONTROLS AREA --- */
.controls-area {
    background: var(--glass-bg); backdrop-filter: blur(10px);
    padding: 15px 20px; border-radius: 25px; width: 100%; 
    display: flex; flex-direction: column; gap: 15px; 
    margin-bottom: 25px; border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.control-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.switch-label { font-size: 1rem; font-weight: 500; color: #fff; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: var(--accent-text); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- CONTENT VIEWS --- */
.view-section { display: none; width: 100%; max-width: 500px; }
.view-section.active { display: block; }

/* --- GRID --- */
.grid-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; width: 100%; }

.vibe-btn {
    background: var(--glass-bg); backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border); border-radius: 25px;
    padding: 25px 10px; color: white; font-size: 1rem; font-weight: 500;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); cursor: pointer; position: relative;
    transition: 0.3s;
}
.vibe-btn svg { width: 32px; height: 32px; stroke: var(--accent-active); stroke-width: 1.5; filter: drop-shadow(0 0 5px rgba(255,255,255,0.3)); }
.vibe-btn:active { transform: scale(0.96); }
.vibe-btn.active-loop { background: rgba(255,255,255,0.1); border-color: var(--accent-active); box-shadow: 0 0 20px var(--accent-active); }
.vibe-btn.active-loop svg { animation: breathe 2s infinite; stroke: #fff; }

.daily-btn { grid-column: 1 / -1; border: 1px solid rgba(253, 160, 133, 0.5); }
.daily-btn svg { stroke: #f6d365 !important; }
.chaos-btn { grid-column: 1 / -1; border: 1px solid rgba(0, 219, 222, 0.5); }
.chaos-btn svg { stroke: #00dbde !important; }
.tag { font-size: 0.75rem; text-transform: uppercase; background: var(--gold-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }
.chaos-btn .tag { background: var(--chaos-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* --- MAGIC TOUCH (GROSS) --- */
.magic-touch-area {
    grid-column: 1 / -1; background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 25px;
    padding: 90px 30px; 
    text-align: center; margin-top: 10px; cursor: crosshair; touch-action: none;
}
.magic-touch-area span { background: var(--magic-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; text-transform: uppercase; }
.magic-touch-area p { margin: 5px 0 0 0; font-size: 0.8rem; color: var(--text-soft); }

/* --- BUBBLE WRAP --- */
.bubble-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; width: 100%; }
.bubble {
    aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    box-shadow: inset 0 0 10px rgba(255,255,255,0.1), 0 5px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: 0.2s; position: relative;
}
.bubble::after { content: ''; position: absolute; top: 15%; left: 15%; width: 20%; height: 20%; background: rgba(255,255,255,0.4); border-radius: 50%; filter: blur(2px); }
.bubble.popped { transform: scale(0.9); background: rgba(0,0,0,0.3); box-shadow: inset 0 0 10px rgba(0,0,0,0.8); border-color: transparent; }
.bubble.popped::after { display: none; }
.refill-btn {
    width: 100%; padding: 15px; margin-top: 20px; background: var(--glass-bg); color: #fff;
    border: 1px solid var(--glass-border); border-radius: 20px; font-weight: bold; cursor: pointer; text-transform: uppercase;
}

/* --- CLOCK / RATCHET STYLES --- */
.clock-area { display: flex; justify-content: center; align-items: center; padding: 20px; }
.clock-face {
    width: 280px; height: 280px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.05); border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0 20px rgba(0,0,0,0.5);
    position: relative; touch-action: none; cursor: grab;
}
.marker { position: absolute; font-weight: 700; color: rgba(255,255,255,0.3); font-size: 1.2rem; }
.twelve { top: 15px; left: 50%; transform: translateX(-50%); }
.six { bottom: 15px; left: 50%; transform: translateX(-50%); }
.three { right: 20px; top: 50%; transform: translateY(-50%); }
.nine { left: 20px; top: 50%; transform: translateY(-50%); }

.clock-hand {
    width: 6px; height: 110px; background: var(--accent-text); position: absolute;
    top: 50%; left: 50%; transform-origin: bottom center; transform: translate(-50%, -100%) rotate(0deg);
    border-radius: 5px; box-shadow: 0 0 15px var(--accent-active); z-index: 2;
}
.center-nut {
    width: 20px; height: 20px; background: #fff; border-radius: 50%; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%); box-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 3;
}
.instruction { text-align: center; color: var(--text-soft); margin-top: 20px; font-weight: 300; }

/* --- STOP BUTTON & TOAST --- */
.stop-container { position: fixed; bottom: 30px; left: 0; right: 0; display: flex; justify-content: center; z-index: 100; padding: 0 20px; }
.stop-btn { background: rgba(255,255,255,0.1); backdrop-filter: blur(15px); width: 100%; max-width: 500px; padding: 20px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.2); color: white; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; }
#toast { visibility: hidden; min-width: 250px; background: rgba(20,20,40,0.95); color: #fff; text-align: center; border-radius: 25px; padding: 16px; position: fixed; z-index: 200; left: 50%; bottom: 110px; transform: translateX(-50%); opacity: 0; transition: 0.5s; }
#toast.show { visibility: visible; opacity: 1; bottom: 120px; }

@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.8; } }