/* Mobile-first styles */
:root {
    --dark-purple: #34204e;
    --redish-pink: #d34159;
    --light-purple: #452874;
    --text-color: #fee4ff;
    --secondary-text: #a298a7;
    --bg-dark: #221330;
    --text-primary: #ffffff;
    --text-secondary: #a4a4a4;
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fix iOS height issues */
html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--dark-purple);
    color: var(--text-color);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    touch-action: manipulation;
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
    margin: 0;
    width: 100%;
    overflow-x: hidden;
}

/* Improve touch targets */
button, 
select, 
input,
a {
    min-height: 44px;
    min-width: 44px;
    padding: 12px;
    touch-action: manipulation;
}

.container {
    width: 100%;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

header {
    text-align: center;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: min(6rem, 12vh);
}

h1 {
    font-size: min(5.5rem, 18vw);
    color: var(--redish-pink);
    margin-bottom: min(1.5rem, 3vh);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    line-height: 1.2;
    letter-spacing: 2px;
}

.subtitle {
    color: var(--secondary-text);
    font-size: min(1.6rem, 6vw);
    margin-top: min(1rem, 2vh);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: min(2.5rem, 5vh);
    width: min(450px, 90%);
    margin: 0 auto;
}

.btn {
    padding: min(1.8rem, 3.5vh);
    border: none;
    border-radius: min(20px, 4vw);
    font-size: min(1.6rem, 6vw);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Touch device optimizations */
@media (hover: none) {
    .btn:active {
        transform: scale(0.98);
    }
}

@media (hover: hover) {
    .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }
}

.btn.primary {
    background-color: var(--redish-pink);
    color: var(--text-color);
}

.btn.primary:hover {
    background-color: #ff4f6d;
}

.btn.secondary {
    background-color: var(--light-purple);
    color: var(--text-color);
}

.btn.secondary:hover {
    background-color: #523da8;
}

.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--dark-purple);
    padding: min(2.5rem, 5vh);
    border-radius: min(16px, 3vw);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: min(500px, 90%);
    text-align: center;
    z-index: 100;
}

.dialog h2 {
    color: var(--redish-pink);
    margin-bottom: min(2rem, 4vh);
    font-size: min(1.8rem, 6vw);
}

.dialog input {
    width: 100%;
    padding: min(1.2rem, 2.5vh);
    border: 2px solid var(--light-purple);
    border-radius: min(12px, 2vw);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: min(1.2rem, 4vw);
    margin-bottom: min(2rem, 4vh);
    transition: all 0.3s ease;
}

.dialog input:focus {
    border-color: var(--redish-pink);
    outline: none;
    box-shadow: 0 0 0 2px rgba(211, 65, 89, 0.3);
}

.dialog input::placeholder {
    color: var(--secondary-text);
}

.dialog .btn {
    margin: min(0.8rem, 1.5vh);
    min-width: min(120px, 30%);
}

/* Connection status styles */
.connection-status {
    position: fixed;
    top: calc(20px + var(--safe-area-inset-top));
    right: 20px;
    padding: min(10px, 2vh) min(20px, 4vw);
    border-radius: min(12px, 2vw);
    font-size: min(14px, 3vw);
    font-weight: bold;
    color: white;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Status colors with improved visibility */
.connection-status.connected {
    background-color: rgba(39, 174, 96, 0.95);
}

.connection-status.connecting {
    background-color: rgba(241, 196, 15, 0.95);
}

.connection-status.disconnected {
    background-color: rgba(231, 76, 60, 0.95);
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .container {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .action-buttons {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .dialog {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }
}

.hidden {
    display: none !important;
}
