:root {
    --bg-color: #FAFAFA;
    --text-color: #111111;
    --primary: #FF4A00;
    --accent: #FFC0CB; /* Pinkish */
    --surface: #FFFFFF;
    --border: #111111;
    
    --shadow: 8px 8px 0px 0px var(--border);
    --shadow-hover: 4px 4px 0px 0px var(--border);
    --shadow-active: 0px 0px 0px 0px var(--border);
    
    --radius: 12px;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: var(--surface);
    padding: 2rem;
    border-bottom: 4px solid var(--border);
    text-align: center;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.25rem;
    font-weight: 500;
}

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
    }
}

/* Calculator Panel */
.calculator-panel {
    padding: 3rem;
    border-right: 4px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

@media (max-width: 900px) {
    .calculator-panel {
        border-right: none;
        border-bottom: 4px solid var(--border);
    }
}

.input-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.input-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-block label {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
}

.input-block input {
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    padding: 1rem;
    border: 4px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-color);
    box-shadow: var(--shadow);
    transition: all 0.1s ease;
    text-align: center;
    appearance: none;
}

.input-block input:focus {
    outline: none;
    box-shadow: var(--shadow-hover);
    transform: translate(4px, 4px);
    border-color: var(--primary);
}

.divider {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-color);
    margin-top: 2rem;
}

.result-display {
    text-align: center;
    padding: 2rem;
    background: var(--accent);
    border: 4px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.result-display h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.massive-ratio {
    font-size: 5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    line-height: 1;
    word-break: break-all;
}

.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.preset-btn {
    flex: 1;
    min-width: 100px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--surface);
    border: 4px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.1s ease;
}

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

.preset-btn:active {
    box-shadow: var(--shadow-active);
    transform: translate(8px, 8px);
}

.code-outputs {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.code-card {
    border: 4px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 4px solid var(--border);
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
}

.copy-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: 4px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 4px 4px 0px 0px var(--border);
    transition: all 0.1s ease;
}

.copy-btn:active {
    box-shadow: 0px 0px 0px 0px var(--border);
    transform: translate(4px, 4px);
}

pre {
    padding: 1.5rem;
    margin: 0;
}

pre code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-color);
    white-space: pre-wrap;
}

/* Preview Panel */
.preview-panel {
    background: var(--bg-color);
    /* Dotted background */
    background-image: radial-gradient(var(--border) 2px, transparent 2px);
    background-size: 30px 30px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
}

.preview-header {
    background: var(--surface);
    padding: 1.5rem;
    border: 4px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
}

.preview-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.preview-workspace {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.resize-handle-wrapper {
    /* Important: CSS resize MUST be applied to a block element with overflow:hidden */
    width: 100%;
    max-width: 600px; /* starting width */
    min-width: 200px;
    resize: horizontal;
    overflow: hidden;
    padding-bottom: 10px; /* spacing for native resize handle */
    background: var(--surface);
    border: 4px dashed var(--primary);
    border-radius: var(--radius);
}

.preview-box {
    width: 100%;
    /* We will set aspect-ratio dynamically via JS */
    aspect-ratio: 16 / 9;
    background: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.box-content span {
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem 2rem;
    border: 4px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Hide number arrows */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}
