/* DigitalMarek page foundation */
:root {
  color-scheme: dark;
  --dm-background: #08080a;
  --dm-background-raised: #101014;
  --dm-surface: rgba(22, 22, 27, 0.78);
  --dm-foreground: #eceae4;
  --dm-muted: rgba(236, 234, 228, 0.68);
  --dm-dim: rgba(236, 234, 228, 0.48);
  --dm-line: rgba(236, 234, 228, 0.1);
  --dm-line-strong: rgba(236, 234, 228, 0.24);
  --dm-focus: #8deee0;
  --dm-page-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--dm-background);
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  color: var(--dm-foreground);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 34rem),
    var(--dm-background);
  font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 82, 163, 0.12), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(98, 111, 255, 0.13), transparent 30rem),
    radial-gradient(circle at 72% 82%, rgba(71, 223, 196, 0.09), transparent 32rem),
    radial-gradient(circle at 20% 88%, rgba(245, 190, 75, 0.07), transparent 26rem);
}

.site-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(calc(100% - 48px), var(--dm-page-width));
  min-height: 72px;
  margin: 0 auto;
  border-bottom: 1px solid var(--dm-line);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  color: var(--dm-foreground);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: conic-gradient(from 215deg, #ff62a9, #8a77ff, #62ddeb, #74e0a4, #f4bf52, #ff62a9);
  box-shadow: 0 0 18px rgba(141, 238, 224, 0.35);
}

.site-mode,
.game-eyebrow {
  margin: 0;
  color: var(--dm-dim);
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.site-mode {
  justify-self: center;
}

#portfolio-return {
  float: none;
  justify-self: end;
  margin: 0;
  color: var(--dm-muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-decoration-color: var(--dm-line-strong);
  text-underline-offset: 5px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

#portfolio-return:hover {
  color: var(--dm-foreground);
  opacity: 1;
  text-decoration-color: var(--dm-focus);
}

#portfolio-return:focus-visible {
  outline: 2px solid var(--dm-focus);
  outline-offset: 5px;
}

.game-page {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 48px), var(--dm-page-width));
  margin: 0 auto;
  padding: 64px 0 72px;
}

.game-heading {
  width: 960px;
  max-width: 100%;
  margin: 0 auto 24px;
}

.game-heading h1 {
  max-width: none;
  margin: 8px 0 0;
  color: var(--dm-foreground);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 4vw, 56px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.game-byline {
  margin: 12px 0 0;
  color: var(--dm-muted);
  font-size: 12px;
  letter-spacing: 0.025em;
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr auto;
    width: min(calc(100% - 28px), var(--dm-page-width));
  }

  .site-mode {
    display: none;
  }

  .game-page {
    width: min(calc(100% - 28px), var(--dm-page-width));
    padding-top: 40px;
  }
}

/* Fixed desktop game frame */
#unity-container,
#unity-container.unity-desktop {
  position: relative;
  left: auto;
  top: auto;
  width: fit-content;
  margin: 0 auto;
  transform: none;
}

.game-frame {
  position: relative;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--dm-line-strong);
  border-radius: 4px;
  background: var(--dm-background-raised);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.game-frame::before {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 8%;
  left: 8%;
  height: 1px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #ff62a9, #8a77ff, #62ddeb, #74e0a4, #f4bf52, transparent);
  opacity: 0.8;
}

#unity-canvas {
  display: block;
  background: #231F20;
}

#unity-canvas:focus-visible {
  outline: 2px solid var(--dm-focus);
  outline-offset: -2px;
}

#unity-container.unity-mobile {
  position: fixed;
  width: 100%;
  height: 100%;
  margin: 0;
}

.unity-mobile #unity-canvas {
  width: 100%;
  height: 100%;
}

/* Unity loading presentation */
#unity-loading-bar {
  position: absolute;
  z-index: 2;
  display: none;
  inset: 8px;
  width: auto;
  height: auto;
  padding-top: 226px;
  transform: none;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(98, 221, 235, 0.08), transparent 22rem),
    rgba(8, 8, 10, 0.96);
}

#unity-logo {
  display: none;
}

.loading-copy p {
  margin: 0;
}

.loading-brand {
  color: var(--dm-dim);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.loading-title {
  margin-top: 8px !important;
  color: var(--dm-foreground);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

#unity-progress-bar-empty {
  width: 360px;
  height: 3px;
  margin: 28px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--dm-line-strong);
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  margin: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff62a9, #8a77ff, #62ddeb, #74e0a4, #f4bf52);
  box-shadow: 0 0 16px rgba(141, 238, 224, 0.32);
  transition: width 120ms linear;
}

.unity-mobile #unity-loading-bar {
  inset: 0;
  padding-top: 42vh;
}

/* Game context and controls */
#unity-footer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  margin-top: 10px;
  color: var(--dm-dim);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.build-controls,
.control-guide {
  display: flex;
  align-items: center;
}

.control-guide {
  justify-self: start;
  gap: 12px;
  margin: 0;
  white-space: nowrap;
}

.control-guide span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.control-guide kbd {
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid var(--dm-line-strong);
  border-radius: 3px;
  color: var(--dm-muted);
  background: var(--dm-surface);
  font: inherit;
  line-height: 1.2;
  text-align: center;
}

.build-controls {
  justify-self: end;
  gap: 10px;
}

#unity-build-title {
  float: none;
  margin: 0;
  color: var(--dm-muted);
  font-family: inherit;
  font-size: 10px;
  line-height: 1.25;
}

#unity-build-title span {
  color: var(--dm-dim);
}

#diagnostics-icon {
  width: 24px;
  height: 24px;
  opacity: 0.68;
  cursor: pointer;
}

#unity-fullscreen-button {
  float: none;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--dm-line-strong);
  border-radius: 3px;
  background: var(--dm-surface) url("fullscreen-button.png") no-repeat center;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

#unity-fullscreen-button:hover {
  border-color: var(--dm-focus);
  background-color: rgba(141, 238, 224, 0.08);
}

#unity-fullscreen-button:active {
  transform: scale(0.96);
}

#unity-fullscreen-button:focus-visible {
  outline: 2px solid var(--dm-focus);
  outline-offset: 3px;
}

.unity-mobile #unity-footer {
  display: none;
}

@media (max-width: 1040px) {
  #unity-footer {
    grid-template-columns: 1fr auto;
  }

  .control-guide {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 8px;
  }
}

/* Unity warning and startup-error surface */
#unity-warning {
  position: absolute;
  z-index: 4;
  display: none;
  top: 24px;
  left: 50%;
  width: min(calc(100% - 48px), 680px);
  padding: 0;
  transform: translateX(-50%);
  color: var(--dm-foreground);
  background: transparent;
  font-size: 12px;
  pointer-events: none;
}

.unity-message {
  padding: 12px 14px;
  border: 1px solid var(--dm-line-strong);
  border-radius: 3px;
  background: rgba(16, 16, 20, 0.96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  overflow-wrap: anywhere;
}

.unity-message + .unity-message {
  margin-top: 8px;
}

.unity-message--warning {
  border-color: rgba(244, 191, 82, 0.58);
  color: #f7d994;
}

.unity-message--error {
  border-color: rgba(255, 98, 169, 0.64);
  color: #ffc1dc;
}
