:root {
  --bg: #0c0f11;
  --panel: #15191c;
  --panel-2: #1a1f23;
  --line: #32393e;
  --line-soft: #252b2f;
  --text: #f2f4f5;
  --muted: #aab1b6;
  --gold: #d2aa52;
  --gold-soft: #8e7134;
  --green: #65b45c;
  --red: #d35b58;
  --radius: 16px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(210, 170, 82, 0.09), transparent 28rem),
    linear-gradient(180deg, #101316 0%, #0b0e10 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.drop-zone:focus-visible {
  outline: 3px solid rgba(210, 170, 82, 0.62);
  outline-offset: 2px;
}

.app-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  letter-spacing: 0.08em;
}

.brand-main {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 37px;
  letter-spacing: 0.12em;
}

.brand-main::first-letter {
  color: var(--gold);
}

.brand-sub {
  margin-top: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.34em;
  color: var(--gold);
}

.header-copy h1,
.panel-heading h2,
.dialog-heading h2 {
  margin: 0;
}

.header-copy h1 {
  font-size: clamp(23px, 2vw, 31px);
  letter-spacing: -0.02em;
}

.header-copy p,
.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #dce7dd;
  background: rgba(101, 180, 92, 0.06);
  font-size: 13px;
  font-weight: 700;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(101, 180, 92, 0.1);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(540px, 0.96fr) minmax(520px, 1.04fr);
  gap: 22px;
  width: min(1480px, calc(100% - 40px));
  margin: 22px auto 0;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26, 31, 35, 0.98), rgba(18, 22, 25, 0.98));
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.22);
}

.controls-panel,
.preview-panel {
  padding: 24px;
}

.preview-panel {
  position: sticky;
  top: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin-top: 2px;
  font-size: 23px;
}

.eyebrow {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field-group,
.input-field,
.crop-controls {
  display: block;
  margin-top: 22px;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: #eef1f2;
  font-size: 14px;
  font-weight: 800;
}

.field-hint,
.input-field small,
.helper-text {
  color: var(--muted);
  font-size: 12px;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.label-row .field-label {
  margin-bottom: 9px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.room-button,
.result-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121619;
  color: #d9dddf;
  font-weight: 780;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.room-button:hover,
.result-button:hover {
  border-color: #525c62;
}

.room-button:active,
.result-button:active,
.button:active {
  transform: translateY(1px);
}

.room-button.is-active {
  color: #fff8e7;
  border-color: var(--gold);
  background: linear-gradient(180deg, #8f7138, #6e5528);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 0 0 1px rgba(210,170,82,0.08);
}

.room-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  vertical-align: -5px;
  font-weight: 900;
}

.room-icon-bars {
  border: 2px solid currentColor;
  border-top: 0;
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 6px);
}

.room-icon-cross {
  font-size: 22px;
}

.result-button.is-active.is-success {
  color: #dff4dc;
  border-color: var(--green);
  background: rgba(101, 180, 92, 0.12);
}

.result-button.is-active.is-failure {
  color: #ffe1df;
  border-color: var(--red);
  background: rgba(211, 91, 88, 0.12);
}

.drop-zone {
  overflow: hidden;
  border: 1px dashed #586168;
  border-radius: 12px;
  background: #0f1315;
  transition: border-color 120ms ease, background 120ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--gold);
  background: rgba(210, 170, 82, 0.06);
}

.crop-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.03) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(315deg, rgba(255,255,255,0.03) 25%, transparent 25%) 0 0 / 22px 22px,
    #111518;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.crop-stage.is-dragging {
  cursor: grabbing;
}

.photo-image {
  position: absolute;
  max-width: none;
  max-height: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  will-change: left, top, width, height, filter;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 18px;
  text-align: center;
  color: #d8dde0;
  background:
    radial-gradient(circle at center, rgba(210, 170, 82, 0.07), transparent 55%);
}

