:root {
  --ink: #243044;
  --muted: #5d6b7e;
  --line: #d7deea;
  --blue: #1f6fe5;
  --red: #e23b3b;
  --paper: #f7f9fc;
  --gold: #e7b23a;
  --shadow: 0 22px 50px rgba(12, 28, 58, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(231, 178, 58, 0.22), transparent 60%),
    linear-gradient(180deg, #10233f 0%, #1a3a68 42%, #0e1c33 100%);
}

.stage {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 16px 16px;
}

.slip {
  position: relative;
  width: min(440px, 100%);
  padding: 32px 26px 40px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.slip-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='42' viewBox='0 0 72 42'%3E%3Cpath d='M18 21c6 0 6-10 12-10s6 10 12 10 6-10 12-10 6 10 12 10M6 21c-6 0-6-10-12-10M18 21c-6 0-6 10-12 10s-6-10-12-10M54 21c6 0 6 10 12 10s6-10 12-10' fill='none' stroke='%23c5d0e2' stroke-width='1.4'/%3E%3C/svg%3E");
  background-size: 72px 42px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
}

.slip > *:not(.slip-pattern) {
  position: relative;
  z-index: 1;
}

.slip-brand {
  display: flex;
  justify-content: center;
  margin: 6px 0 8px;
}

.slip-brand img {
  width: min(300px, 92%);
  height: auto;
  display: block;
}

.slip-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 2px;
  color: var(--blue);
}

.slip-status h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.shield {
  color: #2f9e4f;
  display: inline-flex;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
}

.shield-flip {
  transform: scaleX(-1);
}

.slip-date {
  margin: 2px 0 14px;
  text-align: center;
  color: #3c4a5e;
  font-size: 14px;
  font-weight: 500;
}

.slip-rows {
  margin: 0;
}

.slip-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 18px 2px;
  border-top: 1px solid var(--line);
}

.slip-row dt {
  margin: 0;
  color: #31445f;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
}

.slip-row dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.slip-row dd.points {
  color: var(--red);
  font-weight: 800;
}

.slip-wish {
  margin: 26px 0 22px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
}

.slip-close {
  display: block;
  width: min(230px, 78%);
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  color: #fff;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
  background: linear-gradient(180deg, #4aa2ff 0%, #1d74e8 55%, #1660cc 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 16px rgba(29, 99, 196, 0.35);
}

.slip-close:hover,
.btn-save:hover {
  filter: brightness(1.05);
}

.slip-close:focus-visible,
.editor input:focus-visible,
.editor button:focus-visible {
  outline: 3px solid #f0c14b;
  outline-offset: 2px;
}

.slip-close:active {
  transform: translateY(1px);
}

.slip.is-updating {
  animation: slip-pop 280ms ease;
}

@keyframes slip-pop {
  from {
    transform: translateY(6px);
  }
  to {
    transform: none;
  }
}

.editor {
  width: min(760px, calc(100% - 24px));
  margin: 16px auto 20px;
  flex: 0 0 auto;
  padding: 18px 18px 16px;
  border-radius: 16px;
  color: #e8eef8;
  background: rgba(8, 18, 36, 0.72);
  border: 1px solid rgba(231, 178, 58, 0.35);
  backdrop-filter: blur(8px);
}

.editor-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.editor-head p {
  margin: 4px 0 14px;
  color: #b7c4d8;
  font-size: 13px;
}

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

.editor label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #c9d5e8;
}

.editor label.full {
  grid-column: 1 / -1;
}

.editor input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  color: #102033;
  background: #f4f7fb;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.editor-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.btn-save,
.btn-reset {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.btn-save {
  color: #1a1404;
  background: linear-gradient(180deg, #f6d56a, #e0a82a);
}

.btn-reset {
  color: #d7e2f2;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.save-note {
  margin: 0;
  min-height: 1.2em;
  font-size: 13px;
  font-weight: 600;
  color: #9de7b0;
}

@media (max-width: 640px) {
  .stage {
    padding: 16px 12px 8px;
  }

  .slip-status h1 {
    font-size: 17px;
  }

  .slip-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .slip-row dd {
    text-align: left;
  }

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

@media (prefers-reduced-motion: reduce) {
  .slip.is-updating {
    animation: none;
  }
}
