@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700;800&family=Literata:opsz,wght@7..72,400;7..72,500;7..72,600;7..72,700&family=Montserrat:wght@500;600;700;800;900&family=Oswald:wght@500;600;700&family=PT+Serif:wght@400;700&family=Unbounded:wght@600;700;800;900&display=swap");

:root {
  --font-ui:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --font-text:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --font-display:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --font-brand:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

:root {
  --bg: #f5f6f1;
  --ink: #171a16;
  --muted: #687066;
  --line: #cbd5c7;
  --accent: #335846;
  --accent-strong: #203c30;
  --accent-soft: #e2ece0;
  --field: #fbfdf8;
  --shadow: 0 24px 70px rgba(24, 36, 27, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 14%, rgba(51, 88, 70, 0.13), transparent 28rem),
    linear-gradient(135deg, #fbfcf8 0%, var(--bg) 55%, #e7eee3 100%);
  color: var(--ink);
  font-family: var(--font-ui);
}

body.font-theme-literata {
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-text: "Literata", Georgia, serif;
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-brand: "IBM Plex Sans", system-ui, sans-serif;
}

body.font-theme-ptserif {
  --font-ui: "Montserrat", system-ui, sans-serif;
  --font-text: "PT Serif", Georgia, serif;
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-brand: "Montserrat", system-ui, sans-serif;
}

body.font-theme-unbounded {
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-text: "IBM Plex Sans", system-ui, sans-serif;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-brand: "Unbounded", system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 850;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  display: grid;
  min-height: calc(100vh - 84px);
  padding: clamp(14px, 2.5vw, 28px) clamp(18px, 4vw, 42px) 14px;
  place-items: center;
}

.declaration {
  position: relative;
  width: min(100%, 760px);
  text-align: center;
}

.burst-canvas {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.language-switch {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 10;
  display: flex;
  gap: 4px;
}

.language-switch button {
  padding: 6px 9px;
  border: 1px solid rgba(23, 26, 22, 0.16);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.language-switch button.is-active,
.language-switch button:hover,
.language-switch button:focus-visible {
  background: var(--ink);
  color: var(--field);
}

.logo {
  display: inline-block;
  margin-bottom: clamp(20px, 4.8vh, 48px);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 950;
  font-family: var(--font-brand);
  letter-spacing: 0.18em;
  text-decoration: none;
}

.declaration-form {
  display: grid;
  gap: clamp(14px, 2.3vh, 24px);
}

.declaration-form[hidden] {
  display: none;
}

.name-inline,
.artist-line,
.song-title {
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
}

.statement {
  display: grid;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2.7vw, 1.36rem);
  font-weight: 550;
  font-family: var(--font-text);
  line-height: 1.48;
  text-wrap: balance;
}

.name-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.32em;
  color: var(--ink);
}

.statement-line {
  display: block;
}

.autosize-field {
  position: relative;
  display: inline-block;
  width: auto;
  min-width: 1.5ch;
}

.autosize-value {
  display: inline-block;
  padding: 0 4px 4px;
  font: inherit;
  font-weight: 760;
  white-space: pre;
  visibility: hidden;
}

.name-inline {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 100%;
  padding: 0 4px 4px;
  font-size: inherit;
  font-weight: 760;
  line-height: 1.1;
}

.name-inline:focus,
.artist-line:focus,
.song-title:focus {
  border-color: var(--accent);
}

.name-inline::placeholder,
.artist-line::placeholder,
.song-title::placeholder {
  color: #90988d;
}

.song-fields {
  display: grid;
  gap: 4px;
}

.artist-line,
.song-title {
  width: 100%;
}

.artist-line {
  justify-self: center;
  max-width: 520px;
  padding: 0 0 7px;
  color: var(--ink);
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  font-weight: 800;
  font-family: var(--font-ui);
  text-transform: none;
}

.song-title {
  min-height: 1.02em;
  max-height: 2.05em;
  padding: 2px 0 8px;
  resize: none;
  font-size: clamp(2.7rem, 9.5vw, 6.4rem);
  font-weight: 900;
  font-family: var(--font-display);
  letter-spacing: 0;
  line-height: 0.94;
  overflow: hidden;
  text-transform: uppercase;
}

.signature-block {
  width: min(100%, 560px);
  justify-self: center;
}

.signature-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.signature-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.16rem;
  font-weight: 300;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
}

.signature-pad {
  display: block;
  width: 100%;
  height: clamp(66px, 12vh, 108px);
  margin-top: 2px;
  border-bottom: 2px solid var(--line);
  background: transparent;
  cursor: crosshair;
  touch-action: none;
}

.signature-caption {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.signature-block:hover .signature-pad,
.signature-pad:focus {
  border-color: var(--accent);
}

.save-button {
  justify-self: center;
  min-width: 160px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
}

.save-button:hover,
.save-button:focus-visible {
  background: var(--ink);
  color: var(--field);
}

.published-panel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 6px;
  margin-top: 0;
  padding: 5px;
  border: 1px solid rgba(23, 26, 22, 0.08);
  border-radius: 999px;
  background: rgba(251, 253, 248, 0.7);
  flex-wrap: wrap;
}

.published-panel[hidden] {
  display: none;
}

.short-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}

.short-link button,
.social-links button {
  border: 1px solid rgba(23, 26, 22, 0.12);
  background: transparent;
  color: var(--ink);
}