.photo-placeholder small,
.photo-placeholder span {
  color: var(--muted);
}

.placeholder-camera {
  position: relative;
  width: 42px;
  height: 29px;
  margin-bottom: 7px;
  border: 2px solid var(--gold);
  border-radius: 6px;
}

.placeholder-camera::before {
  content: "";
  position: absolute;
  left: 10px;
  top: -7px;
  width: 17px;
  height: 7px;
  border: 2px solid var(--gold);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.placeholder-camera::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--gold);
  border-radius: 50%;
}

.crop-grid {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 33.1%, rgba(255,255,255,0.26) 33.2%, rgba(255,255,255,0.26) 33.5%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,0.26) 66.5%, rgba(255,255,255,0.26) 66.8%, transparent 66.9%),
    linear-gradient(0deg, transparent 33.1%, rgba(255,255,255,0.26) 33.2%, rgba(255,255,255,0.26) 33.5%, transparent 33.6%, transparent 66.4%, rgba(255,255,255,0.26) 66.5%, rgba(255,255,255,0.26) 66.8%, transparent 66.9%);
  transition: opacity 120ms ease;
}

.crop-stage:hover .crop-grid,
.crop-stage.is-dragging .crop-grid {
  opacity: 1;
}

.drop-zone-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid var(--line-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease, opacity 120ms ease;
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.button-secondary {
  border-color: var(--line);
  background: #1a2024;
}

.button-secondary:hover:not(:disabled) {
  border-color: #5b666d;
  background: #20272b;
}

.button-ghost,
.button-text {
  color: #d3d9dc;
  background: transparent;
  border-color: var(--line);
}

.button-text {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
}

.button-text:hover:not(:disabled) {
  color: #fff;
  background: rgba(255,255,255,0.04);
}

.button-primary {
  width: 100%;
  min-height: 54px;
  margin-top: 22px;
  color: #211a0d;
  border-color: #ebc76f;
  background: linear-gradient(180deg, #dfbc65, #c89d41);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.36), 0 10px 22px rgba(0,0,0,0.2);
  font-size: 16px;
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #e8c875, #d1a84d);
}

.crop-controls {
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255,255,255,0.018);
}

.helper-text {
  margin: -3px 0 14px;
}

.range-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 58px;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  color: #dbe0e2;
  font-size: 13px;
}

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

.range-row output {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.input-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111518;
}

.input-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(210,170,82,0.08);
}

.input-icon {
  display: grid;
  place-items: center;
  width: 46px;
  align-self: stretch;
  color: var(--gold);
  border-right: 1px solid var(--line-soft);
  font-size: 20px;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 0;
  outline: 0;
  color: #f4f6f7;
  background: transparent;
  font-variant-numeric: tabular-nums;
}

.input-wrap select {
  cursor: pointer;
}


.static-note {
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111518;
}

.static-note strong {
  display: block;
  color: #f4f6f7;
  font-size: 14px;
  line-height: 1.35;
}

.static-note small {
  display: block;
  margin-top: 6px;
}

.input-field small {
  display: block;
  margin-top: 7px;
}

.copies-field {
  max-width: 330px;
}

.validation-message {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 91, 88, 0.58);
  border-radius: 9px;
  color: #ffd9d7;
  background: rgba(211, 91, 88, 0.1);
  font-size: 13px;
  font-weight: 700;
}

.print-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.preview-heading {
  align-items: center;
}

.preview-count {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #111518;
  font-size: 12px;
  white-space: nowrap;
}

.preview-count strong {
  color: var(--gold);
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 555px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background:
    linear-gradient(45deg, #121619 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(-45deg, #121619 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(45deg, transparent 75%, #121619 75%) -12px 0/24px 24px,
    linear-gradient(-45deg, transparent 75%, #121619 75%) -12px 0/24px 24px,
    #0e1113;
}

.preview-card-host {
  width: min(100%, 580px);
}

.preview-card-host .souvenir-card {
  width: 100%;
  aspect-ratio: 98 / 93.67;
  font-size: clamp(8px, 1.1vw, 13px);
  box-shadow: 0 28px 55px rgba(0,0,0,0.48);
}

.sheet-summary,
.privacy-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 17px;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255,255,255,0.018);
}

