:root {
  --color-brown: #c35931;
  --color-beige: #fdf2db;
  --color-white: #ffffff;
  --frame-border-size: 10px;
  --header-padding-x: 20px;
  --header-padding-y: 16px;
  --header-title-font-size: min(5vh, 7vw);
  --content-padding: 20px;
  --content-inner-max-width: 100%;
  --footer-svg-width: 1068;
  --footer-svg-height: 211;
  --footer-max-height: 100px;
  --footer-height: min(
    calc((100vw - (var(--frame-border-size) * 2)) * var(--footer-svg-height) / var(--footer-svg-width)),
    var(--footer-max-height)
  );
  --welcome-overlay-padding: 24px;
  --welcome-overlay-button-bottom: 32px;
  --welcome-overlay-background-image: url("../img/welcome-overlay.jpg");
  --welcome-overlay-background-size: cover;
  --welcome-overlay-background-position: center center;
  --button-padding-y: 14px;
  --button-padding-x: 10vw;
  --button-radius: 0;
  --button-font-size: 17px;
  --button-gap: 12px;
  --card-gap: 40px;
  --card-padding: 20px;
  --field-height: 24px;
  --field-gap: clamp(8px, 2.2vh, 14px);
  --field-label-size: clamp(13px, 2.8vw, 16px);
  --field-input-size: clamp(13px, 2.8vw, 16px);
  --field-horizontal-gap: clamp(10px, 3vw, 18px);
  --field-padding-x: 16px;
  --field-select-label-gap: 6px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--color-beige);
}

body {
  min-height: 100dvh;
  color: var(--color-white);
}

body[data-mobile-view='form'] .welcome-overlay:not(.is-hidden) {
  display: flex;
}

.mobile-page {
  width: 100%;
  height: 100%;
  padding-top: var(--frame-border-size);
  padding-left: var(--frame-border-size);
  padding-right: var(--frame-border-size);
  background: var(--color-beige);
  overflow: hidden;
}

.mobile-page,
.mobile-page * {
  -webkit-user-select: none;
  user-select: none;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-brown);
  color: var(--color-white);
  overflow: hidden;
}

.app-header {
  flex: 0 0 auto;
  margin: 0;
  padding: var(--header-padding-y) var(--header-padding-x);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-brown);
  color: var(--color-beige);
  text-align: center;
}

.app-header h1 {
  margin: 0;
  padding: 0;
  font-size: var(--header-title-font-size);
  line-height: 1.05;
  font-weight: 700;
  text-transform: uppercase;
}

.app-content {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--content-padding);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: var(--color-brown);
  color: var(--color-white);
}

.app-content-inner {
  width: 100%;
  max-width: var(--content-inner-max-width);
  margin-top: auto;
  margin-bottom: auto;
}

.app-footer {
  flex: 0 0 var(--footer-height);
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-beige);
  overflow: hidden;
}

.app-footer img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center center;
}

.welcome-overlay {
  position: absolute;
  z-index: 10;
  top: 0;
  right: 0;
  bottom: var(--footer-height);
  left: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--welcome-overlay-padding);
  background-color: #6abff5;
  background-image: var(--welcome-overlay-background-image);
  background-repeat: no-repeat;
  background-position: var(--welcome-overlay-background-position);
  background-size: var(--welcome-overlay-background-size);
  overflow: hidden;
}

.welcome-overlay[hidden],
.welcome-overlay.is-hidden {
  display: none;
}

.welcome-overlay-title {
  position: absolute;
  top: 6vh;
  left: 50%;
  width: 66vw;
  max-width: 66vw;
  max-height: 12vh;
  height: auto;
  display: block;
  transform: translateX(-50%);
  object-fit: contain;
}

.welcome-overlay-button {
  position: absolute;
  left: 50%;
  bottom: var(--welcome-overlay-button-bottom);
  transform: translateX(-50%);
  max-width: calc(100% - (var(--welcome-overlay-padding) * 2));
}

.mobile-app {
  width: 100%;
}

.mobile-panel {
  width: 100%;
  padding: var(--card-padding);
  background: transparent;
  color: var(--color-white);
}

.mobile-panel h1,
.mobile-panel h2,
.mobile-panel p {
  margin-top: 0;
}

.mobile-panel h1,
.mobile-panel h2 {
  margin-bottom: 0.75em;
  font-size: clamp(1.9rem, 7vw, 2.2rem);
  line-height: 1.1;
  color: var(--color-beige);
}

