@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/poppins-600.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/poppins-700.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("./fonts/poppins-800.woff2") format("woff2");
}

:root {
  --bg: #000000;
  --text: #ffffff;
  --muted: #bfc3ca;
  --dim: rgba(255, 255, 255, 0.52);
  --surface: rgba(28, 30, 34, 0.86);
  --line: rgba(255, 255, 255, 0.74);
  --blue: #6abfff;
  --blue-soft: #9fdbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 600px;
  height: 600px;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
  color: inherit;
}

.app-root {
  position: relative;
  width: 600px;
  height: 600px;
  padding: 14px 15px 18px;
  background:
    radial-gradient(circle at 68% 43%, rgba(255, 255, 255, 0.08), transparent 30%),
    radial-gradient(circle at 50% 52%, rgba(106, 191, 255, 0.055), transparent 48%),
    #000000;
}

.app-header {
  position: relative;
  z-index: 8;
  height: 54px;
  display: grid;
  grid-template-columns: 189px 1fr 189px;
  align-items: start;
  gap: 4px;
}

.brand-logo,
.screen-logo {
  display: block;
  width: 137px;
  height: 55px;
  object-fit: contain;
}

.brand-logo {
  justify-self: center;
  margin-top: 3px;
}

.header-action,
.error-action {
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(145deg, rgba(48, 49, 52, 0.78), rgba(16, 17, 20, 0.86));
  color: rgba(255, 255, 255, 0.86);
  text-transform: uppercase;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
  outline: none;
}

.header-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.header-action span:last-child {
  color: rgba(255, 255, 255, 0.52);
}

.header-action.has-new span:last-child {
  color: var(--blue);
}

.header-action.dpad-selected {
  border-color: #ffffff;
  border-width: 2px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(20, 24, 29, 0.96));
  transform: scale(0.965);
}

.material-stage {
  position: absolute;
  inset: 76px 15px 43px;
  outline: none;
  overflow: hidden;
}

.text-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.title-stack,
.new-badge,
.depth-label,
.type-rail,
.copy-panel {
  --switch-y: 0px;
  opacity: 1;
  transform: translateY(0);
  transition:
    transform 260ms cubic-bezier(0.4, 0.04, 0.5, 1),
    opacity 210ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

.title-stack.copy-exit,
.new-badge.copy-exit,
.depth-label.copy-exit,
.type-rail.copy-exit,
.copy-panel.copy-exit {
  opacity: 0;
}

.title-stack.copy-exit-up,
.new-badge.copy-exit-up,
.depth-label.copy-exit-up,
.copy-panel.copy-exit-up {
  transform: translateY(-34px);
}

.type-rail.copy-exit-up {
  --switch-y: -34px;
}

.title-stack.copy-exit-down,
.new-badge.copy-exit-down,
.depth-label.copy-exit-down,
.copy-panel.copy-exit-down {
  transform: translateY(34px);
}

.type-rail.copy-exit-down {
  --switch-y: 34px;
}

.title-stack.copy-enter,
.new-badge.copy-enter,
.depth-label.copy-enter,
.type-rail.copy-enter,
.copy-panel.copy-enter {
  opacity: 0;
  transition: none;
}

.title-stack.copy-enter-up,
.new-badge.copy-enter-up,
.depth-label.copy-enter-up,
.copy-panel.copy-enter-up {
  transform: translateY(-34px);
}

.type-rail.copy-enter-up {
  --switch-y: -34px;
}

.title-stack.copy-enter-down,
.new-badge.copy-enter-down,
.depth-label.copy-enter-down,
.copy-panel.copy-enter-down {
  transform: translateY(34px);
}

.type-rail.copy-enter-down {
  --switch-y: 34px;
}

.title-stack {
  position: absolute;
  left: 6px;
  top: 16px;
  width: 570px;
  height: 126px;
  pointer-events: none;
}

.material-title {
  position: absolute;
  left: 0;
  top: 0;
  width: 570px;
  margin: 0;
  font-size: 62px;
  line-height: 0.94;
  font-weight: 600;
  letter-spacing: -1px;
  white-space: nowrap;
  overflow: visible;
  transition:
    opacity 210ms cubic-bezier(0.4, 0.04, 0.5, 1),
    transform 260ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

.title-ghost {
  z-index: 2;
  color: rgba(255, 255, 255, 1);
  text-shadow: 0 0 34px rgba(0, 0, 0, 0.86);
}

.title-front {
  z-index: 6;
  color: rgba(255, 255, 255, 0.5);
}

.viewer-shell {
  position: absolute;
  z-index: 4;
  right: -92px;
  top: -34px;
  width: 540px;
  height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.viewer-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 18%, transparent 0 24%, rgba(0, 0, 0, 0.12) 36%, rgba(0, 0, 0, 0.7) 78%),
    linear-gradient(118deg, transparent 0 36%, rgba(0, 0, 0, 0.74) 78%, rgba(0, 0, 0, 0.92) 100%);
  mix-blend-mode: multiply;
  opacity: 0.76;
}

#materialCanvas {
  display: block;
  position: relative;
  z-index: 1;
  width: 540px;
  height: 440px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    transform 260ms cubic-bezier(0.4, 0.04, 0.5, 1),
    opacity 210ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

#materialCanvas.stone-exit-up {
  opacity: 0;
  transform: translateY(-116px) scale(0.93);
}

#materialCanvas.stone-exit-down {
  opacity: 0;
  transform: translateY(116px) scale(0.93);
}

#materialCanvas.stone-enter-up {
  opacity: 0;
  transform: translateY(-116px) scale(0.93);
  transition: none;
}

#materialCanvas.stone-enter-down {
  opacity: 0;
  transform: translateY(116px) scale(0.93);
  transition: none;
}