.sheet-summary p,
.privacy-box p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sheet-miniature {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, 22px);
  grid-template-rows: repeat(3, 21px);
  gap: 2px;
  padding: 4px;
  border: 1px solid #c9c9c9;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.sheet-miniature span {
  border: 1px solid #777;
  background: linear-gradient(135deg, #777, #b4b4b4);
  opacity: 1;
}

.sheet-miniature span.is-empty {
  opacity: 0.08;
}

.privacy-box {
  border-color: rgba(101, 180, 92, 0.25);
  background: rgba(101, 180, 92, 0.045);
}

.privacy-box-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #dff3dc;
  background: rgba(101, 180, 92, 0.13);
  font-size: 24px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  width: min(1480px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 16px 0 24px;
  color: #777f84;
  font-size: 11px;
}

/* ---------- Souvenir card base ---------- */
.souvenir-card {
  --card-bg: #e7e1d6;
  --card-ink: #1a1b1b;
  --card-accent: #8f2925;
  --card-secondary: #39423d;
  position: relative;
  display: grid;
  grid-template-rows: 20.5% 53.5% 10.5% 15.5%;
  overflow: hidden;
  color: var(--card-ink);
  border: 0.8px solid rgba(20,20,20,0.9);
  border-radius: 2.5%;
  background: var(--card-bg);
  isolation: isolate;
  container-type: inline-size;
}

.card-noise {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.46;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(0,0,0,0.15) 0 0.45%, transparent 0.6%),
    radial-gradient(circle at 79% 25%, rgba(255,255,255,0.32) 0 0.55%, transparent 0.7%),
    radial-gradient(circle at 36% 83%, rgba(0,0,0,0.1) 0 0.45%, transparent 0.65%),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(0,0,0,0.018) 4px 5px),
    linear-gradient(125deg, rgba(255,255,255,0.16), transparent 35%, rgba(0,0,0,0.08));
  background-size: 31px 29px, 27px 33px, 39px 35px, auto, auto;
}

