* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ink: #1a1a2e;
    --paper: #faf8f5;
    --accent: #e63946;
    --muted: #8d99ae;
    --pop: #06d6a0;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1000;
}

.wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header - asymmetric and bold */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 0 3rem;
    border-bottom: 3px solid var(--ink);
}

.back-home {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 2px solid var(--muted);
    transition: all 0.15s;
}

.back-home:hover {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

.logo {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo span {
    color: var(--accent);
}

.logo .version {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--muted);
    margin-left: 0.5rem;
    vertical-align: super;
}

.tagline {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* Main layout - unconventional grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 4rem;
    margin-top: 3rem;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Left side - the playground */
.playground h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    line-height: 0.95;
    margin-bottom: 0.5rem;
}

.playground h1 .strikethrough {
    text-decoration: line-through;
    color: var(--muted);
    font-weight: 300;
}

.subtitle {
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    max-width: 400px;
}

/* Mode switcher - chunky tabs */
.mode-switcher {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border: 3px solid var(--ink);
    width: fit-content;
}

.mode-btn {
    padding: 0.8rem 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    border-right: 3px solid var(--ink);
    text-transform: lowercase;
}

.mode-btn:last-child { border-right: none; }

.mode-btn:hover { background: var(--ink); color: var(--paper); }

.mode-btn.active {
    background: var(--accent);
    color: white;
}

/* Input fields - brutalist style */
.input-zone {
    margin-bottom: 2rem;
}

.field-group {
    margin-bottom: 1.5rem;
}

.field-group label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.field-group input,
.field-group textarea,
.field-group select {
    width: 100%;
    padding: 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    border: 3px solid var(--ink);
    background: white;
    transition: all 0.2s;
}

.field-group input:focus,
.field-group textarea:focus {
    outline: none;
    box-shadow: 6px 6px 0 var(--ink);
    transform: translate(-3px, -3px);
}

.field-group textarea {
    resize: none;
    min-height: 100px;
}

.hidden { display: none !important; }

/* Customization panel */
.customize-zone {
    background: var(--ink);
    color: var(--paper);
    padding: 2rem;
    margin: 2rem -2rem;
}

.customize-zone h3 {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
    color: var(--pop);
}

.options-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.option-group {
    flex: 1;
    min-width: 120px;
}

.option-group label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-picker {
    width: 45px;
    height: 45px;
    border: 3px solid var(--paper);
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; }

/* Size control */
.size-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 0;
    margin-top: 0.5rem;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--pop);
    cursor: pointer;
}

/* Error level pills */
.level-pills {
    display: flex;
    gap: 0.5rem;
}

.level-pill {
    padding: 0.4rem 0.8rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: var(--paper);
    cursor: pointer;
    transition: all 0.15s;
}

.level-pill:hover { border-color: var(--paper); }

.level-pill.active {
    background: var(--pop);
    border-color: var(--pop);
    color: var(--ink);
}

/* Generate button - big and bold */
.generate-btn {
    display: block;
    width: 100%;
    padding: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.generate-btn::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: -6px;
    bottom: -6px;
    background: var(--ink);
    z-index: -1;
}

.generate-btn:hover {
    transform: translate(3px, 3px);
}

.generate-btn:hover::after {
    top: 3px;
    left: 3px;
    right: -3px;
    bottom: -3px;
}

.generate-btn:active {
    transform: translate(6px, 6px);
}

.generate-btn:active::after {
    display: none;
}

/* Right side - QR display */
.output-zone {
    position: sticky;
    top: 2rem;
}

.qr-frame {
    background: white;
    border: 3px solid var(--ink);
    padding: 2rem;
    position: relative;
}

.qr-frame::before {
    content: 'OUTPUT';
    position: absolute;
    top: -0.7rem;
    left: 1rem;
    background: var(--paper);
    padding: 0 0.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--muted);
}

.qr-display {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(
        45deg,
        #f5f5f5,
        #f5f5f5 10px,
        #fafafa 10px,
        #fafafa 20px
    );
}

.qr-display.has-code {
    background: white;
}

.placeholder-text {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.placeholder-text .arrow {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Download actions */
.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-top: -3px;
    border: 3px solid var(--ink);
    border-top: none;
}

.action-btn {
    padding: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    border-right: 3px solid var(--ink);
}

.action-btn:last-child { border-right: none; }

.action-btn:hover {
    background: var(--ink);
    color: var(--paper);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-btn:disabled:hover {
    background: white;
    color: var(--ink);
}

.copy-btn {
    grid-column: span 2;
    border-top: 3px solid var(--ink);
    background: var(--pop);
    color: var(--ink);
    font-weight: 700;
}

.copy-btn:hover {
    background: var(--ink);
    color: var(--pop);
}

/* Stats ticker */
.stats {
    margin-top: 2rem;
    padding: 1rem;
    border: 2px dashed var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    color: var(--muted);
}

.stats-row span:last-child {
    color: var(--ink);
}

/* Saved codes - horizontal scroll */
.saved-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 3px solid var(--ink);
}

.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.saved-header h4 {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.clear-btn {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clear-btn:hover { text-decoration: line-through; }

.saved-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
}

.saved-scroll::-webkit-scrollbar { height: 6px; }
.saved-scroll::-webkit-scrollbar-track { background: #eee; }
.saved-scroll::-webkit-scrollbar-thumb { background: var(--ink); }

.saved-item {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border: 2px solid var(--ink);
    cursor: pointer;
    transition: all 0.15s;
    background: white;
    padding: 4px;
}

.saved-item:hover {
    transform: rotate(-3deg) scale(1.1);
    box-shadow: 4px 4px 0 var(--ink);
}

.saved-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.empty-state {
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    padding: 1rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    transition: bottom 0.3s ease;
    z-index: 999;
}

.toast.show { bottom: 2rem; }

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--muted);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

.keyboard-hint {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
}

.keyboard-hint kbd {
    background: var(--ink);
    color: var(--paper);
    padding: 0.2rem 0.5rem;
    margin: 0 0.2rem;
}

/* Wifi specific styles */
.inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.checkbox-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.checkbox-field label {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
}
