:root {
  --navy: #001e5a;
  --navy-deep: #001440;
  --blue: #0d5bff;
  --ice: #f3f7ff;
  --mist: #e6eefc;
  --steel: #5a6b85;
  --ink: #0c1630;
  --white: #fff;
  --line: rgba(0, 30, 90, 0.1);
  --shadow: 0 18px 48px rgba(0, 30, 90, 0.12);
  --font: "Figtree", system-ui, sans-serif;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --top: 56px;
  --side: 340px;
  --insp: 220px;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #e8eef8;
  overflow: hidden;
}

button, select { font: inherit; }

.app {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  grid-template-rows: var(--top) 1fr;
  height: 100%;
}

.app:has(.inspector:not([hidden])) {
  grid-template-columns: var(--side) minmax(0, 1fr) var(--insp);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  z-index: 5;
  position: relative;
}

.topbar__title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--blue);
  white-space: nowrap;
  pointer-events: none;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.topbar__logo {
  display: block;
  height: 28px;
  width: auto;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}

.topbar__logo:hover {
  opacity: 0.82;
}

.topbar__logo:focus-visible {
  outline: 2px solid var(--blue, #0d5bff);
  outline-offset: 3px;
}

.topbar__logo img {
  display: block;
  height: 28px;
  width: auto;
}

.topbar__sep {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.topbar__brand strong {
  font-size: 0.92rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--mist);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.topbar__view {
  display: inline-flex;
  background: var(--ice);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.seg {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  color: var(--steel);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
}

.seg.is-active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0, 30, 90, 0.12);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  color: var(--navy);
  font-size: 1.1rem;
}

.icon-btn:hover { border-color: var(--blue); color: var(--blue); }

.icon-btn[data-action="toggle-sound"] {
  display: grid;
  place-items: center;
}

.icon-btn[data-action="toggle-sound"] svg {
  display: none;
}

.icon-btn[data-action="toggle-sound"].is-sound-on .ico-sound-on,
.icon-btn[data-action="toggle-sound"].is-sound-off .ico-sound-off {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: var(--ice);
  color: var(--navy);
  border: 1px solid var(--line);
}

.btn-danger {
  width: 100%;
  background: #fee2e2;
  color: #b91c1c;
  margin-top: 0.75rem;
}

.btn-xl {
  width: 100%;
  min-height: 48px;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.sidebar, .inspector {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 1rem 0.9rem 1rem;
  overflow-y: auto;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.sidebar__catalog {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
  justify-content: flex-start;
}

.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.inspector[hidden] {
  display: none !important;
}

.sidebar__label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  flex-shrink: 0;
}

.sidebar__group + .sidebar__group {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.tool__ico {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ice);
  border-radius: 10px;
  color: var(--navy);
  flex-shrink: 0;
}

.tool__ico svg {
  width: 24px;
  height: 24px;
  display: block;
}

.tool.is-active .tool__ico {
  background: rgba(13, 91, 255, 0.14);
  color: var(--blue);
}

.tool {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.55rem 0.55rem;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
}

.tool__txt {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.tool__txt strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.tool__txt em {
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--steel);
  line-height: 1.2;
}

.tool:hover { background: var(--ice); }

.tool.is-active {
  background: var(--mist);
  border-color: rgba(13, 91, 255, 0.28);
}

.tool.is-active .tool__txt strong {
  color: var(--blue);
}

.size-card {
  background: linear-gradient(160deg, var(--navy), #0a3a9e);
  color: var(--white);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  display: grid;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-top: 0;
  position: relative;
  z-index: 1;
}

.size-card strong {
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.size-card span {
  font-size: 0.74rem;
  opacity: 0.88;
  font-weight: 500;
}

.topbar__mode {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--steel);
  background: var(--ice);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
}

.stage {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 30, 90, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(0, 30, 90, 0.035) 1px, transparent 1px),
    #f7f8fa;
  background-size: 24px 24px, 24px 24px, auto;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.stage__coords {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--steel);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  z-index: 2;
}

.view-controls {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.45rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 30, 90, 0.1);
}

.view-controls__btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.view-controls__btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--mist);
}

.view-controls__btn svg {
  display: block;
}

.view-controls__slider {
  display: flex;
  align-items: center;
  margin: 0 0.15rem;
}

.view-controls__slider input[type="range"] {
  width: 110px;
  height: 28px;
  cursor: pointer;
  accent-color: var(--blue);
}

