/* Bon-Drucker – Weboberfläche im Look eines Kassenbons */

:root {
    --desk: #c9cdd1;
    --desk-2: #bfc3c8;
    --paper: #fffefa;
    --ink: #1c1c1a;
    --muted: #6d6c67;
    --line: #1c1c1a;
    --ok: #17692f;
    --err: #a8231b;
    --mono: "Courier Prime", "Courier New", Courier, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    padding: 44px 14px 64px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 50% -10%, #dfe2e5 0%, transparent 70%),
        repeating-linear-gradient(45deg, var(--desk) 0 6px, var(--desk-2) 6px 12px);
}

/* ---- Bon ------------------------------------------------------------------ */

.receipt {
    position: relative;
    width: 100%;
    max-width: 430px;
    padding: 38px 26px 34px;
    background: var(--paper);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 18px 40px -14px rgba(0, 0, 0, .35);
}

/* gezackte Abrisskanten oben und unten */
.receipt::before,
.receipt::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 9px;
    background-repeat: repeat-x;
    background-size: 18px 9px;
}
.receipt::before {
    top: -9px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='9' viewBox='0 0 18 9'%3E%3Cpath d='M0 9h18L9 0z' fill='%23fffefa'/%3E%3C/svg%3E");
}
.receipt::after {
    bottom: -9px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='9' viewBox='0 0 18 9'%3E%3Cpath d='M0 0h18L9 9z' fill='%23fffefa'/%3E%3C/svg%3E");
}

.head { text-align: center; }

.head h1 {
    margin: 0;
    font-size: 54px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.recipient {
    margin: 18px 0 0;
    font-size: 14px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dash {
    margin: 20px 0 18px;
    border: 0;
    border-top: 2px dashed var(--line);
}

/* ---- Meta-Zeilen ------------------------------------------------------------ */

.meta { margin: 0 0 16px; }
.meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 1px 0;
}
.meta dt, .meta dd { margin: 0; text-transform: uppercase; }

.switch {
    display: inline-block;
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.switch:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* ---- Meldungen ---------------------------------------------------------------- */

.flash {
    margin: 0 0 16px;
    padding: 9px 12px;
    font-size: 14px;
    border: 2px solid currentColor;
}
.flash.ok  { color: var(--ok);  background: #eef8f0; }
.flash.err { color: var(--err); background: #fdf0ee; }

/* ---- Formular ------------------------------------------------------------------ */

textarea,
input[type="text"],
input[type="password"],
select {
    width: 100%;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 2px solid var(--line);
    border-radius: 0;
    padding: 10px 12px;
    outline: none;
}

textarea { resize: vertical; min-height: 190px; line-height: 1.4; }

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    box-shadow: 4px 4px 0 var(--ink);
}

::placeholder { color: #a09f99; }

.counter-row {
    display: flex;
    justify-content: space-between;
    margin: 6px 0 18px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--muted);
}
#counter.warn { color: #9a5b00; }
#counter.over { color: var(--err); font-weight: 700; }

.field { display: block; margin: 0 0 14px; }
.field > span {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---- Bild-Upload -------------------------------------------------------------- */

.drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 0 14px;
    padding: 26px 14px;
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--line);
    transition: background .15s;
}
.drop:hover, .drop.hover { background: #f1efe6; }
.drop-icon { font-size: 30px; line-height: 1; }
.drop-text { font-weight: 700; overflow-wrap: anywhere; }
.drop-sub { font-size: 12px; color: var(--muted); }
.sr-only:focus + .preview, #image:focus-visible ~ .drop { outline: 2px solid var(--ink); }

.preview {
    margin: 0 0 14px;
    padding: 12px;
    text-align: center;
    background: #efede4;
    border: 2px solid var(--line);
    position: relative;
}
.preview img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.preview.loading img { opacity: .35; }
.preview.loading::after {
    content: "Vorschau wird berechnet …";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 13px;
    text-transform: uppercase;
}
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.hint.err { color: var(--err); }

.opts { margin: 0 0 14px; display: grid; gap: 10px; }
.opt { display: grid; gap: 4px; }
.opt > span { font-size: 13px; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.opt output { color: var(--ink); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
input[type="range"] { width: 100%; accent-color: var(--ink); }

/* ---- Danke-Block + Button -------------------------------------------------------- */

.stars {
    margin: 4px 0;
    overflow: hidden;
    white-space: nowrap;
    text-align: center;
    letter-spacing: .02em;
}
.thanks {
    margin: 12px 0 2px;
    text-align: center;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.thanks-sub {
    margin: 0 0 12px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.send {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 15px 18px;
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--paper);
    background: var(--ink);
    border: 2px solid var(--ink);
    border-radius: 0;
    cursor: pointer;
    transition: transform .08s, box-shadow .08s;
}
.send:hover { box-shadow: 4px 4px 0 #8b8a84; transform: translate(-2px, -2px); }
.send:active { transform: none; box-shadow: none; }
.send:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }

.notes {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.notes p { margin: 2px 0; }

/* ---- Hilfsklassen ------------------------------------------------------------------ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 480px) {
    body { padding: 28px 10px 48px; }
    .receipt { padding: 32px 18px 28px; }
    .head h1 { font-size: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
