@font-face {
    font-family: "XOverlayNotoSansJP";
    src: url("fonts/NotoSansJP-Medium.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "XOverlayMPLUSRounded1c";
    src: url("fonts/MPLUSRounded1c-Medium.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "XOverlayKiwiMaru";
    src: url("fonts/KiwiMaru-Medium.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "XOverlayYuseiMagic";
    src: url("fonts/YuseiMagic-Regular.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "XOverlayMakiba";
    src: url("fonts/MakibaFont13.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "XOverlayHuiFont";
    src: url("fonts/HuiFontP29.ttf") format("truetype");
    font-display: swap;
}

:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #ece7f0;
    color: #312d36;
    --bg: #ece7f0;
    --panel: rgba(250, 247, 252, 0.90);
    --panel-solid: #faf7fc;
    --section: rgba(244, 239, 247, 0.92);
    --text: #312d36;
    --muted: #6f6876;
    --accent: #e779aa;
    --accent-2: #7e95e8;
    --accent-3: #62bdae;
    --line: rgba(112, 92, 119, 0.20);
    --shadow: rgba(54, 42, 64, 0.18);
}
* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 10%, rgba(231, 121, 170, 0.24), transparent 28rem),
        radial-gradient(circle at 88% 12%, rgba(126, 149, 232, 0.22), transparent 30rem),
        radial-gradient(circle at 70% 88%, rgba(98, 189, 174, 0.18), transparent 24rem),
        linear-gradient(135deg, #eee8f1 0%, #e8e8f3 54%, #e5f0ed 100%);
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 24px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(231, 121, 170, 0.15);
    color: #9d3d68;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "✦";
    color: var(--accent);
}

h1, h2, p {
    margin-top: 0;
}

h1 {
    font-size: clamp(30px, 4vw, 48px);
    margin-bottom: 10px;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.lead, .hint {
    color: var(--muted);
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 22px 70px var(--shadow);
    backdrop-filter: blur(18px);
}

.section {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--section);
    margin-bottom: 18px;
}

.grid {
    display: grid;
    gap: 24px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: #4a424d;
    font-weight: 700;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    cursor: pointer;
}

.check-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.disabled-block {
    opacity: 0.42;
}

.disabled-block input,
.disabled-block select {
    cursor: not-allowed;
}

input[type="text"],
input[type="url"],
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(181, 139, 166, 0.34);
    background: #f8f3fa;
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(126, 79, 104, 0.06);
    outline: none;
}

select {
    appearance: none;
    background-color: #f8f3fa;
    background-image:
        linear-gradient(45deg, transparent 50%, #a65d83 50%),
        linear-gradient(135deg, #a65d83 50%, transparent 50%),
        linear-gradient(to right, rgba(255, 143, 189, 0.22), rgba(255, 143, 189, 0.22));
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 14px) calc(50% - 3px),
        calc(100% - 42px) 50%;
    background-size: 6px 6px, 6px 6px, 1px 1.8em;
    background-repeat: no-repeat;
    padding-right: 52px;
}

select option {
    background: #f8f3fa;
    color: #312d36;
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
    border-color: rgba(255, 143, 189, 0.86);
    box-shadow: 0 0 0 4px rgba(255, 143, 189, 0.16), 0 8px 18px rgba(126, 79, 104, 0.06);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

output {
    color: #a33e6a;
    font-weight: 900;
}

.file-drop {
    display: grid;
    place-items: center;
    min-height: 116px;
    border: 2px dashed rgba(255, 143, 189, 0.52);
    border-radius: 22px;
    cursor: pointer;
    background:
        linear-gradient(135deg, rgba(255, 143, 189, 0.14), rgba(142, 167, 255, 0.12));
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 143, 189, 0.78);
    background: linear-gradient(135deg, rgba(255, 143, 189, 0.20), rgba(142, 167, 255, 0.16));
}

.file-drop input {
    display: none;
}

.file-drop span {
    font-size: 18px;
    font-weight: 800;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.preview-stage {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin-top: 16px;
    border-radius: 20px;
    background: #15131a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.preview-stage video {
    display: block;
    width: 100%;
    height: 100%;
}

.overlay-layer {
    pointer-events: none;
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
}

.preview-text {
    position: absolute;
    left: 0;
    top: 0;
    white-space: nowrap;
    color: white;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: none;
    -webkit-text-stroke: 2px rgba(0, 0, 0, 0.72);
    paint-order: stroke fill;
    will-change: transform;
}

.qr-overlay {
    position: absolute;
    z-index: 5;
    background: #ffffff;
    padding: 0;
    border-radius: 8px;
    image-rendering: pixelated;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.qr-preview-wrap {
    display: inline-grid;
    place-items: center;
    padding: 14px;
    border: 1px solid rgba(181, 139, 166, 0.24);
    border-radius: 18px;
    background: #f8f3fa;
    box-shadow: 0 10px 24px rgba(126, 79, 104, 0.10);
}

#qrPreview {
    display: block;
    background: #ffffff;
    border-radius: 8px;
    image-rendering: pixelated;
}

.actions {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

button,
.button,
.secondary-button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 14px 22px;
    background: linear-gradient(135deg, #ff8fbd, #8ea7ff);
    color: #ffffff;
    font-weight: 900;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(255, 143, 189, 0.25);
}

.secondary-button {
    padding: 10px 16px;
    background: #f8f3fa;
    color: #884063;
    border: 1px solid rgba(255, 143, 189, 0.38);
    box-shadow: 0 8px 18px rgba(126, 79, 104, 0.08);
}

button:hover,
.button:hover,
.secondary-button:hover {
    filter: brightness(1.02);
    transform: translateY(-1px);
}

.secondary {
    color: #884063;
    text-decoration: none;
    font-weight: 800;
}

.result p {
    color: var(--muted);
}

pre {
    overflow: auto;
    max-height: 280px;
    padding: 16px;
    border-radius: 14px;
    background: #2f2b33;
    color: #fff4fa;
}

summary {
    color: #884063;
    font-weight: 800;
    cursor: pointer;
}

.busy {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(47, 43, 51, 0.58);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.busy[hidden] {
    display: none;
}

.busy-card {
    width: min(420px, calc(100% - 32px));
    padding: 28px;
    text-align: center;
    border-radius: 28px;
    background: rgba(250, 247, 252, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 24px 80px var(--shadow);
}

.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 4px solid rgba(255, 143, 189, 0.20);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 143, 189, 0.18);
}

.bar div {
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff8fbd, #8ea7ff);
    animation: indeterminate 1.2s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(280%); }
}

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

    .hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

.font-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 18, 28, 0.42);
    z-index: 40;
    border-radius: 18px;
    backdrop-filter: blur(1.5px);
}

.font-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-radius: 16px;
    background: rgba(31, 35, 49, 0.9);
    color: #f8f2ff;
    box-shadow: 0 18px 40px rgba(10, 8, 22, 0.28);
    font-size: 14px;
    line-height: 1.5;
}

.font-loading-card p {
    margin: 0;
}

.spinner.small {
    width: 28px;
    height: 28px;
    border-width: 3px;
}

.hidden-frame {
    display: none;
    width: 0;
    height: 0;
    border: 0;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 60;
    transform: translateX(-50%);
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(30, 25, 38, 0.92);
    color: #fff7fb;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    font-size: 14px;
}

.toast[hidden] {
    display: none;
}

.preview-section {
    margin-bottom: 0;
}

.preview-section .actions {
    margin-bottom: 16px;
}

.preview-section .actions button {
    min-width: 180px;
}

@media (max-width: 520px) {
    .preview-section .actions button {
        width: 100%;
    }
}

.queue-info {
    margin: 14px 0 0;
    color: var(--muted);
    font-weight: 800;
}

.site-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin: 42px 0 4px;
    color: var(--muted);
    font-size: 14px;
}

