/* FABULOUS TOOLS: shared tool UI */

/* ---------- Generator ---------- */
.label { margin: 22px 0 10px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel__body > .label:first-child { margin-top: 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
    height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--line-strong); background: var(--white);
    font-size: 14px; color: var(--ink); transition: all .15s;
}
.chip:hover { border-color: var(--black); }
.chip.is-active { background: var(--black); border-color: var(--black); color: var(--white); }

.vcard-cta {
    display: flex; align-items: center; gap: 14px; margin: 22px 0 0; padding: 12px 16px;
    border: 1px solid var(--black); border-radius: var(--radius-sm); background: var(--black); color: var(--white);
    text-decoration: none; transition: background .2s var(--ease), transform .2s var(--ease);
}
.vcard-cta:hover { background: #262626; }
.vcard-cta:active { transform: scale(.99); }
.vcard-cta__icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.1); }
.vcard-cta__text { flex: 1; display: grid; line-height: 1.3; min-width: 0; }
.vcard-cta__text strong { font-size: 14px; font-weight: 600; }
.vcard-cta__text small { font-size: 12px; color: #a3a3a3; }
.vcard-cta__arrow { font-size: 18px; transition: transform .2s var(--ease); }
.vcard-cta:hover .vcard-cta__arrow { transform: translate(2px, -2px); }

/* fields */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .color > span, .range > span { font-size: 13px; font-weight: 500; color: var(--ink); }
.field input, .field textarea, .field select {
    width: 100%; min-width: 0;
    padding: 11px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--white);
    font-size: 15px; transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.field select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
    background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(10,10,10,.08); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field--compact { margin: 18px 0 12px; }
.field--compact input { padding: 9px 12px; font-size: 14px; font-family: var(--mono); }
.grid-2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.check { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 4px; font-size: 14px; cursor: pointer; user-select: none; }
.check input {
    -webkit-appearance: none; appearance: none; margin: 0;
    width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-strong);
    display: grid; place-items: center; background: var(--white); transition: all .15s; cursor: pointer;
}
.check input:checked { background: var(--black); border-color: var(--black); }
.check input:checked::after { content: ""; width: 5px; height: 9px; border: solid var(--white); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check--inline { align-self: end; height: 48px; margin: 0 0 14px; }

/* option tiles */
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opts[data-group="cornerSquare"], .opts[data-group="cornerDot"] { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .opt { padding: 10px 4px 8px; gap: 6px; font-size: 11px; } .ico { width: 26px; height: 26px; } }
@media (min-width: 560px) { .opts { grid-template-columns: repeat(6, 1fr); } .opts[data-group="cornerSquare"], .opts[data-group="cornerDot"] { grid-template-columns: repeat(4, 1fr); } }
.opt {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 6px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--white);
    font-size: 12px; color: var(--muted); transition: all .15s;
}
.opt:hover { border-color: var(--line-strong); color: var(--ink); }
.opt.is-active { border-color: var(--black); color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.ico { width: 32px; height: 32px; display: block; color: var(--line-strong); transition: color .15s; }
.opt:hover .ico { color: var(--muted); }
.opt.is-active .ico { color: var(--black); }

/* segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; background: var(--soft); border-radius: 12px; }
.seg button { height: 36px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--muted); transition: all .15s; white-space: nowrap; padding: 0 8px; }
.seg button:hover { color: var(--black); }
.seg button.is-active { background: var(--white); color: var(--black); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04); }
.seg + .grid-2 { margin-top: 16px; }
@media (max-width: 480px) { .seg[data-group="fillMode"] button { font-size: 12px; } }

/* colors */
.color {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .15s;
}
.color:hover { border-color: var(--black); }
.color > span { grid-column: 2; font-size: 12px; color: var(--muted); font-weight: 400; }
.color input[type="color"] { grid-row: 1 / span 2; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
.color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color input[type="color"]::-moz-color-swatch { border: 0; border-radius: 7px; }
.color code { grid-column: 2; font-family: var(--mono); font-size: 14px; color: var(--black); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
    width: 40px; height: 40px; border-radius: 50%; padding: 0;
    border: 1px solid var(--line-strong); position: relative; overflow: hidden; transition: transform .15s;
}
.preset:hover { transform: scale(1.08); }
.preset.is-active { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--black); }

/* ranges */
.range { display: grid; gap: 8px; margin: 18px 0 8px; }
.range > span { display: flex; justify-content: space-between; }
.range output { font-family: var(--mono); font-size: 13px; color: var(--muted); font-weight: 400; }
.range input { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; }
.range input::-webkit-slider-runnable-track { height: 3px; background: var(--line-strong); border-radius: 2px; }
.range input::-moz-range-track { height: 3px; background: var(--line-strong); border-radius: 2px; }
.range input::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8.5px; border-radius: 50%; background: var(--black); border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--black); cursor: grab; }
.range input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--black); border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--black); cursor: grab; }

.hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.hint--warn { color: var(--warn); padding: 10px 12px; border: 1px solid #f3d9b5; background: #fffaf2; border-radius: var(--radius-sm); }

/* logo drop */
.drop {
    display: flex; align-items: center; gap: 16px; padding: 18px;
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--black); background: var(--soft); }
.drop__icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--soft); color: var(--black); }
.drop__text { flex: 1; font-size: 14px; line-height: 1.45; color: var(--muted); }
.drop__text strong { color: var(--black); font-weight: 600; }
.drop__text small { font-size: 12px; color: var(--faint); }
.drop__preview { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--white); padding: 4px; }