.rivet {
  position: absolute;
  z-index: 5;
  width: 2.2%;
  aspect-ratio: 1;
  min-width: 4px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.65);
  background: radial-gradient(circle at 35% 30%, #fafafa, #858585 32%, #2b2b2b 70%, #111);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.rivet-tl { left: 1.2%; top: 1.3%; }
.rivet-tr { right: 1.2%; top: 1.3%; }
.rivet-bl { left: 1.2%; bottom: 1.3%; }
.rivet-br { right: 1.2%; bottom: 1.3%; }

.card-header {
  position: relative;
  padding: 2.7% 5.2% 1.2%;
  text-align: center;
}

.card-title-row {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2%;
}

.card-title {
  margin: 0;
  color: #111;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 11.7cqw;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.035em;
  text-shadow: 0.5px 0 rgba(255,255,255,0.45);
}

.card-subtitle {
  margin-top: 1%;
  color: var(--card-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.6cqw;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.22em;
}

.patient-file-number {
  position: absolute;
  right: 4.4%;
  top: 6%;
  display: none;
  color: #4b4b43;
  font-family: "Courier New", monospace;
  font-size: 1.8cqw;
  text-align: left;
  line-height: 1.1;
}

.patient-file-number strong {
  display: block;
}

.theme-symbol {
  display: block;
  width: 14%;
  height: 4.8cqw;
  margin-bottom: 0.4%;
  background:
    linear-gradient(165deg, transparent 0 36%, #1c1c1c 37% 48%, transparent 49%) 0 100% / 100% 75% no-repeat,
    linear-gradient(90deg, transparent 0 8%, #1c1c1c 9% 25%, transparent 26% 35%, #1c1c1c 36% 52%, transparent 53% 61%, #1c1c1c 62% 85%, transparent 86%) 0 100% / 100% 45% no-repeat;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.32));
}

.card-photo {
  position: relative;
  align-self: stretch;
  overflow: hidden;
  margin: 0 3.4%;
  border: 1.2cqw solid #272727;
  background: #171717;
  box-shadow: inset 0 0 0 0.4cqw rgba(255,255,255,0.86), 0 1px 3px rgba(0,0,0,0.5);
}

.card-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, rgba(0,0,0,0.04) 1px 3px),
    linear-gradient(90deg, rgba(40,48,44,0.14), transparent 35%, rgba(60,50,45,0.12));
  mix-blend-mode: overlay;
}

.card-photo-placeholder {
  gap: 2px;
  color: #c3c3c3;
  background: radial-gradient(circle, #3d3d3d, #181818);
  font-family: "Courier New", monospace;
  font-size: 3.2cqw;
  letter-spacing: 0.12em;
}

.card-photo-placeholder .placeholder-camera {
  width: 9cqw;
  height: 6cqw;
  margin: 0 0 2%;
  border-color: #969696;
}

.card-photo-placeholder .placeholder-camera::before,
.card-photo-placeholder .placeholder-camera::after {
  border-color: #969696;
}

.surveillance-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  color: #fff;
  font-family: "Courier New", monospace;
  font-size: 2.6cqw;
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

.camera-label,
.rec-label,
.camera-timecode {
  position: absolute;
}

.camera-label {
  left: 2.6%;
  top: 3.5%;
}

.camera-label i,
.rec-label i {
  display: inline-block;
  width: 1.8cqw;
  height: 1.8cqw;
  border-radius: 50%;
  background: #e52520;
  box-shadow: 0 0 4px rgba(229,37,32,0.85);
}

.rec-label {
  right: 2.5%;
  top: 3.5%;
}

.camera-timecode {
  left: 50%;
  bottom: 1.6%;
  padding: 0.3% 1.2%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.58);
  font-variant-numeric: tabular-nums;
}

.focus-corner {
  position: absolute;
  width: 7%;
  height: 14%;
  border-color: #fff;
  border-style: solid;
  border-width: 0;
}

.focus-tl { left: 2%; top: 5%; border-left-width: 0.55cqw; border-top-width: 0.55cqw; }
.focus-tr { right: 2%; top: 5%; border-right-width: 0.55cqw; border-top-width: 0.55cqw; }
.focus-bl { left: 2%; bottom: 5%; border-left-width: 0.55cqw; border-bottom-width: 0.55cqw; }
.focus-br { right: 2%; bottom: 5%; border-right-width: 0.55cqw; border-bottom-width: 0.55cqw; }

.result-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3%;
  margin: 1.3% 3.4% 0;
  padding: 0 2%;
  color: #f2eee4;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 45%),
    #171717;
  border: 0.6cqw solid #333;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 5cqw;
  line-height: 1;
  letter-spacing: 0.045em;
  text-align: center;
}

.result-text {
  white-space: nowrap;
}

.result-star {
  color: var(--card-accent);
  font-size: 3.9cqw;
}

.card-footer {
  display: grid;
  grid-template-columns: 24% 12% 32% 32%;
  align-items: center;
  margin: 0 3.4% 2.2%;
  border: 0.45cqw solid rgba(20,20,20,0.55);
  background: rgba(255,255,255,0.26);
}

.card-data {
  min-width: 0;
  padding: 2% 4%;
  text-align: center;
}

.card-data + .card-data,
.card-date-block {
  border-left: 0.35cqw solid rgba(20,20,20,0.32);
}

.data-label {
  display: block;
  font-family: "Courier New", monospace;
  font-size: 2.2cqw;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.card-time,
.card-date {
  display: block;
  margin-top: 2%;
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-size: 5.2cqw;
  line-height: 1;
  white-space: nowrap;
}

.card-date {
  font-size: 3.7cqw;
}

.room-seal {
  display: grid;
  place-items: center;
  width: 8.7cqw;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 0.65cqw double var(--card-accent);
  border-radius: 50%;
  color: var(--card-accent);
  transform: rotate(-8deg);
  box-shadow: inset 0 0 0 0.45cqw rgba(143,41,37,0.15);
}

.seal-mark {
  font-family: Georgia, serif;
  font-size: 5cqw;
  font-weight: 900;
}

.card-branding {
  min-width: 0;
  text-align: center;
}

.card-branding strong {
  display: block;
  font-family: Impact, Haettenschweiler, sans-serif;
  font-size: 5.3cqw;
  line-height: 0.9;
  letter-spacing: 0.08em;
}

.card-branding span {
  display: block;
  margin-top: 2%;
  font-size: 1.65cqw;
  font-weight: 900;
  letter-spacing: 0.25em;
}

/* ---------- Alcatraz ---------- */
.alcatraz-card {
  --card-bg: #ddd8cd;
  --card-ink: #171717;
  --card-accent: #922b27;
  --card-secondary: #333;
  border-color: #3c3c38;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.08), transparent 4%, transparent 96%, rgba(0,0,0,0.08)),
    linear-gradient(180deg, #eeeae1, #c9c4b8);
}

.alcatraz-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(0,0,0,0.018) 7px 8px),
    radial-gradient(circle at 14% 82%, rgba(116,71,38,0.14), transparent 24%),
    radial-gradient(circle at 88% 17%, rgba(0,0,0,0.09), transparent 19%);
}

.alcatraz-card.is-failure .result-banner {
  background: #2b1716;
  color: #ffe0dd;
  border-color: #7e302d;
}

.alcatraz-card.is-failure .result-star {
  color: #e05a55;
}

/* ---------- Heilstätte ---------- */
.heilstaette-card {
  --card-bg: #d8cba8;
  --card-ink: #2c3027;
  --card-accent: #7c2520;
  --card-secondary: #1c4d3b;
  grid-template-rows: 21.5% 52.5% 11% 15%;
  border-color: #4d4433;
  background:
    linear-gradient(90deg, rgba(51,39,22,0.12), transparent 5%, transparent 95%, rgba(51,39,22,0.12)),
    #d7c9a4;
}

.heilstaette-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(55,79,66,0.075) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(90deg, rgba(55,79,66,0.06) 1px, transparent 1px) 0 0 / 12px 12px,
    radial-gradient(circle at 82% 78%, rgba(99,40,25,0.12), transparent 23%),
    radial-gradient(circle at 12% 18%, rgba(57,74,47,0.13), transparent 28%);
}