.site-footer a {
    color: var(--accent-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.site-footer .separator {
    color: var(--muted);
    opacity: 0.65;
}

.hero-icon {
    flex: 0 0 auto;
    width: 112px;
    height: 112px;
    border-radius: 26px;
    box-shadow: 0 18px 38px rgba(27, 24, 57, 0.22);
}

.hero-copy {
    flex: 1 1 auto;
}

@media (max-width: 760px) {
    .hero-icon {
        width: 96px;
        height: 96px;
    }
}

.font-select {
    font-size: 1.02rem;
}

.font-option.noto-sans-jp { font-family: "XOverlayNotoSansJP", sans-serif; }
.font-option.mplus-rounded { font-family: "XOverlayMPLUSRounded1c", sans-serif; }
.font-option.kiwi-maru { font-family: "XOverlayKiwiMaru", serif; }
.font-option.yusei-magic { font-family: "XOverlayYuseiMagic", cursive; }
.font-option.makiba { font-family: "XOverlayMakiba", cursive; }
.font-option.hui { font-family: "XOverlayHuiFont", cursive; }


.busy-ad {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(181, 139, 166, 0.22);
}

.busy-ad .ad-label {
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(55, 47, 62, 0.58);
    letter-spacing: 0.08em;
}

.busy-ad .adsbygoogle {
    display: block;
    width: 100%;
    min-height: 90px;
}

@media (max-width: 560px) {
    .busy-card {
        max-height: calc(100vh - 32px);
        overflow: auto;
    }

    .busy-ad .adsbygoogle {
        min-height: 80px;
    }
}