.icons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (min-width: 560px) { .icons { grid-template-columns: repeat(10, 1fr); } }
.icon-btn {
    aspect-ratio: 1; display: grid; place-items: center; padding: 0;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); color: var(--black);
    transition: all .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--brand, var(--black)); }
.icon-btn.is-active { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.icon-btn svg { width: 22px; height: 22px; }
#brand-presets .icon-btn svg { width: 20px; height: 20px; }
.logo-settings .check { display: flex; }
.logo-settings { margin-top: 8px; }
.logo-settings .btn { margin-top: 12px; }

/* ---------- App (one-screen layout) ---------- */

body.page-tool { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.page-tool .nav { position: static; flex: none; border-bottom-color: var(--line); }
.page-tool .nav__inner { height: 60px; }
.page-tool main { flex: 1; min-height: 0; }
.page-tool .footer { flex: none; }

.app {
    height: 100%; display: grid; gap: 28px;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
    padding-top: 24px; padding-bottom: 24px;
}
.app__controls { display: flex; flex-direction: column; gap: 20px; min-width: 0; min-height: 0; }
.app__intro h1 {
    margin: 0; font-size: clamp(28px, 3.4vw, 46px); line-height: 1.02; font-weight: 700; letter-spacing: -.045em; color: var(--black);
}
.app__intro h1 em { font-style: normal; font-weight: 300; }
.app__intro p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.card {
    flex: 1; min-height: 0; min-width: 0; margin: 0; padding: 0;
    display: flex; flex-direction: column;
    border: 1px solid var(--line-strong); border-radius: 20px; background: var(--white); overflow: hidden;
}
.tabs { flex: none; display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1 0 auto; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 54px; padding: 0 16px; border: 0; background: none;
    font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: color .15s;
}
.tab:hover { color: var(--black); }
.tab__num {
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 11px; transition: all .15s;
}
.tab.is-active { color: var(--black); }
.tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--black); }
.tab.is-active .tab__num { background: var(--black); border-color: var(--black); color: var(--white); }
.card__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 24px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.panel { margin: 0; padding: 0; border: 0; min-width: 0; }
.panel.is-open { animation: reveal .25s var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.app__preview { display: flex; min-height: 0; min-width: 0; }
.preview {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    padding: 18px; border-radius: 20px; background: var(--white);
    border: 1px solid var(--line-strong);
    box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 24px 48px -24px rgba(0,0,0,.18);
}
.preview__stage {
    flex: 1; min-height: 160px; position: relative; display: grid; place-items: center;
    container-type: size; border-radius: 14px; overflow: hidden;
    background-color: var(--soft);
    background-image:
        linear-gradient(45deg, #ececec 25%, transparent 25%), linear-gradient(-45deg, #ececec 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ececec 75%), linear-gradient(-45deg, transparent 75%, #ececec 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.preview__qr { width: min(86cqw, 86cqh); height: min(86cqw, 86cqh); display: grid; place-items: center; transition: opacity .2s; }
.preview__qr svg, .preview__qr canvas { width: 100% !important; height: 100% !important; border-radius: 4px; }
.preview__qr.is-empty { opacity: .15; }
.preview__data {
    flex: none; margin: 12px 0 0; font-family: var(--mono); font-size: 12px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; min-height: 18px;
}
.preview .field--compact { flex: none; margin: 12px 0 10px; }
.dl { flex: none; display: grid; gap: 8px; }
.dl__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dl__row .btn { padding: 0 6px; font-size: 13px; height: 40px; }
.preview .link-btn { flex: none; display: block; margin: 10px auto 0; }

/* Short desktop screens */
@media (min-width: 960px) and (max-height: 760px) {
    .app { padding-top: 16px; padding-bottom: 16px; gap: 20px; }
    .app__controls { gap: 14px; }
    .app__intro h1 { font-size: 30px; }
    .app__intro p { display: none; }
    .preview .field--compact { display: none; }
}

/* Tablet & mobile: preview on top, controls fill the rest */
@media (max-width: 959px) {
    .page-tool .nav__inner { height: 52px; }
    .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding-top: 12px; padding-bottom: 12px; }
    .app__preview { order: -1; }
    .app__intro { display: none; }
    .preview { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 14px; padding: 12px; border-radius: 16px; }
    .preview__stage { --s: clamp(112px, 34vw, 200px); grid-row: 1 / span 3; width: var(--s); height: var(--s); min-height: 0; border-radius: 10px; }
    .preview__data { display: none; }
    .preview .field--compact { margin: 0 0 8px; }
    .preview .field--compact > span { display: none; }
    .dl .btn--block { height: 40px; font-size: 14px; }
    .dl__row { grid-template-columns: repeat(2, 1fr); }
    .dl__row .btn { height: 34px; }
    .preview .link-btn { grid-column: 2; margin: 6px 0 0; text-align: left; font-size: 12px; }
    .tab { flex: 1 0 auto; height: 48px; padding: 0 12px; font-size: 13px; }
    .card__body { padding: 18px 16px 20px; }
    .page-tool .footer__inner { min-height: 40px; justify-content: center; font-size: 12px; }
    .page-tool .footer__inner > span { display: none; }
}
@media (max-width: 520px) { .tab__num { display: none; } .tab { flex: 1 1 auto; padding: 0 8px; } }
@media (min-width: 600px) and (max-width: 959px) { .dl__row { grid-template-columns: repeat(4, 1fr); } }
