* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0f; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#fullscreen-btn {
  display: none;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 20px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#fullscreen-btn:active {
  background: rgba(255,255,255,0.2);
}
#help-btn, #save-btn {
  position: fixed;
  top: 10px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  background: rgba(0,0,0,0.58);
  color: #e8d48b;
  font: 700 19px/40px system-ui, sans-serif;
  text-align: center;
  cursor: pointer;
}
#help-btn { left: 10px; }
#save-btn { left: 62px; }
#help-btn:hover, #save-btn:hover { background: rgba(201,168,76,0.2); }
#help-btn:focus-visible,
#save-btn:focus-visible,
dialog button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
#help-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid rgba(201, 168, 76, 0.65);
  border-radius: 16px;
  background: linear-gradient(145deg, #171724, #0c0c13);
  color: #ece8da;
  box-shadow: 0 24px 90px rgba(0,0,0,0.75);
  font-family: system-ui, sans-serif;
}
#help-dialog::backdrop {
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}
.help-content { padding: clamp(22px, 5vw, 42px); overflow: auto; }
.help-eyebrow {
  margin: 0 0 4px;
  color: #c9a84c;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.help-content h1 {
  margin: 0;
  color: #f2dfaa;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1;
}
.help-intro {
  max-width: 58ch;
  margin: 12px 0 24px;
  color: #aaa8a1;
  line-height: 1.55;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.help-card {
  padding: 15px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
}
.help-card h2 {
  margin: 0 0 10px;
  color: #e8d48b;
  font-size: 0.92rem;
}
.help-card dl {
  display: grid;
  grid-template-columns: minmax(76px, auto) 1fr;
  gap: 7px 12px;
  margin: 0;
  color: #bebbb1;
  font-size: 0.8rem;
}
.help-card dt { color: #fff; font-weight: 700; }
.help-card dd { margin: 0; }
.help-tip {
  margin: 16px 0 0;
  padding-left: 12px;
  border-left: 3px solid #c9a84c;
  color: #aaa8a1;
  font-size: 0.82rem;
  line-height: 1.5;
}
.help-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
#help-close {
  min-width: 130px;
  padding: 11px 18px;
  border: 1px solid #c9a84c;
  border-radius: 8px;
  background: #c9a84c;
  color: #111116;
  font: 800 0.86rem system-ui, sans-serif;
  cursor: pointer;
}
#help-close:hover { background: #e8d48b; }
#save-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 1px solid rgba(201, 168, 76, 0.65);
  border-radius: 16px;
  background: linear-gradient(145deg, #171724, #0c0c13);
  color: #ece8da;
  box-shadow: 0 24px 90px rgba(0,0,0,0.75);
  font-family: system-ui, sans-serif;
}
#save-dialog::backdrop {
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}
.save-content {
  max-height: calc(100dvh - 32px);
  padding: clamp(22px, 5vw, 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.save-content h1 {
  margin: 0;
  color: #f2dfaa;
  font: 700 clamp(1.8rem, 6vw, 2.7rem)/1 Georgia, serif;
}
.save-intro, #save-status {
  color: #aaa8a1;
  font-size: 0.86rem;
  line-height: 1.5;
}
.save-options { display: grid; gap: 10px; margin: 20px 0; }
.save-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
}
.save-option strong { display: block; color: #e8d48b; font-size: 0.9rem; }
.save-option span { color: #888780; font-size: 0.75rem; }
.save-option button, #save-close {
  padding: 9px 13px;
  border: 1px solid #c9a84c;
  border-radius: 7px;
  background: transparent;
  color: #e8d48b;
  font: 750 0.78rem system-ui, sans-serif;
  cursor: pointer;
}
.save-option button:hover, #save-close:hover { background: rgba(201,168,76,0.16); }
#save-reset.confirming {
  border-color: #e74c3c;
  background: #e74c3c;
  color: white;
}
#save-status { min-height: 1.5em; margin: 0; }
#save-status.error { color: #ff8f87; }
#save-status.success { color: #7ee2a8; }
.save-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.ios-install-guide {
  padding: 16px;
  border: 1px solid rgba(201,154,74,0.52);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(66,75,75,0.4), rgba(12,16,18,0.82));
  color: #cfc7b4;
  font-size: 0.84rem;
  line-height: 1.5;
}
.ios-install-guide strong { color: #f0d58a; font: 700 1rem Georgia, serif; }
.ios-install-guide ol { margin: 12px 0 10px 22px; }
.ios-install-guide li { margin: 7px 0; padding-left: 4px; }
.ios-install-guide b { color: #f3e7c6; }
.ios-install-guide p { color: #999386; font-size: 0.78rem; }
.share-glyph {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #c99a4a;
  border-radius: 5px;
  color: #f0d58a;
  font-weight: 900;
}
#settings-dialog {
  width: min(640px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid rgba(201, 168, 76, 0.65);
  border-radius: 16px;
  background: linear-gradient(145deg, #171724, #0c0c13);
  color: #ece8da;
  box-shadow: 0 24px 90px rgba(0,0,0,0.75);
  font-family: system-ui, sans-serif;
}
#settings-dialog::backdrop {
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}
.account-content {
  position: relative;
  max-height: calc(100dvh - 32px);
  padding: clamp(24px, 5vw, 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
#account-dialog,
#billing-admin-dialog {
  width: min(500px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 2px solid rgba(182, 132, 59, 0.72);
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(213,174,94,0.05) 50%, transparent 50.4%),
    repeating-linear-gradient(112deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 12px),
    linear-gradient(145deg, #202729, #0a0d0f 72%);
  color: #ece8da;
  box-shadow: 0 28px 100px rgba(0,0,0,0.82), inset 0 0 0 4px rgba(7,8,9,0.8), inset 0 0 0 5px rgba(226,184,92,0.12);
  font-family: system-ui, sans-serif;
}
#account-dialog::backdrop,
#billing-admin-dialog::backdrop {
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}
.account-header {
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(201,154,74,0.3);
}
.account-header .help-eyebrow { margin-bottom: 7px; }
.account-content h1 {
  margin: 0;
  color: #f2dfaa;
  font: 700 clamp(1.75rem, 7vw, 2.45rem)/1 Georgia, serif;
}
.account-status {
  min-height: 48px;
  margin-top: 16px;
  padding: 11px 13px;
  border-left: 3px solid #c99a4a;
  background: rgba(201,154,74,0.09);
  color: #cfc7b4;
  font-size: 0.84rem;
  line-height: 1.45;
}
.account-fields {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.account-field {
  display: grid;
  gap: 7px;
  color: #d8cfb8;
  font: 800 0.7rem/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.account-field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid rgba(201,154,74,0.54);
  border-radius: 5px;
  background: rgba(5,8,9,0.72);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
  color: #f5e7b8;
  font: 600 1rem/1.2 system-ui, sans-serif;
}
.account-field input:focus {
  border-color: #efd384;
  outline: 2px solid rgba(239,211,132,0.26);
  outline-offset: 1px;
}
.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.account-actions button,
.billing-account-actions button {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(201,154,74,0.54);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(48,56,57,0.9), rgba(17,21,23,0.95));
  color: #ead7a0;
  font: 800 0.74rem/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.account-actions #account-login,
.account-actions #account-checkout,
.account-actions #account-lobby,
.billing-account-actions .is-primary {
  border-color: #efd384;
  background: linear-gradient(180deg, #b58b35, #72521d);
  color: #fff5d2;
}
.account-actions #account-login { grid-column: 1 / -1; }
.account-actions #account-close {
  border-color: transparent;
  background: transparent;
  color: #a9a294;
}
.account-actions #account-close:hover:not(:disabled) { background: rgba(255,255,255,0.05); }
.account-actions #account-logout,
.billing-account-actions .is-danger {
  border-color: rgba(201,82,70,0.76);
  color: #ffd0c8;
}
.account-actions button:hover:not(:disabled),
.billing-account-actions button:hover:not(:disabled) { filter: brightness(1.16); }
.account-actions button:disabled,
.billing-account-actions button:disabled { cursor: not-allowed; opacity: 0.44; }
#billing-admin-dialog { width: min(680px, calc(100vw - 28px)); }
.billing-content { padding-bottom: 28px; }
.billing-content .settings-panel {
  display: grid;
  gap: 8px;
  max-height: min(50dvh, 460px);
  overflow-y: auto;
}
.billing-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid rgba(201,154,74,0.22);
  border-radius: 5px;
  background: rgba(5,8,9,0.4);
}
.billing-account-details { display: grid; gap: 4px; min-width: 0; }
.billing-account-details strong { overflow: hidden; color: #f3e4b7; font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.billing-account-details span { color: #aaa18d; font-size: 0.76rem; }
.billing-account-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.billing-account-actions button { min-height: 34px; padding: 8px 9px; font-size: 0.68rem; }
.settings-content { padding: clamp(22px, 5vw, 36px); }
.settings-content h1 {
  margin: 0;
  color: #f2dfaa;
  font: 700 clamp(1.8rem, 6vw, 2.7rem)/1 Georgia, serif;
}
.settings-intro {
  margin-top: 10px;
  color: #aaa8a1;
  font-size: 0.86rem;
  line-height: 1.5;
}
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.settings-tab {
  padding: 12px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #e8d48b;
  font: 800 0.84rem/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.settings-tab.active {
  border-color: rgba(201, 168, 76, 0.75);
  background: rgba(201, 168, 76, 0.18);
  color: #fff3c9;
}
.settings-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  background: rgba(255,255,255,0.035);
}
.settings-panel h2 {
  margin: 0 0 8px;
  color: #e8d48b;
  font-size: 1rem;
}
.settings-panel p {
  margin: 0;
  color: #aaa8a1;
  font-size: 0.86rem;
  line-height: 1.5;
}
.settings-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 14px 0 0;
  color: #d9d4c8;
  font-size: 0.86rem;
}
.settings-panel dt { color: #fff; font-weight: 700; }
.settings-panel dd { margin: 0; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.settings-actions button {
  padding: 9px 13px;
  border: 1px solid #c9a84c;
  border-radius: 7px;
  background: transparent;
  color: #e8d48b;
  font: 750 0.78rem system-ui, sans-serif;
  cursor: pointer;
}
.settings-actions button:hover { background: rgba(201,168,76,0.16); }
#terrain-customization-modal {
  width: min(700px, calc(100vw - 28px));
  max-height: min(90vh, 800px);
  padding: 0;
  border: 1px solid rgba(201, 168, 76, 0.65);
  border-radius: 16px;
  background: linear-gradient(145deg, #171724, #0c0c13);
  color: #ece8da;
  box-shadow: 0 24px 90px rgba(0,0,0,0.75);
  font-family: system-ui, sans-serif;
}
#terrain-customization-modal::backdrop {
  background: rgba(3, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}
.terrain-content {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 5vw, 36px);
  overflow-y: auto;
}
.terrain-content h1 {
  margin: 0;
  color: #f2dfaa;
  font: 700 clamp(1.8rem, 6vw, 2.5rem)/1 Georgia, serif;
}
.terrain-intro {
  margin-top: 10px;
  color: #aaa8a1;
  font-size: 0.86rem;
  line-height: 1.5;
}
.terrain-section {
  margin-top: 24px;
}
.terrain-section h2 {
  margin: 0 0 14px;
  color: #e8d48b;
  font-size: 1rem;
  font-weight: 700;
}
.terrain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.terrain-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #d9d4c8;
  font-size: 0.84rem;
}
.terrain-field span {
  color: #e8d48b;
  font-weight: 600;
}
.terrain-field input[type="text"],
.terrain-field input[type="range"] {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: #e8d48b;
  font: 0.84rem system-ui, monospace;
}
.terrain-field input[type="text"] {
  font-size: 0.88rem;
}
.terrain-field input[type="range"] {
  padding: 8px;
  cursor: pointer;
  accent-color: #c9a84c;
}
.terrain-field input[type="text"]:focus,
.terrain-field input[type="range"]:focus {
  outline: 2px solid #c9a84c;
  outline-offset: 1px;
}
.terrain-range-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.terrain-range-row input[type="range"] {
  flex: 1;
  min-width: 100px;
}
.terrain-range-row output {
  min-width: 50px;
  text-align: right;
  color: #c9a84c;
  font-weight: 600;
}
.terrain-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.terrain-checkbox input[type="checkbox"] {
  cursor: pointer;
  accent-color: #c9a84c;
}
.terrain-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.09);
}
.terrain-btn-primary {
  padding: 11px 18px;
  border: 1px solid #c9a84c;
  border-radius: 8px;
  background: #c9a84c;
  color: #111116;
  font: 800 0.86rem system-ui, sans-serif;
  cursor: pointer;
}
.terrain-btn-primary:hover { background: #e8d48b; }
.terrain-btn-secondary {
  padding: 11px 18px;
  border: 1px solid rgba(201,168,76,0.5);
  border-radius: 8px;
  background: transparent;
  color: #e8d48b;
  font: 750 0.82rem system-ui, sans-serif;
  cursor: pointer;
}
.terrain-btn-secondary:hover { background: rgba(201,168,76,0.16); }
@media (max-width: 620px) {
  .help-grid { grid-template-columns: 1fr; }
  .help-content { padding: 22px 18px; }
  #help-dialog { max-height: calc(100vh - 16px); }
  .settings-tabs { grid-template-columns: 1fr; }
  .terrain-grid { grid-template-columns: 1fr; }
}
#brand-splash {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(191, 145, 47, 0.18), transparent 28%),
    linear-gradient(180deg, #06070b 0%, #0a0a0f 55%, #050507 100%);
  transition: opacity 0.7s ease;
}
#brand-splash.fade-out {
  opacity: 0;
  pointer-events: none;
}
.brand-splash__veil {
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.06) 50%, transparent 65%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04), transparent 55%);
  animation: brandSweep 1.8s ease-in-out infinite;
}
.brand-splash__core {
  position: relative;
  width: min(92vw, 760px);
  display: grid;
  place-items: center;
  isolation: isolate;
}
.brand-splash__logo {
  z-index: 1;
  display: block;
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  opacity: 0;
  filter: drop-shadow(0 18px 48px rgba(0, 0, 0, 0.78));
  animation: brandLogoIn 1.05s ease 0.1s forwards;
}
.brand-splash__embers {
  position: absolute;
  inset: -10% -16%;
  pointer-events: none;
}
.brand-splash__embers span {
  position: absolute;
  bottom: 12%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,236,177,0.95), rgba(201,168,76,0.8) 45%, rgba(201,168,76,0));
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
  animation: brandEmberRise 2.8s ease-in infinite;
}
.brand-splash__embers span:nth-child(1) { left: 14%; animation-delay: 0.2s; }
.brand-splash__embers span:nth-child(2) { left: 29%; animation-delay: 1.2s; width: 5px; height: 5px; }
.brand-splash__embers span:nth-child(3) { left: 44%; animation-delay: 0.8s; }
.brand-splash__embers span:nth-child(4) { left: 58%; animation-delay: 1.6s; width: 6px; height: 6px; }
.brand-splash__embers span:nth-child(5) { left: 72%; animation-delay: 0.45s; }
.brand-splash__embers span:nth-child(6) { left: 84%; animation-delay: 1.9s; width: 4px; height: 4px; }
.brand-splash__pulse {
  width: min(48vw, 320px);
  height: min(48vw, 320px);
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(237, 48, 25, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(237, 48, 25, 0.2);
  animation: brandPulse 1.8s ease-out infinite;
}
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #0a0a0f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
#splash.pre-splash-hidden {
  opacity: 0;
  pointer-events: none;
}
#splash.fade-out {
  opacity: 0;
  pointer-events: none;
}
#splash img {
  max-width: min(480px, 85vw);
  height: auto;
}
#splash .loading-bar-track {
  width: min(320px, 60vw);
  height: 6px;
  background: #1a1a2e;
  border-radius: 3px;
  margin-top: 32px;
  overflow: hidden;
}
#splash .loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #c9a84c, #e8d48b);
  border-radius: 3px;
  transition: width 0.3s ease;
}
#splash .loading-text {
  margin-top: 14px;
  color: #666;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
