:root {
  color-scheme: dark;
  --background: #211919;
  --surface: rgba(33, 25, 25, 0.96);
  --surface-soft: rgba(233, 217, 214, 0.055);
  --text: #e9d9d6;
  --muted: rgba(233, 217, 214, 0.62);
  --muted-soft: rgba(233, 217, 214, 0.42);
  --line: rgba(233, 217, 214, 0.15);
  --accent: #a96259;
  --accent-dark: #6f3e39;
  --danger: #c77f76;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--background);
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  touch-action: pan-y;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(169, 98, 89, 0.25), transparent 38rem),
    linear-gradient(180deg, #2a2020 0%, #211919 44%, #181212 100%);
}

html.signature-active,
body.signature-active {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
  -webkit-overflow-scrolling: auto !important;
}

html.signature-active,
html.signature-active *,
body.signature-active,
body.signature-active * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

body.signature-active .form-card > *:not(.signature-section) {
  pointer-events: none !important;
}

body.signature-active .signature-section > *:not(.signature-frame) {
  pointer-events: none !important;
}

body.signature-active .signature-frame,
body.signature-active #signature-canvas {
  pointer-events: auto !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(100%, 820px);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-x: clip;
  padding: max(24px, env(safe-area-inset-top)) 18px max(60px, env(safe-area-inset-bottom));
}

.form-card,
.state-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.form-card {
  padding: clamp(20px, 4vw, 38px);
}