.depth-label {
  position: absolute;
  z-index: 6;
  left: 10px;
  top: 83px;
  max-width: 372px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  line-height: 1.18;
  font-weight: 500;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
}

.depth-label.with-new {
  top: 112px;
}

.new-badge {
  position: absolute;
  z-index: 7;
  left: 10px;
  top: 82px;
  padding: 4px 11px 5px;
  border: 1px solid rgba(106, 191, 255, 0.8);
  background: rgba(106, 191, 255, 0.18);
  color: #9fe8ff;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  text-transform: uppercase;
}

.layer-mode {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 15px;
  line-height: 1.1;
  font-style: italic;
  font-weight: 500;
}

.type-rail {
  position: absolute;
  z-index: 7;
  right: 3px;
  top: 10px;
  width: 36px;
  height: auto;
  min-height: 92px;
  max-height: 268px;
  padding: 12px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #061925;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  writing-mode: vertical-rl;
  transform: translateY(calc(34px + var(--switch-y, 0px))) rotate(180deg);
  text-transform: capitalize;
}

.type-long {
  min-height: 152px;
}

.type-xl {
  min-height: 206px;
  width: 42px;
}

.type-bedrock {
  background: #74bfff;
  color: #071f33;
}

.type-crystal {
  background: #9fe8ff;
  color: #06212a;
}

.type-gem {
  background: #c9a8ff;
  color: #1d0f33;
}

.type-mineral {
  background: #8ff0c2;
  color: #062516;
}

.type-evaporite {
  background: #f3e68d;
  color: #332a05;
}

.type-deposit {
  background: #d7a16e;
  color: #2c1505;
}

.type-possible {
  background: #f1c45f;
  color: #261704;
}

.type-layer {
  background: #d7dde6;
  color: #111820;
}

.depth-bedrock .layer-mode {
  color: #74bfff;
}

.depth-crystal .layer-mode {
  color: #9fe8ff;
}

.depth-gem .layer-mode {
  color: #c9a8ff;
}

.depth-mineral .layer-mode {
  color: #8ff0c2;
}

.depth-evaporite .layer-mode {
  color: #f3e68d;
}

.depth-deposit .layer-mode {
  color: #d7a16e;
}

.depth-possible .layer-mode {
  color: #f1c45f;
}

.depth-layer .layer-mode {
  color: #d7dde6;
}

.copy-panel {
  position: absolute;
  z-index: 6;
  left: 10px;
  bottom: 42px;
  width: 382px;
  min-height: 168px;
  opacity: 1;
}

.sentence,
.where {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 17px;
  line-height: 1.42;
  font-weight: 400;
  text-wrap: balance;
}

.where {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
}

.layer-counter {
  position: absolute;
  z-index: 7;
  right: 3px;
  bottom: 40px;
  width: 34px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
  color: #ffffff;
  font-size: 0;
  line-height: 1;
  font-weight: 800;
}

.layer-counter .ticks {
  display: flex;
  width: 22px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: clamp(1px, calc(30px / var(--tick-count, 12)), 4px);
  opacity: 0.72;
  max-height: 160px;
}

.layer-counter .tick {
  width: 6px;
  height: 1px;
  background: rgba(255, 255, 255, 0.78);
}

.layer-counter .tick.selected {
  width: 21px;
  height: 2px;
  background: #ffffff;
}

.layer-peek {
  display: none;
}

.app-footer {
  position: absolute;
  z-index: 8;
  left: 24px;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.52);
  font-size: 15px;
  line-height: 1;
  font-style: italic;
  font-weight: 400;
}

.app-footer span {
  max-width: 250px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-footer .mode {
  display: none;
}

#sourceLabel {
  margin-left: auto;
  text-align: right;
}

.loading-screen,
.error-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000000;
}

.screen-logo {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
}

.loading-steps {
  position: absolute;
  left: 92px;
  top: 194px;
  width: 430px;
  display: flex;
  flex-direction: column;
  gap: 38px;
}

.loading-step {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 22px;
  align-items: center;
  opacity: 0.2;
  transition: opacity 250ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

.loading-step.previous {
  opacity: 0.5;
}

.loading-step.active {
  opacity: 1;
}

.loading-step h2 {
  margin: 0 0 5px;
  font-size: 25px;
  line-height: 1.05;
  font-weight: 800;
}

.loading-step p {
  margin: 0;
  max-width: 382px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 16px;
  line-height: 1.42;
  font-weight: 600;
}

.loader-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(106, 191, 255, 0.3);
  border-top-color: var(--blue);
  opacity: 0;
}

.loading-step.active .loader-ring {
  opacity: 1;
  animation: spin 900ms linear infinite;
}

.error-copy {
  position: absolute;
  left: 70px;
  right: 70px;
  top: 240px;
  text-align: center;
}

.error-copy h2 {
  margin: 0 0 8px;
  font-size: 31px;
  line-height: 1.05;
  font-weight: 800;
}

.error-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
}

.error-action {
  position: absolute;
  left: 165px;
  top: 350px;
  width: 280px;
  height: 82px;
  font-size: 28px;
}

.hidden {
  display: none;
}

.focusable {
  transition:
    transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
    opacity 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    border-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

.focusable:focus {
  border-color: #ffffff;
  transform: scale(0.965);
}

.header-action:focus,
.error-action:focus {
  border-width: 2px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.19), rgba(28, 30, 34, 0.96));
}

.material-stage:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .focusable,
  #materialCanvas,
  .copy-panel,
  .material-title,
  .loading-step {
    transition: none;
  }

  .loading-step.active .loader-ring {
    animation: none;
  }
}