.short-link button {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.9rem;
  place-items: center;
}

.social-links {
  display: flex;
  gap: 4px;
}

.social-links button {
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.9rem;
  place-items: center;
}

.short-link button:hover,
.short-link button:focus-visible,
.social-links button:hover,
.social-links button:focus-visible {
  background: var(--ink);
  color: var(--field);
}

.result-panel {
  position: relative;
  display: grid;
  gap: 10px;
  margin-top: 0;
  perspective: 1200px;
  animation: card-arrive 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.result-panel[hidden] {
  display: none;
}

.share-card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --glow-x: 50%;
  --glow-y: 45%;
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  min-height: clamp(390px, 58vh, 520px);
  padding: clamp(28px, 5vw, 42px) 32px;
  border: 1px solid rgba(23, 26, 22, 0.08);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 36%, rgba(51, 88, 70, 0.11), transparent 15rem),
    linear-gradient(150deg, #fbfcf8 0%, #eef4ea 58%, #dfeadd 100%);
  box-shadow:
    0 34px 90px rgba(24, 36, 27, 0.18),
    0 16px 34px rgba(51, 88, 70, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  text-align: center;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateZ(0);
  transform-style: preserve-3d;
  transition:
    box-shadow 260ms ease,
    transform 180ms ease;
  will-change: transform;
}

.share-card::before {
  position: absolute;
  inset: -1px;
  z-index: 0;
  background:
    radial-gradient(
      circle at var(--glow-x) var(--glow-y),
      rgba(255, 255, 255, 0.78),
      rgba(255, 255, 255, 0.2) 18%,
      transparent 42%
    ),
    radial-gradient(
      circle at calc(100% - var(--glow-x)) calc(100% - var(--glow-y)),
      rgba(94, 214, 160, 0.14),
      transparent 34%
    );
  content: "";
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.share-card::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(23, 26, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 26, 22, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: radial-gradient(circle at 50% 44%, black, transparent 72%);
  opacity: 0.32;
  pointer-events: none;
}

.share-card:hover {
  box-shadow:
    0 44px 110px rgba(24, 36, 27, 0.22),
    0 18px 46px rgba(51, 88, 70, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.share-card > * {
  position: relative;
  z-index: 1;
}

.edit-icon {
  position: absolute;
  top: 0;
  right: -46px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(23, 26, 22, 0.12);
  border-radius: 50%;
  background: rgba(251, 253, 248, 0.62);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  place-items: center;
}

.edit-icon:hover,
.edit-icon:focus-visible {
  background: var(--ink);
  color: var(--field);
}

.card-brand {
  color: var(--accent);
  font-size: 0.96rem;
  font-weight: 950;
  font-family: var(--font-brand);
  letter-spacing: 0.18em;
}

.card-label {
  margin: 20px 0 0;
  color: var(--ink);
  font-size: clamp(1.18rem, 3vw, 1.85rem);
  font-weight: 850;
  font-family: var(--font-text);
}

.card-declaration {
  max-width: 620px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: clamp(0.86rem, 1.85vw, 1.08rem);
  font-weight: 520;
  font-family: var(--font-text);
  line-height: 1.34;
  text-wrap: balance;
}

.card-declaration-name {
  font-weight: 850;
}

.card-artist {
  margin: 18px 0 -10px;
  color: var(--ink);
  font-size: clamp(1.25rem, 4vw, 2.35rem);
  font-weight: 850;
  font-family: var(--font-ui);
}

.card-song-wrap {
  position: relative;
  display: grid;
  width: min(100%, 660px);
  min-height: clamp(100px, 15vh, 150px);
  margin: 0 auto;
  align-items: center;
  justify-items: center;
}

.card-song-wrap h2 {
  max-width: min(100%, 660px);
  margin: 0 auto;
  overflow-wrap: normal;
  font-size: clamp(2.8rem, 10vw, 6.6rem);
  font-weight: 950;
  font-family: var(--font-display);
  line-height: 0.94;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-song-wrap h2::before {
  content: "“";
  margin-right: 0.04em;
}

.card-song-wrap h2::after {
  content: "”";
  margin-left: 0.04em;
}

.card-song-wrap.is-long h2 {
  font-size: clamp(2.5rem, 8vw, 5.3rem);
  white-space: normal;
}

.card-song-wrap.is-very-long h2 {
  font-size: clamp(2.05rem, 6.6vw, 4.35rem);
  overflow-wrap: anywhere;
}

.signature-slot {
  display: grid;
  min-height: 92px;
  margin-top: 8px;
  align-items: start;
  justify-items: center;
}

.card-signature {
  width: min(67%, 312px);
  max-height: 84px;
  object-fit: contain;
}

.share-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  width: min(100% - 36px, 1080px);
  margin: 0 auto;
  padding: 0 0 18px;
  color: #8c9488;
  font-size: 0.82rem;
  font-weight: 650;
  flex-wrap: wrap;
}

@keyframes card-arrive {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.deploy-info {
  color: #a3aaa0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.deploy-info code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.72rem;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--ink);
}

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

  .logo {
    margin-bottom: 28px;
  }

  .declaration-form {
    gap: 18px;
  }

  .name-row {
    flex-wrap: wrap;
  }

  .signature-pad {
    height: 76px;
  }

  .share-card {
    min-height: 380px;
    padding: 34px 20px;
  }

  .edit-icon {
    top: -42px;
    right: 0;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
