:root {
  --bg: #0c0a09;
  --ink: #f5efe6;
  --accent: #c45c26;
  --danger: #b01018;
  --muted: rgba(245, 239, 230, 0.55);
  --panel: rgba(18, 14, 12, 0.94);
  --line: rgba(245, 239, 230, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#app.form-open #scene {
  pointer-events: none;
}

#hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  text-align: center;
  padding: 0 20px;
  z-index: 3;
}

#hint {
  font-size: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 0 #000, 0 0 12px rgba(0, 0, 0, 0.7);
  transition: opacity 0.35s ease, transform 0.35s ease;
  user-select: none;
}

#hint.is-hidden {
  opacity: 0;
  transform: translateY(8px);
}

#lobby-bar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  flex-direction: row;
  width: 100%;
  gap: 0;
  padding: 0;
  box-sizing: border-box;
}

#lobby-bar .btn {
  flex: 1 1 50%;
  width: 50%;
  margin: 0;
  border-radius: 0;
  border: 3px solid #000;
  border-right-width: 1.5px;
  padding: 14px 8px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35);
  opacity: 1;
}

#lobby-bar .btn:last-child {
  border-left-width: 1.5px;
  border-right-width: 3px;
}

#lobby-bar #btn-edit {
  background: #ffef00;
  color: #1a0040;
  border-color: #1a0040;
}

#lobby-bar #btn-unreg {
  background: #ff1e8c;
  color: #fff;
  border-color: #4a0030;
}

#lobby-bar .btn.is-hidden {
  display: none;
}

#lobby-bar:has(.btn.is-hidden) .btn:not(.is-hidden) {
  flex: 1 1 100%;
  width: 100%;
  border-width: 3px;
}

#locked-banner {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(176, 16, 24, 0.9);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 90%;
  text-align: center;
}

#loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 30%, #2a1810 0%, transparent 55%),
    linear-gradient(180deg, #1a100c 0%, #0c0a09 100%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
  z-index: 10;
}

#loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-card p {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(245, 239, 230, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.is-hidden {
  display: none !important;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(6, 4, 3, 0.88);
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  overflow: auto;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px 18px;
  max-height: 100%;
  overflow: auto;
  user-select: text;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.sheet-sm {
  width: min(340px, 100%);
}

.sheet h1 {
  font-size: 22px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.sheet-lead {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

#reg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#reg-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

#reg-form label.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-transform: none;
  font-size: 14px;
  color: var(--ink);
}

#reg-form input,
#reg-form select,
#reg-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 16px;
  font-family: inherit;
}

#reg-form textarea {
  resize: vertical;
  min-height: 64px;
}

#postcode-wrap.is-required input {
  border-color: var(--accent);
}

.form-error {
  color: #ff8a7a;
  font-size: 13px;
  min-height: 1.2em;
  white-space: pre-wrap;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(245, 239, 230, 0.06);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  pointer-events: auto;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
}

.btn-primary {
  background: linear-gradient(180deg, #d46a2e, #a8431a);
  border-color: transparent;
  font-weight: 600;
  width: 100%;
  margin-top: 4px;
}

.btn-danger {
  background: rgba(176, 16, 24, 0.25);
  border-color: rgba(176, 16, 24, 0.55);
  color: #ffb4b4;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.row .btn {
  flex: 1;
}

#jackpot-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.jp-avatar {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: #1a1210;
}

.jp-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.jp-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.jp-wishes {
  margin-top: 6px;
  color: var(--muted);
}

.jp-text a {
  color: #ffb088;
}
