:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --panel-border: #d5dde4;
    --text: #1e2930;
    --muted: #5f7380;
    --accent: #1279b8;
    --accent-soft: #e1f0f8;
    --danger: #af2f40;
    --shadow: 0 3px 10px rgba(20, 39, 54, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    background: radial-gradient(circle at 20% 20%, #ffffff, var(--bg));
    color: var(--text);
    line-height: 1.4;
}

.app-header {
    padding: 1.25rem 1rem 0.5rem;
    max-width: 1200px;
    margin-inline: auto;
    width: 100%;
}

.app-header h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
}

.app-header p {
    margin: 0.5rem 0 0;
    color: var(--muted);
}

.app-layout {
    display: grid;
    gap: 1rem;
    padding: 0.75rem 1rem 1rem;
    max-width: 1200px;
    margin-inline: auto;
    width: 100%;
}

.face-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.75rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.panel h2 {
    margin: 0;
    font-size: 1rem;
}

.file-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.file-input {
    width: 100%;
    font-size: 0.9rem;
}

.face-panel {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.face-canvas,
.strip-canvas {
    width: 100%;
    height: auto;
    display: block;
    margin-top: 0;
}

.strip-canvas {
    border: 1px solid #d9e2e8;
    border-radius: 8px;
    background: #fbfcfd;
}

.face-canvas {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.face-canvas {
    touch-action: none;
    user-select: none;
}

.face-tool-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid #e6edf3;
}

.face-tool-row .file-label {
    min-width: 6.25rem;
}

.face-tool-row .file-input {
    flex: 1;
}

.face-tool-row--compact {
    justify-content: space-between;
}

.face-tool-row--reset button {
    margin-left: auto;
}

.bg-color-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
}

.bg-color-label input[type="color"] {
    width: 28px;
    height: 28px;
    padding: 2px;
    border: 1px solid #a9bcc9;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.face-tool-row--compact .bg-color-label {
    min-width: 0;
}

.face-controls,
.strip-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.paper-size-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.paper-size-select {
    border: 1px solid #a9bcc9;
    background: #ffffff;
    color: var(--text);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.drag-mode-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0;
    padding-top: 0.45rem;
    border-top: 1px solid #e6edf3;
}

.drag-mode-help {
    margin: -0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.35;
    min-height: calc(1.35em * 2);
}

.drag-mode-label {
    font-size: 0.82rem;
    color: var(--muted);
}

.mode-btn {
    padding: 0.32rem 0.55rem;
    border-radius: 999px;
    font-size: 0.82rem;
    line-height: 1;
}

.mode-btn--active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

button {
    border: 1px solid #a9bcc9;
    background: linear-gradient(#ffffff, #eff5f9);
    color: var(--text);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
}

button:hover:enabled {
    border-color: var(--accent);
    background: var(--accent-soft);
}

button:disabled {
    color: #8798a4;
    cursor: not-allowed;
}

.below-fold {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem 1.5rem;
    max-width: 1200px;
    margin-inline: auto;
    width: 100%;
}

.below-fold .panel h2 {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
}

.below-fold .panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.1rem 0 0.25rem;
    color: var(--heading, #1a2530);
}

/* ── Examples section ────────────────────────────────────────────────────── */

.examples-grid {
    display: grid;
    gap: 1rem;
    margin-top: 0.85rem;
    max-width: 900px;
    margin-inline: auto;
}

.example-card {
    margin: 0;
    border: 1px solid #d7e1ea;
    border-radius: 10px;
    overflow: hidden;
    background: #f7fafc;
    max-width: 760px;
    justify-self: center;
    width: 100%;
}

.example-faces {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.example-faces img {
    width: 100%;
    aspect-ratio: 5 / 4;
    object-fit: cover;
    display: block;
}

.example-faces img:not(:last-child) {
    border-right: 1px solid #d7e1ea;
}

.example-card--contain .example-faces img {
    object-fit: cover;
    aspect-ratio: 1;
}

.example-card figcaption {
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    color: var(--muted);
    border-top: 1px solid #d7e1ea;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.example-download {
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.example-download:hover {
    text-decoration: underline;
}

.status-log {
    display: none;
}

.strip-panel {
    overflow: hidden;
}

.assembly-steps {
    margin: 0.65rem 0 0;
    padding-left: 1.25rem;
    color: var(--text);
}

.assembly-steps li {
    margin-bottom: 0.45rem;
}

.assembly-gallery {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
    max-width: 760px;
    margin-inline: auto;
}

.assembly-gallery figure {
    margin: 0;
    border: 1px solid #d7e1ea;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafc;
}

.assembly-gallery img {
    width: 100%;
    height: 210px;
    object-fit: contain;
    display: block;
    background: #ffffff;
}

.assembly-gallery figcaption {
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.35rem 0.45rem 0.4rem;
}

.video-fallback {
    margin: 0.5rem 0 0;
    font-size: 0.84rem;
    color: var(--muted);
}

.video-fallback a {
    color: var(--accent);
    text-decoration: underline;
}

.assembly-video {
    margin-top: 0.85rem;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d7e1ea;
}

.assembly-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Text controls ───────────────────────────────────────────────────────── */

.text-controls {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.45rem;
    border-top: 1px solid #e6edf3;
}

.face-text-input {
    width: 100%;
    resize: vertical;
    border: 1px solid #a9bcc9;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
}

.face-text-input:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}

.emoji-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.emoji-hint kbd {
    display: inline-block;
    padding: 0.05rem 0.3rem;
    border: 1px solid #b0c0cc;
    border-radius: 4px;
    background: #f4f8fb;
    font-size: 0.75rem;
    font-family: inherit;
    line-height: 1.4;
}

.text-format-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.text-size-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.face-fontsize {
    width: 54px;
    padding: 0.25rem 0.3rem;
    border: 1px solid #a9bcc9;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
}

.face-fontfamily {
    flex: 1;
    min-width: 0;
    padding: 0.28rem 0.4rem;
    border: 1px solid #a9bcc9;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    color: var(--text);
}

.fmt-btn {
    min-width: 32px;
    padding: 0.3rem 0.5rem;
    font-size: 0.95rem;
    border: 1px solid #a9bcc9;
    border-radius: 6px;
    background: linear-gradient(#ffffff, #eff5f9);
    cursor: pointer;
    line-height: 1;
}

.fmt-btn--active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.45rem 1rem 1.5rem;
    text-align: center;
    font-size: 0.86rem;
    color: var(--muted);
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}