.view-controls__pct {
  min-width: 2.6rem;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.insp-dl {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.insp-dl div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

.insp-dl dt { color: var(--steel); }
.insp-dl dd { font-weight: 700; color: var(--navy); }

.inspector h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--navy);
  margin-top: 0.25rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(13, 91, 255, 0.2), transparent 50%),
    rgba(0, 20, 64, 0.55);
  backdrop-filter: blur(6px);
  padding: 1.5rem;
}

.modal[hidden] { display: none !important; }

.modal__card {
  width: min(100%, 640px);
  background: var(--white);
  border-radius: 18px;
  padding: 1.85rem 2rem;
  box-shadow: var(--shadow);
}

.modal__card--wide { width: min(100%, 720px); }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}

.modal__card h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: var(--navy);
  margin: 0.4rem 0 0.55rem;
  line-height: 1.15;
}

.modal__lead {
  color: var(--steel);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.field-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-grid select {
  appearance: none;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 2.1rem 0.65rem 0.75rem;
  background: var(--ice) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23001e5a' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E") right 0.75rem center / 10px no-repeat;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
  min-width: 0;
  width: 100%;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.preset {
  border: 1px solid var(--line);
  background: var(--ice);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.preset:hover, .preset.is-active {
  border-color: var(--blue);
  background: var(--mist);
  color: var(--blue);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

pre[data-export-body] {
  background: var(--ice);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow: auto;
  color: var(--navy);
}

.btn__short { display: none; }

.mob-only { display: none !important; }

@media (max-width: 960px) {
  html, body, .app {
    height: 100dvh;
    max-height: 100dvh;
  }

  .btn__full { display: none; }
  .btn__short { display: inline; }

  .app,
  .app:has(.inspector:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 52px minmax(0, 1fr) auto;
    grid-template-areas:
      "top"
      "stage"
      "dock";
  }

  .topbar {
    grid-area: top;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.55rem 0 0.75rem;
    min-height: 52px;
  }

  .topbar__brand {
    min-width: 0;
  }

  .topbar__actions {
    margin-left: 0;
    gap: 0.3rem;
    flex-shrink: 0;
  }

  .topbar__title {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .stage {
    grid-area: stage;
    grid-column: auto;
    min-height: 0;
  }

  .sidebar,
  .tools-backdrop,
  .inspector {
    grid-area: stage;
  }

  .mob-dock.mob-only {
    grid-area: dock;
  }

  .topbar__brand strong,
  .topbar__badge,
  .topbar__sep,
  .topbar__view {
    display: none;
  }

  .topbar__logo,
  .topbar__logo img {
    height: 24px;
  }

  .topbar__actions .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .stage__coords {
    bottom: 8px;
    left: 8px;
    font-size: 0.7rem;
  }

  .view-controls {
    right: 8px;
    bottom: 8px;
    padding: 0.3rem 0.4rem;
    gap: 0.2rem;
  }

  .view-controls__btn {
    width: 36px;
    height: 36px;
  }

  .view-controls__slider input[type="range"] {
    width: 88px;
  }

  .view-controls__pct {
    display: none;
  }

  /* Werkzeug-Sheet von unten */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: min(78dvh, 620px);
    max-height: calc(100dvh - 56px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
    border-right: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -16px 48px rgba(0, 30, 90, 0.2);
    transform: translateY(110%);
    transition: transform 0.28s ease;
    overflow: hidden;
    background: var(--white);
  }

  .app.is-tools-open .sidebar {
    transform: translateY(0);
  }

  .sheet-handle.mob-only {
    display: block !important;
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: rgba(0, 30, 90, 0.18);
    margin: 0.25rem auto 0.15rem;
    flex-shrink: 0;
  }

  .sheet-head.mob-only {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.15rem 0 0.35rem;
    border-bottom: 1px solid var(--line);
  }

  .sheet-head strong {
    font-family: var(--display);
    font-size: 1.05rem;
    color: var(--navy);
  }

  .sidebar__catalog {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar__label {
    display: block;
  }

  .tool {
    grid-template-columns: 42px 1fr;
    justify-items: stretch;
    min-height: 52px;
    padding: 0.65rem 0.55rem;
  }

  .tool__txt {
    display: grid;
  }

  .size-card {
    display: grid;
    margin-top: 0.25rem;
  }

  .tools-backdrop.mob-only {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 20, 64, 0.35);
    backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  .tools-backdrop.mob-only[hidden] {
    display: none !important;
  }

  /* Untere Leiste */
  .mob-dock.mob-only {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--line);
    z-index: 30;
  }

  .mob-dock__tools {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
    border: 1px solid var(--line);
    background: var(--ice);
    border-radius: 12px;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    color: var(--navy);
    min-height: 48px;
    flex: 1;
    min-width: 0;
  }

  .mob-dock__tools strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.15;
  }

  .mob-dock__tools em {
    display: block;
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--steel);
  }

  .mob-dock__ico {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--white);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid var(--line);
    color: var(--navy);
  }

  .mob-dock__ico svg {
    display: block;
  }

  .mob-dock__chip {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--navy);
    font-size: 1.15rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .mob-dock__chip.is-active {
    background: var(--mist);
    border-color: rgba(13, 91, 255, 0.35);
    color: var(--blue);
  }

  .mob-selection {
    display: none;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
    background: var(--mist);
    border: 1px solid rgba(13, 91, 255, 0.22);
    border-radius: 12px;
    padding: 0.35rem 0.4rem 0.35rem 0.65rem;
    min-height: 48px;
  }

  .mob-selection:not([hidden]) {
    display: flex;
  }

  .mob-dock:has(.mob-selection:not([hidden])) .mob-dock__tools {
    display: none;
  }

  .mob-selection__txt {
    min-width: 0;
    flex: 1;
  }

  .mob-selection__txt strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mob-selection__txt em {
    display: block;
    font-style: normal;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--steel);
  }

  .mob-selection__del {
    border: 0;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mob-selection__x {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--navy);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
  }

  /* Großer Inspector-Sheet auf Mobile aus – kompakte Leiste statt dessen */
  .inspector {
    display: none !important;
  }

  .modal {
    padding: 0.75rem;
    align-items: end;
  }

  .modal__card,
  .modal__card--wide {
    width: 100%;
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    border-radius: 16px;
    padding: 1.25rem;
  }

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

.finish {
  position: fixed;
  inset: 0;
  z-index: 60;
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(13, 91, 255, 0.14), transparent 55%),
    #eef2f8;
  overflow: auto;
  padding: 1rem;
}

.finish[hidden] { display: none !important; }

.finish__shell {
  width: min(1100px, 100%);
  margin: 0 auto 2rem;
}

.finish__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.finish__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.35rem;
}

