* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --secondary: #64748b;
    --background: #faf5ff;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --border: #e9d5ff;
    --success: #10b981;
    --info: #3b82f6;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text);
}

.container {
    width: 100%;
    max-width: 600px;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

.calculator {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    transition: all 0.2s;
    background: var(--surface);
    color: var(--text);
    font-family: 'Courier New', monospace;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.live-status {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-radius: 0.375rem;
    border: 1px solid #e9d5ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #7c3aed;
    font-family: 'Courier New', monospace;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s;
}

.result-card:hover {
    border-color: var(--primary);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.result-bits {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.result-value {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.detected-value {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--info);
}

.result-path {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--surface);
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    font-style: italic;
}

.btn-copy {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
    color: var(--text);
}

.btn-copy:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.selected-output {
    border: 2px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.selected-output .result-label {
    color: var(--success);
}

.detected-control {
    border: 2px solid var(--info);
    background: rgba(59, 130, 246, 0.05);
}

.detected-control .result-label {
    color: var(--info);
}

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--text);
    color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    font-weight: 500;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: #ef4444;
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .calculator {
        padding: 1.5rem;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
}