.state-card {
  min-height: 300px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.state-card h1 {
  margin: 16px 0 8px;
  font-size: clamp(28px, 7vw, 42px);
}

.state-card p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.state-icon {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(199, 127, 118, 0.5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: rgba(199, 127, 118, 0.1);
  font-size: 32px;
  font-weight: 900;
}

.state-icon.success {
  color: var(--text);
  border-color: rgba(169, 98, 89, 0.65);
  background: rgba(169, 98, 89, 0.22);
}

.spinner,
.button-spinner {
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(233, 217, 214, 0.16);
  border-top-color: var(--accent);
}

.button-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(33, 25, 25, 0.3);
  border-top-color: var(--background);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.form-header h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.lead {
  margin: 16px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.artist-card {
  margin: 26px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.artist-card strong {
  text-align: right;
  font-size: 16px;
}

.field-label,
.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 30px;
}

.form-section h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 5vw, 26px);
  letter-spacing: -0.02em;
}

.section-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.two-column {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.two-column > .field {
  min-width: 0;
}

.field {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.field input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.field input:focus {
  border-color: rgba(169, 98, 89, 0.85);
  background: rgba(169, 98, 89, 0.08);
}


.date-control {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.date-control:focus-within {
  border-color: rgba(169, 98, 89, 0.85);
  background: rgba(169, 98, 89, 0.08);
}

.date-control-value {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-control-value.is-placeholder {
  color: var(--muted-soft);
}

.date-control-action {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.date-control input[type="date"] {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: inherit;
  padding: 0;
  opacity: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.date-control input[type="date"]::-webkit-date-and-time-value,
.date-control input[type="date"]::-webkit-datetime-edit,
.date-control input[type="date"]::-webkit-calendar-picker-indicator {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.field input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color-scheme: dark;
}

.field input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.field input[type="date"]::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}

.statement-list {
  display: grid;
  gap: 11px;
}

.statement-card,
.radio-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.statement-card {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 15px;
}

.statement-card input,
.radio-card input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.statement-card span {
  color: rgba(233, 217, 214, 0.82);
  font-size: 13px;
  line-height: 1.55;
}

.statement-card:has(input:checked),
.radio-card:has(input:checked) {
  border-color: rgba(169, 98, 89, 0.75);
  background: rgba(169, 98, 89, 0.12);
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.radio-card {
  min-height: 58px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(233, 217, 214, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.notice {
  margin: 0;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 11px 13px;
  color: var(--muted);
  background: rgba(169, 98, 89, 0.08);
  font-size: 12px;
  line-height: 1.55;
}

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

.text-button {
  border: 0;
  padding: 8px 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.signature-section,
.signature-heading,
.signature-frame,
#signature-canvas,
#signature-placeholder {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.signature-frame {
  position: relative;
  height: 230px;
  overflow: hidden;
  border: 2px solid rgba(33, 25, 25, 0.24);
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(169, 98, 89, 0.16);
}

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

#signature-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: rgba(33, 25, 25, 0.35);
  font-size: 14px;
  font-weight: 800;
}

.form-error {
  margin-top: 18px;
  border: 1px solid rgba(199, 127, 118, 0.45);
  border-radius: 15px;
  padding: 14px;
  color: var(--text);
  background: rgba(199, 127, 118, 0.12);
  font-size: 13px;
  line-height: 1.5;
}

.submit-button {
  width: 100%;
  min-height: 58px;
  margin-top: 20px;
  border: 0;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--background);
  background: var(--accent);
  font-weight: 900;
  cursor: pointer;
}

.submit-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.muted {
  margin-top: 14px !important;
  color: var(--muted-soft) !important;
  font-size: 12px;
}

@media (max-width: 620px) {
  .page-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .form-card {
    border-radius: 22px;
    padding: 20px 16px 26px;
  }

  .two-column,
  .radio-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field,
  .field input,
  .field input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }

  .artist-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .artist-card strong {
    text-align: left;
  }

  .signature-frame {
    height: 210px;
  }
}


/* Final mobile containment guard. */
html,
body,
.page-shell,
.form-card,
.form-section,
.two-column,
.field,
.date-control {
  box-sizing: border-box;
}

body > *,
.page-shell > *,
.form-card > * {
  max-width: 100%;
}

@media (max-width: 620px) {
  .page-shell {
    width: 100%;
    max-width: 100%;
  }

  .form-card {
    width: 100%;
    max-width: 100%;
  }

  .date-field,
  .date-control {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}


/* Hard signature lock: the drawing surface must never participate in page panning. */
.signature-frame,
#signature-canvas {
  contain: layout paint style;
  overscroll-behavior: none !important;
  touch-action: none !important;
}

body.signature-active .signature-frame {
  isolation: isolate;
  z-index: 9999;
}


/* Privacy notice acknowledgement */
.privacy-card {
  border: 1px solid rgba(169, 98, 89, 0.38);
  border-radius: 18px;
  background: rgba(169, 98, 89, 0.1);
  padding: 17px;
}

.privacy-card h2 {
  margin: 0 0 8px;
}

.privacy-open-button {
  min-height: 44px;
  border: 1px solid rgba(233, 217, 214, 0.18);
  border-radius: 13px;
  margin: 2px 0 14px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(33, 25, 25, 0.46);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.privacy-acknowledgement {
  margin: 0;
  background: rgba(33, 25, 25, 0.34);
}

.privacy-modal {
  position: fixed;
  z-index: 20000;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    16px
    max(18px, env(safe-area-inset-bottom));
  background: rgba(12, 8, 8, 0.84);
  backdrop-filter: blur(10px);
}

.privacy-modal.hidden {
  display: none;
}

.privacy-modal-panel {
  width: min(100%, 720px);
  max-width: 100%;
  max-height: min(88dvh, 850px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  background: #211919;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
}

.privacy-modal-header {
  flex: 0 0 auto;
  padding: 20px 20px 12px;
}

.privacy-modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 4vw, 31px);
  line-height: 1.12;
}

.privacy-modal-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 20px;
  -webkit-overflow-scrolling: touch;
}

.privacy-modal-section {
  padding: 15px 0;
  border-top: 1px solid rgba(233, 217, 214, 0.1);
}

.privacy-modal-section:first-child {
  border-top: 0;
}

.privacy-modal-section h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.privacy-modal-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.privacy-close-button {
  flex: 0 0 auto;
  width: auto;
  margin: 0 20px 20px;
}

html.privacy-modal-open,
body.privacy-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