#main-menu {
  position: fixed;
  inset: 0;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 26%, rgba(185, 118, 42, 0.16), transparent 30%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #101518 0%, #080b0d 58%, #030405 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
#main-menu.visible {
  opacity: 1;
  pointer-events: auto;
}
.main-menu__panel {
  width: min(620px, 100%);
  max-height: calc(100dvh - 48px);
  padding: clamp(18px, 3.4vw, 30px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 2px solid rgba(182, 132, 59, 0.72);
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(213,174,94,0.06) 50%, transparent 50.3%),
    repeating-linear-gradient(112deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 12px),
    linear-gradient(145deg, rgba(31,38,40,0.98), rgba(9,12,14,0.99));
  box-shadow: 0 30px 100px rgba(0,0,0,0.76), inset 0 0 0 4px rgba(7,8,9,0.85), inset 0 0 0 5px rgba(226,184,92,0.12);
  text-align: center;
}
.main-menu__logo {
  display: block;
  width: min(100%, 410px);
  max-height: min(52vh, 410px);
  margin: -8px auto -12px;
  object-fit: contain;
  filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.65));
}
.main-menu__subtitle {
  margin-top: 14px;
  color: #c5bda9;
  font: 500 0.95rem/1.55 system-ui, sans-serif;
}
.main-menu__settings {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  text-align: left;
}
.main-menu__field {
  display: grid;
  gap: 8px;
  color: #ddd6c1;
  font: 700 0.82rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.main-menu__field input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(201, 168, 76, 0.42);
  border-radius: 10px;
  background: rgba(8, 8, 14, 0.82);
  color: #f5e7b8;
  font: 600 0.96rem/1.2 system-ui, sans-serif;
}
.main-menu__field input[type="text"]:focus {
  outline: 2px solid rgba(232, 212, 139, 0.65);
  outline-offset: 2px;
}
.main-menu__range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.main-menu__range-row input[type="range"] {
  width: 100%;
  accent-color: #c9a84c;
}
.main-menu__range-row output {
  min-width: 3.5em;
  color: #f0d585;
  font: 700 0.88rem/1 system-ui, sans-serif;
  text-align: right;
}
.main-menu__actions {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.main-menu__actions button {
  width: 100%;
  padding: 13px 16px;
  min-height: 48px;
  border: 1px solid rgba(218, 177, 91, 0.68);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent, rgba(226,185,96,0.08), transparent),
    linear-gradient(180deg, rgba(51,59,60,0.96), rgba(18,23,25,0.98));
  color: #f3dfa7;
  font: 800 0.9rem/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-shadow: 0 1px 2px #000;
  box-shadow: inset 0 1px rgba(255,255,255,0.07), 0 4px 10px rgba(0,0,0,0.28);
  transition: border-color 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}
