:root {
    --bg-color: #1a0914; /* Fallback dark dawn */
    --text-main: #ffffff;
    --text-muted: #b0a8b9;
    --primary-color: #ff5722; /* Sunrise default */
    --ui-bg: rgba(255, 255, 255, 0.05);
    --ui-border: rgba(255, 255, 255, 0.1);
}

* {
    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;
    background: linear-gradient(180deg, #0b0914 0%, #180b22 40%, #361122 75%, #59161a 100%);
    background-color: var(--bg-color);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh; /* For mobile browsers with dynamic UI */
    display: flex;
    justify-content: center;
}

#app-container {
    width: 100%;
    max-width: 500px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Background glow based on active mode */
#app-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vw;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    opacity: 0.15;
    z-index: -1;
    transition: background 1s ease, opacity 0.5s ease;
    filter: blur(40px);
    pointer-events: none;
}

header {
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.logo {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0; /* Important for flex-grow in column */
}

/* Visualizer Area */
.visualizer-wrapper {
    position: relative;
    width: 250px;
    height: 250px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#visualizer {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.status-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid rgba(255,255,255,0.05);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5) inset, 0 0 0 0 var(--primary-color);
    transition: box-shadow 0.3s ease;
    z-index: 1;
}

body.is-playing .status-ring {
    animation: pulse-ring 4s infinite alternate ease-in-out;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 20px rgba(0,0,0,0.5) inset, 0 0 10px 0px var(--primary-color); }
    100% { box-shadow: 0 0 20px rgba(0,0,0,0.5) inset, 0 0 40px 5px var(--primary-color); }
}

.play-overlay {
    position: absolute;
    z-index: 10;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
    border: 1px solid var(--ui-border);
}

body.is-playing .play-overlay {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.2);
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

/* Active Mode Text */
.active-mode-display {
    text-align: center;
    height: 60px;
}

#current-mode-title {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 8px;
    transition: color 0.5s ease;
}

#current-mode-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.4;
}

/* Navigation Controls */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex-shrink: 0;
    padding-bottom: 20px;
}

.mode-btn {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--btn-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.mode-btn.active {
    border-color: var(--btn-color);
    background: rgba(255,255,255,0.1);
}

.mode-btn.active::before {
    opacity: 0.15;
}

.mode-btn .icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.mode-btn .label {
    position: relative;
    z-index: 1;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Stop Button Overlay (appears when tapping visualizer while playing) */
.visualizer-wrapper::after {
    content: 'TAP TO PAUSE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 11;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 20px;
}

body.is-playing .visualizer-wrapper:active::after {
    opacity: 1;
}

/* Contact Button */
.contact-btn {
    display: block;
    margin: 10px auto 20px;
    padding: 14px 24px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    width: 100%;
    max-width: 280px;
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}