/* Firework generator - page layout only; header, footer, hero, tips, info cards and CTA come from site-modern-v1.css. */

.main {
    padding-top: 0;
    padding-bottom: 56px;
    --fw-panel: color-mix(in srgb, var(--bg-card) 92%, transparent);
    --fw-field: color-mix(in srgb, var(--bg-primary) 80%, transparent);
    --fw-line: var(--border-color);
    --fw-accent: var(--primary);
    --fw-accent-soft: color-mix(in srgb, var(--primary) 16%, transparent);
    --fw-slot: color-mix(in srgb, var(--bg-primary) 72%, #000);
    --fw-warn: #e0a526;
    --fw-ok: #3fbf5f;
}

.main [hidden] {
    display: none !important;
}

.hero {
    margin-bottom: 22px;
    padding: 140px 0 80px;
}

.firework-section {
    padding: 24px 0 8px;
}

.is-pixel {
    image-rendering: pixelated;
}

.fw-panel {
    background: var(--fw-panel);
    border: 1px solid var(--fw-line);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow-lg);
    min-width: 0;
}

.fw-panel h2,
.fw-panel h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 12px;
}

.fw-panel h2 {
    font-size: 1.1rem;
}

.fw-controls h3 {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--fw-line);
    font-size: 0.95rem;
}

.fw-panel h2 i,
.fw-panel h3 i {
    color: var(--fw-accent);
}

.fw-panel h4 {
    margin: 14px 0 8px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.fw-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* ---------- Buttons ---------- */

.fw-btn,
.fw-preset,
.fw-seg button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid var(--fw-line);
    border-radius: 10px;
    background: var(--fw-field);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.fw-btn:hover:not(:disabled),
.fw-btn.active,
.fw-preset:hover,
.fw-seg button:hover,
.fw-seg button.active {
    border-color: var(--fw-accent);
    color: var(--text-primary);
}

.fw-btn.active,
.fw-seg button.active {
    background: var(--fw-accent-soft);
}

.fw-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fw-btn--primary {
    border-color: var(--fw-accent);
    background: var(--fw-accent);
    color: #fff;
}

.fw-btn--primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--fw-accent) 82%, #fff);
    color: #fff;
}

.fw-seg {
    display: inline-flex;
    gap: 4px;
}

/* ---------- Presets ---------- */

.fw-presets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}

.fw-preset {
    border-radius: 999px;
    padding: 7px 14px;
}

.fw-preset i {
    color: var(--fw-accent);
}

/* ---------- Layout ---------- */

.fw-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.fw-preview {
    position: sticky;
    top: 92px;
}

.fw-stage {
    position: relative;
    height: min(58vh, 540px);
    min-height: 320px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f1426;
}

.fw-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}

.fw-stage canvas:active {
    cursor: grabbing;
}

.fw-status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 16px;
    color: #c9d1e8;
    text-align: center;
    pointer-events: none;
}

/* Subtitles like the game's sound captions, bottom right. */
.fw-subtitles {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    pointer-events: none;
}

.fw-subtitles span {
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.35s;
}

.fw-subtitles span.show {
    opacity: 1;
}

.fw-view-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.fw-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    margin-top: 14px;
    align-items: start;
}

/* Item tooltip in the game's look. */
.fw-tooltip {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px 10px;
    border: 2px solid #25015b;
    border-radius: 4px;
    outline: 2px solid #100010;
    background: #100010f2;
    font-size: 0.8rem;
    line-height: 1.45;
    text-align: left;
}

.fw-tt-name,
.fw-tt-line {
    text-align: left;
}

.fw-tt-name {
    color: #fff;
}

.fw-tt-line {
    color: #aaa;
}

.fw-tt-line.is-indent {
    padding-left: 1.2em;
}

.fw-stats {
    display: grid;
    gap: 6px;
    margin: 0;
}

.fw-stat {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px 10px;
    padding: 6px 10px;
    border: 1px solid var(--fw-line);
    border-radius: 10px;
    background: var(--fw-field);
}