.main-menu__actions button:hover {
  border-color: #f0d585;
  filter: brightness(1.18);
  transform: translateY(-1px);
}
.main-menu__actions button:active {
  transform: translateY(1px);
  filter: brightness(0.92);
}
.main-menu__actions button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.main-menu__version {
  margin: 16px 0 0;
  font-size: 10px;
  color: #8f918b;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
  text-align: center;
}
#system-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(201, 168, 76, 0.55);
  border-radius: 10px;
  background: rgba(10, 10, 15, 0.94);
  color: #e8d48b;
  font: 600 13px/1.35 system-ui, sans-serif;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(100% + 48px));
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  pointer-events: none;
}
#system-toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
#system-toast button {
  flex: none;
  padding: 7px 11px;
  border: 1px solid #c9a84c;
  border-radius: 6px;
  background: #c9a84c;
  color: #111116;
  font: inherit;
  cursor: pointer;
}
#system-toast button:hover { background: #e8d48b; }
#system-toast button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
@keyframes brandLogoIn {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}
@keyframes brandPulse {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.68);
    box-shadow: 0 0 0 0 rgba(237, 48, 25, 0.28);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.22);
    box-shadow: 0 0 0 22px rgba(237, 48, 25, 0);
  }
}
@keyframes brandEmberRise {
  0% {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.4);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(18px, -120px, 0) scale(1.2);
  }
}
@keyframes brandSweep {
  0% { transform: translateX(-12%) rotate(0deg); }
  50% { transform: translateX(12%) rotate(4deg); }
  100% { transform: translateX(-12%) rotate(0deg); }
}