.heilstaette-card .card-title {
  color: #183f31;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9.9cqw;
  letter-spacing: 0.065em;
}

.heilstaette-card .card-subtitle {
  color: #7b2a23;
  font-family: "Courier New", monospace;
  font-size: 3.4cqw;
  letter-spacing: 0.2em;
}

.heilstaette-card .theme-symbol {
  width: 7.5%;
  height: 7.5cqw;
  margin-left: 1%;
  margin-bottom: -0.5%;
  background: none;
  border: 0;
}

.heilstaette-card .theme-symbol::before,
.heilstaette-card .theme-symbol::after {
  content: "";
  position: absolute;
  background: #2c5947;
}

.heilstaette-card .theme-symbol::before {
  width: 2.1cqw;
  height: 7.4cqw;
  margin-left: 2.5cqw;
}

.heilstaette-card .theme-symbol::after {
  width: 7.2cqw;
  height: 2.1cqw;
  margin-top: 2.65cqw;
}

.heilstaette-card .patient-file-number {
  display: block;
}

.heilstaette-card .card-photo {
  margin-left: 10.5%;
  margin-right: 5.5%;
  border-color: #eee0bb;
  box-shadow: 0 0 0 0.5cqw rgba(57,49,37,0.72), 0 2px 4px rgba(0,0,0,0.38);
  transform: rotate(-0.35deg);
}

