@font-face {
  font-family: "NeueMontreal";
  src: url("./fonts/PPNeueMontreal-Medium.woff2");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "MessinaModern";
  src: url("./fonts/MessinaModernWeb-Regular.woff2");
  font-weight: 400;
  font-style: normal;
}

:root {
  --nav-height: 46px;
  --footer-height: 52px;
  --next-row-height: 64px;
}

* { box-sizing: border-box; }
html { height: 100%; }

::-webkit-scrollbar { display: block; width: 10px; }
::-webkit-scrollbar-thumb { background: #303030; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  height: 100dvh;
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  color: #303030;
  background: #fff;
  overflow: hidden;
}

/* Off-screen but layout-capable (helps execCommand copy after await). */
.clipboard-scratch {
  position: fixed;
  left: -320px;
  top: 0;
  width: 300px;
  min-height: 80px;
  margin: 0;
  padding: 8px;
  border: 1px solid transparent;
  opacity: 0.02;
  font-size: 12px;
  line-height: 1.4;
  resize: none;
  z-index: 0;
  pointer-events: auto;
}

.toast-pill {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 2147483647;
  padding: 10px 22px;
  border-radius: 999px;
  background: #3a3a3a;
  color: #e8e8e8;
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.toast-pill.toast-pill--visible {
  opacity: 1;
  visibility: visible;
}

/*
  <dialog>: never style display/layout on the closed element — it overrides UA display:none and
  flashes the dialog on load. Only apply when [open] (showModal).
  Layout + type ramp match resources/views/components/beta-info.blade.php (Tailwind → plain CSS).
*/
.copy-fallback-dialog:not([open]) {
  display: none !important;
}
.copy-fallback-dialog[open] {
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) min(20px, 4vw) max(16px, env(safe-area-inset-bottom));
  border: none;
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.copy-fallback-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
/* modal-container … max-w-3xl bg-stone-800 text-white (beta-info) */
.copy-fallback-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(92vw, 48rem);
  height: min(61.5dvh, 585px);
  max-height: min(67.5dvh, 675px);
  min-height: min(41.25dvh, 390px);
  overflow: hidden;
  background: #292524;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.copy-fallback-section--head {
  flex: 0 0 auto;
  border-bottom: 1px solid #78716c;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}
.copy-fallback-x-row {
  display: flex;
  justify-content: flex-end;
  margin-left: 1rem;
  margin-right: 1rem;
  margin-bottom: 0;
}
/* Close control: skewed lines like beta-info blade */
.copy-fallback-x {
  position: relative;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.copy-fallback-x:hover {
  color: #a8a29e;
}
.copy-fallback-x-line {
  position: absolute;
  inset: 0;
  border-top: 1px solid currentColor;
  transform: translateY(50%) skewY(45deg);
}
.copy-fallback-x-line--mirror {
  transform: translateY(50%) skewY(-45deg);
}
.copy-fallback-heading {
  margin: 0 auto 1.5rem;
  max-width: 36rem;
  padding: 0 1rem;
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
}
.copy-fallback-lede {
  margin: 0 auto;
  max-width: 36rem;
  padding: 0 1rem;
  font-family: "MessinaModern", Georgia, "Times New Roman", serif;
  font-size: clamp(0.88rem, 1.8vw, 1rem);
  line-height: 1.55;
  letter-spacing: 0.02em;
  font-weight: 400;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
}
.copy-fallback-section--body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Mirror head: padding below lede / above divider is 1.5rem — same gap below divider to textarea as beta block rhythm */
  padding: 1.5rem 0 1.5rem;
}
.copy-fallback-section--body .copy-fallback-url {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}
.copy-fallback-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.copy-fallback-url {
  display: block;
  flex: 1 1 auto;
  width: calc(100% - 2rem);
  min-height: 135px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  background: #1c1917;
  color: #f5f5f4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  text-align: left;
  resize: none;
  word-break: break-all;
  box-sizing: border-box;
}
.copy-fallback-url:focus {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

/* Rate limit: same <dialog> shell, shorter content, brand accent. */
.copy-fallback-panel.rate-limit-panel {
  min-height: 0;
  height: auto;
  max-height: min(90dvh, 560px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  border-top: 3px solid #f15c24;
}
.rate-limit-section.copy-fallback-section--head {
  border-bottom: 0;
  padding-bottom: 0.5rem;
}
.rate-limit-aside {
  margin: 1.25rem auto 0;
  max-width: 36rem;
  padding: 0 1rem;
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  font-size: clamp(0.7rem, 1.2vw, 0.8rem);
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
}
.rate-limit-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 0.75rem 1.5rem 1.75rem;
}
.rate-limit-ok {
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  font-size: clamp(0.8rem, 1.4vw, 0.9rem);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 2rem 13px;
  border: 1px solid #78716c;
  border-radius: 0;
  background: #3f3a36;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.rate-limit-ok:hover {
  background: #524a44;
  border-color: #a8a29e;
  color: #fff;
}
.rate-limit-ok:focus-visible {
  outline: 2px solid rgba(241, 92, 36, 0.65);
  outline-offset: 3px;
}

.navbar {
  background: #fff;
  border-bottom: 1px solid #d1d5db;
  padding: 5px 0;
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 3vw;
  min-height: 36px;
}
/* Matches sabin.build's link styling: 25px uppercase NeueMontreal with
   a Tailwind-style cubic-bezier(.4, 0, .2, 1) color transition. */
.nav-link {
  font-size: 25px;
  line-height: 1;
  text-transform: uppercase;
  color: #303030;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Brand orange now tracks staging.sabin.design's --color-brand-orange. */
.nav-link.active { color: #f15c24; }
/* Hover greys out non-active links (matches sabin.build's
   hover:text-[#808080]). The active CTA stays orange — sabin.build's
   "Build" link has no hover state for the same reason. */
.nav-link:not(.active):hover { color: #808080; }
/* Brand is now the SABIN logo image at the same 19.7px height
   sabin.build uses. The brand link does not get .nav-link, so the
   hover-greys-out rule above doesn't touch it. */
.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.brand img {
  display: block;
  height: 19.7px;
  width: auto;
}

/* Flex child: grows when navbar/footer are removed from the column. */
.workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  scroll-behavior: smooth;
}
.scene-section {
  position: relative;
  height: 100%;
  min-height: 100%;
}
.planner-window {
  height: calc(100% - var(--next-row-height));
}
#unityFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.next-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--next-row-height);
  padding: 0 3vw;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  background: #E5E4DC;
  text-transform: uppercase;
}
.next-code {
  text-align: center;
  font-family: "MessinaModern", serif;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.04em;
}
.next-link {
  justify-self: end;
  align-self: end;
  padding-bottom: 12px;
  color: #303030;
  text-decoration: none;
  font-size: 2.2rem;
  line-height: 1;
}
.next-link:hover { color: #808080; }

.submit-view {
  min-height: calc(100% - 4rem);
  height: calc(100% - 4rem);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #fff;
  text-transform: uppercase;
}
.submit-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #303030;
}
.submit-col:last-child { border-right: 0; }
.submit-col p { margin: 0; }
.submit-list {
  font-family: "MessinaModern", serif;
  font-size: 12px;
  line-height: 1.2;
}
.submit-list p { margin-bottom: 4px; }
.submit-list p:last-child { margin-bottom: 0; }

.submit-block-title {
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  line-height: 1;
  padding: 24px 24px 0 3vw;
}
.submit-col-left-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 0 18px;
  min-height: 0;
  overflow: hidden;
}
.submit-col-left .submit-block-title {
  padding: 24px 24px 0 18px;
}
.submit-details {
  display: none;
}
.submit-detail-main {
  font-size: 12px;
  line-height: 1.1;
  margin-bottom: 8px !important;
}
.area-list {
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 8px;
  padding-right: 8px;
  padding-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  font-family: "NeueMontreal", Arial, sans-serif;
  text-transform: none;
}
.area-panel {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 2px 0 6px;
  border-bottom: 1px solid #d2d2d2;
  text-transform: none;
}
.area-panel-top {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: start;
  column-gap: 6px;
}
.area-panel-thumb {
  width: 104px;
  height: 104px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.area-panel-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.area-panel-thumb-placeholder {
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 10px;
  color: #666;
  text-transform: none;
}
.area-panel-body {
  display: flex;
  flex-direction: column;
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.08;
  color: #2a2a2a;
  text-transform: none;
  min-width: 0;
}
.area-panel-row {
  margin: 0 0 3px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.area-panel-row:last-child {
  margin-bottom: 0;
}
.area-panel-label {
  font-family: "NeueMontreal", Arial, sans-serif;
  font-weight: 500;
}
.area-panel-value {
  font-family: "MessinaModern", serif;
}
.area-panel-extra {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed #c9c9c9;
}
.area-panel-extra[hidden] {
  display: none !important;
}
.area-panel-footer {
  border-top: 1px solid #d2d2d2;
  padding-top: 5px;
}
.area-panel-part {
  width: 100%;
}
.area-panel-part-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: left;
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.12;
  color: #2a2a2a;
  cursor: copy;
  text-transform: none;
  white-space: normal;
  overflow-wrap: break-word;
}
.area-panel-part-btn:hover {
  color: #f15c24;
}
.area-panel-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  min-width: 0;
  line-height: 1;
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  color: #666;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.area-panel-toggle:hover {
  color: #000;
}
.area-panel-toggle-inline {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-left: 10px;
}

/* Keep this column independently scrollable from the rest of submit view. */
.submit-col.submit-col-left {
  min-height: 0;
  overflow: hidden;
}

.submit-col-mid {
  display: flex;
  flex-direction: column;
}
.submit-mid-top {
  flex: 1;
  padding: 24px 32px;
}
.submit-mid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0;
  margin-bottom: 32px;
}
.submit-col-mid .submit-block-title {
  padding: 0;
  margin-bottom: 24px;
}
.submit-col-mid .submit-list {
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.2;
}

.submit-download-row {
  border-top: 1px solid #303030;
  padding: 20px 32px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.submit-download-headings {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.submit-download-headings .submit-header,
.submit-download-headings .submit-label {
  margin: 0;
}
.submit-header {
  font-size: 16px;
  line-height: 1.15;
  font-family: "NeueMontreal", Arial, sans-serif;
}
.submit-label {
  font-size: 12px;
  line-height: 1.2;
  font-family: "NeueMontreal", Arial, sans-serif;
}
.submit-download-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.submit-download {
  font-size: 24px;
  line-height: 1.2;
  font-family: "NeueMontreal", Arial, sans-serif;
  margin: 0;
}
.submit-download-link {
  color: #303030;
  text-decoration: none;
}
.submit-download-link:hover {
  color: #808080;
}
.submit-download-placeholder {
  visibility: hidden;
}
.submit-download-disabled {
  pointer-events: none;
  cursor: not-allowed;
  user-select: none;
  opacity: 0.45;
  color: #303030;
  text-decoration: none;
  text-decoration-line: none;
}
/* Browsers re-apply default link underline on :link/:visited; keep disabled anchors plain. */
a.submit-download-disabled,
a.submit-download-disabled:link,
a.submit-download-disabled:visited,
a.submit-download-disabled:hover,
a.submit-download-disabled:active,
a.submit-download-disabled:focus,
a.submit-download-disabled:focus-visible {
  text-decoration: none;
  text-decoration-line: none;
}
.submit-col-right {
  background: #F9BE5E;
  display: flex;
  flex-direction: column;
}
.submit-right-top {
  flex: 1;
  padding: 24px 24px 24px 32px;
}
.submit-note {
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.2;
  margin-bottom: 24px !important;
}
.submit-cta {
  display: block;
  text-decoration: none;
  color: #303030;
  font-family: "NeueMontreal", Arial, sans-serif;
  font-size: 48px;
  line-height: 1;
  margin-top: 12px;
}
.submit-cta:hover { color: #fff; }
.submit-cta-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.45;
  user-select: none;
}
.submit-cta-disabled:hover {
  color: #303030;
}

/* Mirrors sabin.build's bottom bar: 3-col grid with uppercase
   NeueMontreal at text-sm (14px / 20px line), no letter-spacing, top
   border in stone-800 (#303030). */
.site-footer {
  container-type: inline-size;
  container-name: site-footer;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  border-top: 1px solid #303030;
  height: var(--footer-height);
  padding: 0 3vw;
  font-family: "NeueMontreal", Arial, Helvetica, sans-serif;
  font-size: clamp(9px, 2.75cqw, 14px);
  line-height: 1.25;
  color: #303030;
  text-transform: uppercase;
  background: #fff;
  flex: 0 0 auto;
}
.footer-left {
  display: flex;
  gap: clamp(8px, 4cqw, 24px);
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}
.footer-left a,
.footer-left span,
.footer-center,
.footer-center a {
  white-space: nowrap;
}
.footer-center { text-align: center; min-width: 0; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: #808080; }

@media (max-width: 720px) and (min-height: 721px) {
  .footer-tail {
    display: none;
  }
  .site-footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: clamp(6px, 3cqw, 14px);
    height: var(--footer-height);
    padding: 0 max(12px, 3vw);
  }
  .footer-left {
    flex: 1 1 auto;
    gap: clamp(6px, 3cqw, 16px);
    min-width: 0;
    text-align: left;
  }
  .footer-center {
    flex: 0 1 auto;
    text-align: right;
    margin-left: 6px;
    min-width: 0;
  }
}

/* Short non-mobile windows: hide footer; workspace flexes to fill. */
html.is-short-viewport:not(.is-mobile-os) .site-footer {
  display: none;
}

/* Under 650px tall: hide navbar; workspace flexes into freed space. */
html.is-compact-height .navbar {
  display: none;
}

/* iOS / Android (class set in index.html): max Unity viewport — hide NEXT bar,
   footer, and submit panel; iframe fills everything below the navbar. */
html.is-mobile-os {
  --next-row-height: 0px;
}

html.is-mobile-os .next-row {
  display: none;
}

html.is-mobile-os .planner-window {
  height: 100%;
}

html.is-mobile-os .submit-view {
  display: none;
}

html.is-mobile-os .site-footer {
  display: none;
}