@media (max-width: 620px) {
  #main-menu {
    align-items: stretch;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .main-menu__panel {
    width: 100%;
    max-height: 100%;
    padding: 14px 16px 18px;
    border-radius: 14px;
  }
  .main-menu__logo {
    width: min(76vw, 330px);
    max-height: 40dvh;
    margin: -10px auto -14px;
  }
  .main-menu__subtitle {
    margin-top: 8px;
    font-size: 0.88rem;
  }
  .main-menu__settings {
    gap: 10px;
    margin-top: 14px;
  }
  .main-menu__actions {
    gap: 10px;
    margin-top: 16px;
  }
  .main-menu__actions button,
  .main-menu__field input[type="text"] { min-height: 48px; }
  .brand-splash__core { width: min(94vw, 620px); }
  .brand-splash__logo { max-height: 76dvh; }
}

@media (max-height: 650px) {
  .main-menu__logo {
    width: min(52vw, 260px);
    max-height: 34dvh;
  }
  .main-menu__subtitle { display: none; }
}

@media (max-width: 520px) {
  .account-content { padding: 24px 20px; }
  .account-actions { grid-template-columns: 1fr; }
  .billing-account-row { display: grid; }
  .billing-account-actions { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .billing-account-actions button { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-splash__veil,
  .brand-splash__logo,
  .brand-splash__embers span,
  .brand-splash__pulse { animation: none; }
  .brand-splash__logo { opacity: 1; }
}

/* Shared forged-stone treatment for every DOM-based menu. */
#help-dialog,
#save-dialog,
#settings-dialog,
#terrain-customization-modal {
  border: 2px solid rgba(182, 132, 59, 0.72);
  border-radius: 10px;
  background:
    repeating-linear-gradient(112deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 12px),
    linear-gradient(145deg, #202729, #0a0d0f 72%);
  box-shadow: 0 28px 100px rgba(0,0,0,0.82), inset 0 0 0 4px rgba(7,8,9,0.8), inset 0 0 0 5px rgba(226,184,92,0.12);
}
.help-card,
.save-option,
.settings-panel,
.terrain-section {
  border-color: rgba(201,154,74,0.26);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(50,58,59,0.42), rgba(12,16,18,0.72));
  box-shadow: inset 0 1px rgba(255,255,255,0.035);
}
.settings-tab,
.save-option button,
#save-close,
.terrain-btn-secondary {
  border-color: rgba(201,154,74,0.52);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(48,56,57,0.9), rgba(17,21,23,0.95));
}
.settings-tab.active,
#help-close,
.terrain-btn-primary {
  border-color: #efd384;
  border-radius: 5px;
  background: linear-gradient(180deg, #d6ad5d, #8f632f);
  color: #0b0d0e;
  box-shadow: inset 0 1px rgba(255,255,255,0.32), 0 4px 12px rgba(0,0,0,0.35);
}
#help-btn,
#save-btn,
#fullscreen-btn {
  border-color: rgba(218,177,91,0.7);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(45,53,54,0.95), rgba(10,13,15,0.96));
  color: #f1d993;
  box-shadow: inset 0 1px rgba(255,255,255,0.08), 0 5px 16px rgba(0,0,0,0.42);
}
