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

:root {
    --ink: #1a1a2e;
    --ink-soft: #4a4a6a;
    --ink-muted: #9090b0;
    --cream: #faf9f6;
    --cream-dark: #f0ede6;
    --accent: #c8692a;
    --accent-light: #f5e8df;
    --border: #e2ddd6;
    --shadow: 0 2px 12px rgba(26, 26, 46, 0.08);
    --shadow-lg: 0 8px 40px rgba(26, 26, 46, 0.14);
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 20px 80px;
}

.bg-texture {
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(200, 105, 42, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(26, 26, 46, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeUp 0.5s ease both;
}

.logo-mark {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
    animation: fadeUp 0.4s ease both;
}

h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(36px, 6vw, 56px);
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--ink);
    line-height: 1;
    animation: fadeUp 0.5s 0.05s ease both;
}

.subtitle {
    margin-top: 10px;
    font-size: 15px;
    color: var(--ink-muted);
    font-weight: 300;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    animation: fadeUp 0.5s 0.1s ease both;
}

/* Input */
.input-section {
    margin-bottom: 28px;
    animation: fadeUp 0.5s 0.15s ease both;
}

.input-wrapper {
    position: relative;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 105, 42, 0.1), var(--shadow);
}

label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 4px;
}

input {
    width: 100%;
    border: none;
    outline: none;
    font-family: 'DM Mono', monospace;
    font-size: 15px;
    color: var(--ink);
    background: transparent;
    padding: 0;
    line-height: 1.5;
}

input::placeholder {
    color: var(--ink-muted);
}

.input-hint {
    display: block;
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 6px;
}

.error {
    color: #c0392b;
    padding: 10px 14px;
    margin-top: 10px;
    background: #fdf0ee;
    border-radius: 6px;
    font-size: 14px;
    border-left: 3px solid #c0392b;
    display: none;
    animation: fadeUp 0.2s ease;
}

/* Presets */
.examples-section {
    margin-bottom: 36px;
    animation: fadeUp 0.5s 0.2s ease both;
}

.examples-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 10px;
}

.example-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-btn {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
    flex: 1;
}

.preset-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200, 105, 42, 0.15);
}

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

.preset-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    display: block;
}

.preset-chords {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--ink-muted);
    display: block;
}

/* Diagram */
#diagram-container {
    display: flex;
    justify-content: center;
    min-height: 80px;
    overflow-x: auto;
    padding: 4px 0;
    transition: all 0.3s ease;
    animation: fadeUp 0.5s 0.25s ease both;
}

#diagram-container.has-diagram {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
}

#diagram-container svg {
    border-radius: 10px;
    display: block;
}

/* Buttons */
.button-container {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: fadeUp 0.3s ease;
}

button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    letter-spacing: 0.01em;
}

#copy-btn {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(200, 105, 42, 0.3);
}

#copy-btn:hover:not(:disabled) {
    background: #b55e26;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(200, 105, 42, 0.4);
}

#copy-btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--ink);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--cream-dark);
    border-color: var(--ink-soft);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.success-msg {
    font-size: 13px;
    color: #2e7d32;
    font-weight: 500;
    display: none;
    animation: fadeUp 0.2s ease;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar for wide chord sets */
#diagram-container::-webkit-scrollbar {
    height: 4px;
}
#diagram-container::-webkit-scrollbar-track {
    background: transparent;
}
#diagram-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 600px) {
    body { padding: 28px 14px 60px; }
    .preset-btn { min-width: 120px; }
    .example-groups { gap: 6px; }
}