.finish__head h2 {
  font-family: var(--display);
  color: var(--navy);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  margin: 0 0 0.35rem;
}

.finish__lead {
  color: var(--steel);
  margin: 0;
  max-width: 36rem;
  line-height: 1.45;
}

.finish__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 1.25rem;
  align-items: start;
}

.finish__preview,
.finish__form-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.finish__preview-frame {
  background:
    linear-gradient(180deg, #f8faff 0%, #eef2f8 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
}

.finish__preview-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f3f7ff;
}

.finish__size {
  margin: 0.75rem 0;
  font-weight: 700;
  color: var(--navy);
}

.finish__hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: var(--steel);
  line-height: 1.4;
}

.finish__form-panel h3 {
  font-family: var(--display);
  color: var(--navy);
  margin: 0 0 0.35rem;
}

.finish__form-lead {
  margin: 0 0 1rem;
  color: var(--steel);
  font-size: 0.9rem;
  line-height: 1.4;
}

.finish-form {
  display: grid;
  gap: 0.75rem;
}

.finish-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.finish-field {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--steel);
}

.finish-field input,
.finish-field select,
.finish-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--white);
}

.finish-field input:focus,
.finish-field select:focus,
.finish-field textarea:focus {
  outline: 2px solid rgba(13, 91, 255, 0.25);
  border-color: var(--blue);
}

.finish-captcha {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ice);
}

.finish-captcha__label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
}

.finish-captcha__image-wrap {
  position: relative;
  width: fit-content;
}

.finish-captcha__image {
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(0, 30, 90, 0.2);
  background: #001440;
  max-width: 100%;
}

.finish-captcha__image[hidden],
.finish-captcha__canvas[hidden] {
  display: none !important;
}

.finish-captcha__refresh {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  cursor: pointer;
  font-size: 1rem;
}