#mobile-app .mobile-register-title {
  text-align: center;
  margin-bottom: var(--card-gap);
  font-size: clamp(1.75rem, 6.4vw, 2rem);
}

.mobile-panel p {
  margin: 0 0 1em;
  line-height: 1.45;
}

.mobile-panel p:last-child {
  margin-bottom: 0;
}

.mobile-preline {
  white-space: pre-line;
}

.mobile-highlight {
  font-weight: 700;
}

#mobile-app .form-stack {
  width: 100%;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--field-horizontal-gap);
  row-gap: var(--field-gap);
  align-items: center;
  text-align: left;
}

#mobile-app .form-group {
  display: contents;
}

#mobile-app .form-label {
  display: block;
  margin: 0;
  color: var(--color-white);
  font-size: var(--field-label-size);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-align: left;
  white-space: nowrap;
}

#mobile-app .form-control {
  width: 100%;
  min-width: 0;
}

#mobile-app .form-field,
#mobile-app .form-select,
#mobile-app .form-textarea {
  appearance: none;
  -webkit-appearance: none;
  -webkit-user-select: text;
  user-select: text;
  width: 100%;
  min-height: var(--field-height);
  border: 0;
  border-radius: calc(var(--field-height) / 2);
  padding: 0 var(--field-padding-x);
  background: var(--color-white);
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--field-input-size);
  line-height: 1.1;
  font-weight: 700;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

#mobile-app .form-field,
#mobile-app .form-select {
  height: var(--field-height);
}

#mobile-app .form-select {
  padding-right: calc(var(--field-padding-x) + 18px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--field-padding-x) center;
  background-size: 12px 8px;
}

#mobile-app .form-textarea {
  min-height: calc(var(--field-height) * 2.4);
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.2;
  resize: none;
}

#mobile-app .form-field:focus,
#mobile-app .form-select:focus,
#mobile-app .form-textarea:focus,
#mobile-app .form-field:focus-visible,
#mobile-app .form-select:focus-visible,
#mobile-app .form-textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

#mobile-app .form-select-group {
  display: block;
  width: 100%;
  margin-top: var(--field-gap);
  text-align: left;
}

#mobile-app #mobile-register-form .form-select-group {
  margin-top: 40px;
}

#mobile-app .form-select-group .form-label {
  display: block;
  width: 100%;
  margin-bottom: var(--field-select-label-gap);
  white-space: normal;
}

#mobile-app .form-control .mobile-error,
#mobile-app .form-select-group .mobile-error {
  margin: 6px 0 0;
  color: var(--color-white);
  text-align: left;
}

#mobile-app .mobile-form-row--checkbox {
  margin-top: var(--field-gap);
  margin-bottom: 0;
}

#mobile-app .mobile-form-row--checkbox label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--color-white);
  font-size: var(--field-label-size);
  line-height: 1.2;
  font-weight: 700;
}

#mobile-app .mobile-form-row--checkbox input[type='checkbox'] {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  accent-color: var(--color-beige);
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--button-gap);
  margin-top: var(--card-gap);
}

.button,
.mobile-actions button,
.mobile-panel button {
  appearance: none;
  width: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--color-beige);
  border-radius: var(--button-radius);
  padding: var(--button-padding-y) var(--button-padding-x);
  background: var(--color-beige);
  color: var(--color-brown);
  font-size: var(--button-font-size);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.button:active,
.mobile-actions button:active,
.mobile-panel button:active {
  transform: translateY(1px);
}

.button.welcome-overlay-button:active {
  transform: translateX(-50%) translateY(1px);
}

.mobile-summary {
  margin: 16px 0;
  padding-top: 4px;
}

.mobile-summary p {
  margin: 8px 0;
}

.mobile-qr {
  width: min(240px, 100%);
  display: block;
  margin: 20px auto;
  padding: 12px;
  border: 1px solid var(--color-beige);
  background: var(--color-beige);
}

.mobile-mono {
  font-family: Consolas, monospace;
  word-break: break-all;
}

.mobile-muted {
  color: rgba(253, 242, 219, 0.88);
}

.mobile-error {
  margin-top: 8px;
  color: var(--color-beige);
  font-weight: 700;
}

.mobile-hidden {
  display: none;
}