.fw-stat dt {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.fw-stat dt i {
    color: var(--fw-accent);
}

.fw-stat dd {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
}

.fw-stat-note {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}

/* ---------- Controls ---------- */

.fw-flight {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.fw-flight-btn,
.fw-option,
.fw-star-main {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--fw-line);
    border-radius: 10px;
    background: var(--fw-field);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.fw-flight-btn {
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.fw-flight-icons {
    display: flex;
    justify-content: center;
    min-height: 22px;
}

.fw-flight-icons img {
    width: 22px;
    height: 22px;
    margin: 0 -3px;
}

.fw-flight-btn:hover,
.fw-flight-btn.active,
.fw-option:hover,
.fw-option.active,
.fw-star-main:hover,
.fw-star.active .fw-star-main {
    border-color: var(--fw-accent);
    color: var(--text-primary);
}

.fw-flight-btn.active,
.fw-option.active,
.fw-star.active .fw-star-main {
    background: var(--fw-accent-soft);
}

.fw-flight-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px dashed var(--fw-line);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.fw-flight-custom.active {
    border-color: var(--fw-warn);
    color: var(--text-primary);
}

.fw-input,
.fw-flight-custom input {
    width: 90px;
    padding: 6px 9px;
    border: 1px solid var(--fw-line);
    border-radius: 8px;
    background: var(--fw-field);
    color: var(--text-primary);
    font-family: var(--mono-font, monospace);
}

.fw-input:focus,
.fw-flight-custom input:focus,
.fw-import textarea:focus {
    outline: none;
    border-color: var(--fw-accent);
    box-shadow: 0 0 0 3px var(--fw-accent-soft);
}

.fw-count-badge {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--fw-accent-soft);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.fw-stars {
    display: grid;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    padding: 2px;
}

.fw-star {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: stretch;
}

.fw-star-main {
    min-width: 0;
}

.fw-star-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
}

.fw-star-icon canvas {
    width: 32px;
    height: 32px;
}

.fw-star-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.fw-star-text strong {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.fw-dots {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.fw-dots img {
    width: 14px;
    height: 14px;
}

.fw-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.fw-star-tools {
    display: grid;
    grid-template-columns: repeat(2, 30px);
    gap: 3px;
}

.fw-star-tools button {
    border: 1px solid var(--fw-line);
    border-radius: 7px;
    background: var(--fw-field);
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
}

.fw-star-tools button:hover:not(:disabled) {
    border-color: var(--fw-accent);
    color: var(--fw-accent);
}

.fw-star-tools button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fw-add-star {
    width: 100%;
    margin-top: 8px;
    border-style: dashed;
}

.fw-editor {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid var(--fw-line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--fw-accent) 5%, transparent);
}

.fw-editor h3 {
    margin: 0 0 4px;
    padding: 0;
    border: 0;
}

.fw-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}

.fw-option-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.fw-option-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.fw-option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.fw-option-text strong {
    color: var(--text-primary);
    overflow-wrap: break-word;
    hyphens: auto;
}

.fw-option-text small {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.fw-option-text {
    flex: 1;
}

/* The shared layer centres text on every span/div/p - these read better left-aligned. */
.fw-option-text strong,
.fw-option-text small,
.fw-star-text strong,
.fw-star-text span,
.fw-chip span,
.fw-craft-status strong,
.fw-craft-status li,
.fw-craft-step h3 span,
.fw-shape-card h3,
.fw-shape-card small,
.fw-shape-card p,
.fw-shape-facts li,
.fw-import p,
.fw-stat dt,
.fw-stat-note {
    text-align: center;
}

#fwEffects {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.fw-toggle {
    margin-left: auto;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.fw-option.active .fw-toggle {
    color: var(--fw-accent);
}

.fw-picked {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.fw-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    border: 1px solid var(--fw-line);
    border-radius: 999px;
    background: var(--fw-field);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.fw-chip:hover {
    border-color: #d9534f;
    color: var(--text-primary);
}

.fw-chip-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.fw-palette {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
}

.fw-swatch {
    aspect-ratio: 1;
    max-width: 100%;
    display: grid;
    place-items: center;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: color-mix(in srgb, var(--c) 45%, var(--fw-slot));
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.fw-swatch img {
    width: 100%;
    max-width: 26px;
}

.fw-swatch:hover {
    border-color: var(--c);
    transform: translateY(-1px);
}

.fw-custom-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.fw-custom-row input[type='color'] {
    width: 42px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--fw-line);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

/* ---------- Crafting ---------- */

.fw-craft-panel,
.fw-commands-panel {
    margin-top: 18px;
}

.fw-craft-status {
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid var(--fw-line);
    border-left: 4px solid var(--fw-ok);
    border-radius: 10px;
    background: var(--fw-field);
    text-align: center;
    font-size: 0.85rem;
}

.fw-craft-status.is-warn {
    border-left-color: var(--fw-warn);
}

.fw-craft-status i {
    color: var(--fw-ok);
}

.fw-craft-status.is-warn i {
    color: var(--fw-warn);
}

.fw-craft-status ul {
    margin: 6px 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
}

.fw-craft-steps {
    --slot: 44px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.fw-craft-step {
    padding: 12px;
    border: 1px solid var(--fw-line);
    border-radius: 14px;
    background: var(--fw-field);
    counter-increment: step;
}

.fw-craft-step h3 {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-bottom: 10px;
    font-size: 0.88rem;
    text-align: center;
}

.fw-craft-step h3::before {
    content: counter(step);
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--fw-accent);
    color: #fff;
    font-size: 0.72rem;
}

.fw-times {
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fw-warn) 22%, transparent);
    color: var(--text-primary);
    font-size: 0.7rem;
}

.fw-recipe {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.fw-grid3 {
    display: grid;
    grid-template-columns: repeat(3, var(--slot));
    gap: 3px;
}

.fw-slot {
    position: relative;
    width: var(--slot, 44px);
    height: var(--slot, 44px);
    display: grid;
    place-items: center;
    padding: 5px;
    border-radius: 4px;
    background: var(--fw-slot);
    box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.45), inset -2px -2px 0 rgba(255, 255, 255, 0.07);
}

.fw-slot img,
.fw-slot canvas,
.fw-slot .fw-star-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fw-slot--big {
    --slot: 58px;
    outline: 2px solid color-mix(in srgb, var(--fw-accent) 45%, transparent);
    outline-offset: 2px;
}

.fw-count {
    position: absolute;
    right: 3px;
    bottom: 0;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 2px 2px 0 #3f3f3f;
}

.fw-custom-cell {
    display: grid;
    place-items: center;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: var(--c);
    color: #fff;
    font-weight: 700;
    text-shadow: 1px 1px 0 #000;
}

.fw-arrow {
    color: var(--text-muted);
    font-size: 1.4rem;
}

.fw-craft-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--fw-accent);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.fw-craft-link:hover {
    text-decoration: underline;
}

/* ---------- Commands ---------- */

.fw-commands-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.fw-commands-head h2 {
    margin: 0;
}

.fw-commands-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.fw-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.fw-label .fw-input {
    width: 110px;
}

.fw-label .fw-input[type='number'] {
    width: 70px;
}

.fw-commands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.fw-cmd {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.fw-cmd--wide {
    grid-column: 1 / -1;
}

.fw-cmd-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.fw-cmd-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.fw-cmd-row code {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--fw-slot);
    color: var(--text-primary);
    font-size: 0.78rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.fw-copy {
    width: 38px;
    border: 1px solid var(--fw-line);
    border-radius: 8px;
    background: var(--fw-field);
    color: var(--text-secondary);
    cursor: pointer;
}

.fw-copy:hover {
    border-color: var(--fw-accent);
    color: var(--fw-accent);
}

.fw-note {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.fw-import {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--fw-line);
    border-radius: 12px;
    background: var(--fw-field);
    text-align: center;
}

.fw-import summary {
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.fw-import summary i {
    color: var(--fw-accent);
}

.fw-import p {
    text-align: center;
    margin: 8px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.fw-import textarea {
    display: block;
    width: 100%;
    min-height: 74px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid var(--fw-line);
    border-radius: 8px;
    background: var(--fw-slot);
    color: var(--text-primary);
    font-family: var(--mono-font, monospace);
    font-size: 0.78rem;
    resize: vertical;
}

.fw-tips {
    margin-top: 22px;
}

/* ---------- Shape gallery ---------- */

.shapes-section {
    padding: 36px 0 8px;
}

.fw-shape-gallery {
    --slot: 58px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.fw-shape-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--fw-line);
    border-radius: 14px;
    background: var(--fw-panel);
    text-align: center;
}

.fw-shape-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fw-shape-card h3 {
    margin: 0;
    font-size: 1rem;
}

.fw-shape-card small {
    color: var(--text-muted);
}

.fw-shape-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.fw-shape-card .fw-shape-card-note {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.fw-shape-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.fw-shape-facts i {
    color: var(--fw-accent);
}

.fw-shape-card .fw-btn {
    align-self: flex-start;
    margin-top: auto;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .fw-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .fw-preview {
        position: static;
    }

    .fw-commands {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .hero {
        padding: 110px 0 56px;
    }

    .fw-panel {
        padding: 14px;
        border-radius: 14px;
    }

    .fw-stage {
        height: 46vh;
        min-height: 280px;
    }

    .fw-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .fw-flight {
        grid-template-columns: minmax(0, 1fr);
    }

    .fw-flight-btn {
        flex-direction: row;
        justify-content: flex-start;
    }

    .fw-flight-icons {
        min-width: 58px;
        justify-content: flex-start;
    }

    .fw-palette {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fw-commands-head,
    .fw-commands-tools {
        justify-content: center;
    }

    .fw-craft-steps {
        --slot: 38px;
        grid-template-columns: minmax(0, 1fr);
    }

    .fw-slot--big {
        --slot: 50px;
    }
}

/* The preview only follows the page when it fits on screen, otherwise its lower part would be cut off. */
@media (max-height: 999px) {
    .fw-preview {
        position: static;
    }
}