.finish-captcha__credit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  max-width: 100%;
  width: fit-content;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(159, 208, 255, 0.22);
  background: linear-gradient(135deg, #001440, #001e5a);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}

.finish-captcha__credit:hover {
  border-color: rgba(159, 208, 255, 0.5);
  color: #fff;
  background: linear-gradient(135deg, #001e5a, #0d5bff);
}

.finish-captcha__credit img {
  height: 18px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.finish-form__status {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}

.finish-form__status.is-ok { color: #047857; }
.finish-form__status.is-error { color: #b91c1c; }

@media (max-width: 900px) {
  .finish {
    padding: 0.75rem;
  }
  .finish__head {
    flex-direction: column;
  }
  .finish__grid {
    grid-template-columns: 1fr;
  }
  .finish-form__row {
    grid-template-columns: 1fr;
  }
}

/* ——— Boot / Ladeanimation ——— */
.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 55% at 50% 18%, rgba(13, 91, 255, 0.35), transparent 58%),
    radial-gradient(ellipse 50% 40% at 80% 90%, rgba(61, 139, 255, 0.18), transparent 50%),
    linear-gradient(165deg, #000c28 0%, var(--navy-deep) 42%, #001e5a 100%);
  color: #fff;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.55s;
}

.boot[hidden] {
  display: none !important;
}

.boot.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot__grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(600px) rotateX(58deg) scale(1.35);
  transform-origin: center 30%;
  animation: boot-grid 14s linear infinite;
  mask-image: radial-gradient(ellipse 55% 50% at 50% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 55% 50% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

.boot__beam {
  position: absolute;
  inset: -30% -10%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(13, 91, 255, 0.08) 45%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(13, 91, 255, 0.08) 55%,
    transparent 65%
  );
  animation: boot-beam 3.2s ease-in-out infinite;
  pointer-events: none;
}

.boot__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.55;
}

.boot__orb--a {
  width: min(42vw, 380px);
  height: min(42vw, 380px);
  left: -8%;
  top: 12%;
  background: rgba(13, 91, 255, 0.45);
  animation: boot-orb 7s ease-in-out infinite alternate;
}

.boot__orb--b {
  width: min(36vw, 300px);
  height: min(36vw, 300px);
  right: -6%;
  bottom: 8%;
  background: rgba(61, 139, 255, 0.35);
  animation: boot-orb 9s ease-in-out infinite alternate-reverse;
}

.boot__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  text-align: center;
  animation: boot-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boot__mark {
  display: flex;
  justify-content: center;
  margin-bottom: 1.35rem;
  animation: boot-logo 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.boot__mark img {
  width: min(200px, 56vw);
  height: auto;
  filter: drop-shadow(0 8px 28px rgba(13, 91, 255, 0.45));
}

.boot__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(173, 201, 255, 0.9);
  margin-bottom: 0.55rem;
}

.boot__title {
  font-family: var(--display);
  font-size: clamp(1.55rem, 4.5vw, 2.05rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.55rem;
  text-wrap: balance;
}

.boot__status {
  font-size: 0.92rem;
  color: rgba(210, 225, 255, 0.78);
  min-height: 1.4em;
  margin-bottom: 1.45rem;
  transition: opacity 0.25s ease;
}

.boot__status.is-swap {
  opacity: 0;
}

.boot__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.boot__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a3a9e, var(--blue) 45%, #6aa4ff);
  box-shadow: 0 0 18px rgba(13, 91, 255, 0.65);
  transition: width 0.18s linear;
  position: relative;
}

.boot__glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: -40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: boot-shimmer 1.35s ease-in-out infinite;
  pointer-events: none;
}

.boot__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(210, 225, 255, 0.85);
  font-variant-numeric: tabular-nums;
}

.boot__chips {
  display: inline-flex;
  gap: 0.35rem;
}

.boot__chips i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  animation: boot-chip 1.05s ease-in-out infinite;
}

.boot__chips i:nth-child(2) { animation-delay: 0.15s; }
.boot__chips i:nth-child(3) { animation-delay: 0.3s; }

@keyframes boot-grid {
  to { background-position: 0 48px, 48px 0; }
}

@keyframes boot-beam {
  0%, 100% { transform: translateX(-18%) rotate(0.001deg); opacity: 0.55; }
  50% { transform: translateX(18%) rotate(0.001deg); opacity: 1; }
}

@keyframes boot-orb {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(24px, -18px) scale(1.08); }
}

@keyframes boot-rise {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes boot-logo {
  from { opacity: 0; transform: translateY(12px) scale(0.92); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes boot-shimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(320%); }
}

@keyframes boot-chip {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); background: #6aa4ff; }
}

@media (prefers-reduced-motion: reduce) {
  .boot__grid,
  .boot__beam,
  .boot__orb,
  .boot__glow,
  .boot__chips i,
  .boot__panel,
  .boot__mark {
    animation: none !important;
  }
  .boot__fill {
    transition: width 0.35s ease;
  }
}
