/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1db954;
    --primary-dark: #1aa34a;
    --background: #0a0a0a;
    --surface: #1a1a1a;
    --surface-light: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --error: #e22134;
    --border-radius: 8px;
    --max-width: 1200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    padding: 20px 0;
    border-bottom: 1px solid var(--surface-light);
    position: relative;
}

header.minimal {
    border-bottom: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

/* Desktop Navigation */
nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

header:not(.minimal) {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-right: -8px;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background);
    z-index: 999;
    padding: 20px;
}

.mobile-menu.active {
    display: block;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    margin-right: -8px;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mobile-menu-nav a {
    font-size: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--surface-light);
}

/* Buttons */
.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 24px;
    border-radius: 500px;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cta-button:hover {
    background-color: var(--primary-dark);
    transform: scale(1.02);
    opacity: 1;
}

.cta-button.large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    max-width: 400px;
}

@media (hover: none) {
    .cta-button:hover {
        transform: none;
    }
    
    .cta-button:active {
        background-color: var(--primary-dark);
    }
}

.cta-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    text-align: center;
}

.hero h2 {
    font-size: clamp(32px, 5vw, 48px);
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

/* Features */
.features {
    padding: 60px 20px;
    background-color: var(--surface);
    border-radius: var(--border-radius);
    margin: 0 -20px;
}

.features h3 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 50px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    padding: 0 20px;
}

.feature {
    text-align: center;
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature h4 {
    font-size: 20px;
    margin-bottom: 10px;
}

.feature p {
    color: var(--text-secondary);
}

/* How it Works */
.how-it-works {
    padding: 80px 0;
}

.how-it-works h3 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 50px;
}

.steps {
    list-style: none;
    max-width: 600px;
    margin: 0 auto;
}

.steps li {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
}

.steps h4 {
    margin-bottom: 8px;
}

.steps p {
    color: var(--text-secondary);
}

/* Footer */
footer {
    padding: 40px 0;
    border-top: 1px solid var(--surface-light);
    text-align: center;
    color: var(--text-secondary);
}

footer.minimal {
    border-top: none;
    padding: 20px 0;
}

.footer-links {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 20px;
}

/* Pairing Page */
.pair-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
}

.pair-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.pair-card {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    padding: 48px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pair-card h2 {
    font-size: 28px;
    margin-bottom: 12px;
    text-align: center;
}

.pair-card > p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* Code Input */
.pair-form {
    margin-bottom: 32px;
}

.code-input-container {
    position: relative;
    margin-bottom: 24px;
}

.code-input {
    width: 100%;
    padding: 20px;
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 600;
    text-align: center;
    background-color: var(--surface-light);
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    letter-spacing: clamp(4px, 1vw, 8px);
    transition: border-color 0.2s;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.code-input::placeholder {
    color: #555;
    letter-spacing: 8px;
}

.code-format-hint {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Button with Spinner */
.button-text,
.button-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-spinner {
    position: absolute;
    inset: 0;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background-color: rgba(226, 33, 52, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Help Section */
.help-section {
    border-top: 1px solid var(--surface-light);
    padding-top: 32px;
}

.help-section h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.help-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.help-section ul {
    list-style: none;
    color: var(--text-secondary);
}

.help-section li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 8px;
}

.help-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    /* Hide desktop nav, show mobile toggle */
    header:not(.minimal) nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Hero adjustments */
    .hero {
        padding: 60px 0;
    }
    
    /* Features adjustments */
    .features {
        padding: 40px 16px;
        margin: 0 -16px;
    }
    
    .features h3 {
        font-size: 28px;
        margin-bottom: 40px;
    }
    
    .feature-grid {
        padding: 0 16px;
        gap: 32px;
    }
    
    /* How it works adjustments */
    .how-it-works {
        padding: 60px 0;
    }
    
    .how-it-works h3 {
        font-size: 28px;
        margin-bottom: 40px;
    }
    
    .steps li {
        margin-bottom: 32px;
    }
    
    /* Pairing page adjustments */
    .pair-main {
        padding: 20px 16px;
    }
    
    .pair-card {
        padding: 32px 24px;
    }
    
    .pair-card h2 {
        font-size: 24px;
    }
    
    .code-format-hint {
        font-size: 11px;
        right: 12px;
    }
    
    /* Footer adjustments */
    .footer-links {
        flex-wrap: wrap;
        gap: 16px 24px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    /* Smaller logo on mobile */
    .logo svg {
        width: 32px;
        height: 32px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    /* Hero mobile */
    .hero {
        padding: 40px 0;
    }
    
    /* Features mobile */
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-icon {
        font-size: 36px;
    }
    
    /* Steps mobile */
    .steps {
        padding: 0;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    /* Pairing card mobile */
    .pair-card {
        padding: 24px 20px;
        border-radius: 0;
        min-height: calc(100vh - 140px);
    }
    
    .pair-main {
        padding: 0;
    }
    
    .code-input {
        padding: 16px 12px;
    }
    
    .help-section {
        padding-top: 24px;
    }
    
    .help-section h3 {
        font-size: 16px;
    }
    
    /* Full width button on mobile */
    .cta-button.large {
        max-width: 100%;
    }
}

/* Very small devices */
@media (max-width: 375px) {
    .container {
        padding: 0 12px;
    }
    
    .hero h2 {
        font-size: 28px;
    }
    
    .pair-card {
        padding: 20px 16px;
    }
    
    .code-input {
        letter-spacing: 2px;
    }
}