.heilstaette-card .card-photo::before {
  content: "AUFNAHME: unbekannt\A\A DIAGNOSE:\A Erschöpfung\A\A STATUS:\A archiviert";
  white-space: pre;
  position: absolute;
  z-index: 4;
  left: -12.1%;
  top: 4%;
  width: 10%;
  color: #4e493a;
  font-family: "Courier New", monospace;
  font-size: 1.25cqw;
  line-height: 1.35;
  text-align: left;
}

.heilstaette-card .card-photo::after {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, rgba(0,0,0,0.045) 1px 3px),
    linear-gradient(90deg, rgba(39,75,58,0.22), rgba(70,56,31,0.08));
  mix-blend-mode: color;
}

.heilstaette-card .result-banner {
  margin-left: 18%;
  margin-right: 18%;
  color: #7f241f;
  border: 0.65cqw solid #7f241f;
  background: rgba(237,224,190,0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 5.8cqw;
  transform: rotate(-1.1deg);
  box-shadow: inset 0 0 0 0.35cqw rgba(127,36,31,0.18);
}

.heilstaette-card .result-star {
  display: none;
}

.heilstaette-card .card-footer {
  grid-template-columns: 30% 14% 26% 30%;
  border-color: rgba(49,62,46,0.5);
  background: rgba(244,231,196,0.28);
}

.heilstaette-card .room-seal {
  border-color: #355b4b;
  color: #355b4b;
  box-shadow: inset 0 0 0 0.45cqw rgba(53,91,75,0.14);
}

.heilstaette-card .card-branding strong {
  color: #214f3e;
}

.heilstaette-card.is-failure .result-banner {
  color: #351f1c;
  font-size: 4.25cqw;
  border-color: #351f1c;
  background: rgba(116,45,40,0.16);
}

/* ---------- Print sheet ---------- */
.print-host {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 210mm;
  height: 297mm;
  visibility: hidden;
  pointer-events: none;
}

.print-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  color: #000;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/*
  Die sechs Karten werden bewusst absolut in Millimetern positioniert.
  Das verhindert Rundungs- und Fragmentierungsfehler einzelner
  Browser-/Druckertreiber, durch die zuvor die fünfte Karte unten
  abgeschnitten werden konnte.
*/
.print-grid {
  position: absolute;
  inset: 0;
  display: block;
}

.print-grid .print-cell {
  position: absolute;
  width: 97.75mm;
  height: 91.333mm;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-grid .print-cell:nth-child(1) { left: 6mm; top: 8mm; }
.print-grid .print-cell:nth-child(2) { left: 106.25mm; top: 8mm; }
.print-grid .print-cell:nth-child(3) { left: 6mm; top: 101.833mm; }
.print-grid .print-cell:nth-child(4) { left: 106.25mm; top: 101.833mm; }
.print-grid .print-cell:nth-child(5) { left: 6mm; top: 195.666mm; }
.print-grid .print-cell:nth-child(6) { left: 106.25mm; top: 195.666mm; }

.print-grid .souvenir-card {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 1.3mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-grid .print-cell.is-empty {
  background: #fff;
}

.cut-line {
  position: absolute;
  z-index: 20;
  opacity: 0.58;
  pointer-events: none;
}

.cut-line-v {
  left: 105mm;
  top: 4.5mm;
  bottom: 5.5mm;
  border-left: 0.25mm dashed #4a4a4a;
}

.cut-line-h {
  left: 3.5mm;
  right: 3.5mm;
  border-top: 0.25mm dashed #4a4a4a;
}

.cut-line-h1 { top: 100.583mm; }
.cut-line-h2 { top: 194.416mm; }

.scissor {
  position: absolute;
  z-index: 21;
  color: #333;
  background: #fff;
  font-family: sans-serif;
  font-size: 3.3mm;
  line-height: 1;
}

.scissor-top { left: 102.8mm; top: 2.2mm; }
.scissor-left-1 { left: 1.1mm; top: 98.55mm; transform: rotate(90deg); }
.scissor-left-2 { left: 1.1mm; top: 192.38mm; transform: rotate(90deg); }
.scissor-bottom { left: 102.8mm; bottom: 2.2mm; }

/* ---------- Print dialog ---------- */
.print-dialog {
  width: min(900px, calc(100% - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: #15191c;
  box-shadow: 0 35px 100px rgba(0,0,0,0.65);
}

.print-dialog::backdrop {
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 22px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #cfd4d6;
  background: #111518;
  font-size: 25px;
  cursor: pointer;
}

.dialog-preview {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 210 / 297;
  margin: 20px auto;
  overflow: hidden;
  border: 1px solid #d2d2d2;
  background: #fff;
  box-shadow: 0 14px 35px rgba(0,0,0,0.38);
}

.dialog-preview .dialog-sheet-scaler {
  position: absolute;
  left: 0;
  top: 0;
  width: 210mm;
  height: 297mm;
  transform-origin: top left;
}

.dialog-instructions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  padding: 13px 15px;
  border: 1px solid rgba(210,170,82,0.3);
  border-radius: 9px;
  color: #e8ddc4;
  background: rgba(210,170,82,0.06);
  font-size: 13px;
}

.dialog-instructions span {
  color: var(--muted);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.dialog-actions .button {
  width: 100%;
  min-height: 48px;
  margin: 0;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .preview-stage {
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .app-header {
    grid-template-columns: 1fr auto;
    width: min(100% - 24px, 1480px);
    gap: 14px;
  }

  .brand {
    display: none;
  }

  .header-copy p {
    font-size: 12px;
  }

  .privacy-pill {
    padding: 0 10px;
    font-size: 0;
  }

  .privacy-pill::after {
    content: "Lokal";
    font-size: 12px;
  }

  .app-shell,
  .app-footer {
    width: min(100% - 24px, 1480px);
  }

  .controls-panel,
  .preview-panel {
    padding: 17px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone-actions {
    align-items: stretch;
  }

  .drop-zone-actions .button {
    flex: 1 1 180px;
  }

  .panel-heading {
    align-items: center;
  }

  .preview-count {
    display: none;
  }

  .preview-stage {
    min-height: 330px;
    padding: 12px;
  }

  .range-row {
    grid-template-columns: 72px 1fr 50px;
    gap: 8px;
  }

  .app-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body > *:not(.print-host) {
    display: none !important;
  }

  .print-host {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    display: block !important;
    visibility: visible !important;
    width: 210mm !important;
    height: 297mm !important;
    pointer-events: auto !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-sheet {
    width: 210mm !important;
    height: 297mm !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}


.digital-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.digital-config-grid {
  margin-top: 10px;
}

.digital-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101518;
  color: #dbe0e2;
  font-size: 13px;
  line-height: 1.45;
}

.status-box.is-error {
  border-color: rgba(211, 91, 88, 0.58);
  color: #ffd9d7;
  background: rgba(211, 91, 88, 0.10);
}

.status-box.is-success {
  border-color: rgba(101, 180, 92, 0.58);
  color: #dff4dc;
  background: rgba(101, 180, 92, 0.10);
}

.download-result {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1315;
}

.qr-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}

.qr-code-host {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}

.qr-code-host canvas,
.qr-code-host img {
  display: block;
  width: 220px !important;
  height: 220px !important;
}

.qr-panel strong {
  display: block;
  margin-bottom: 6px;
  color: #f3f6f7;
}

.qr-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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