:root {
  --seafoam: #b8d9d2;
  --seafoam-dark: #5a9f98;
  --deep: #102725;
  --ink: #18312f;
  --paper: #f5f8f6;
  --mist: #dfe9e4;
  --signal: #d6a84f;
  --danger: #b33a3a;
  --shadow: 0 24px 80px rgba(16, 39, 37, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(184, 217, 210, 0.34), transparent 30rem),
    linear-gradient(135deg, #0e2625 0%, #172f2b 42%, #edf3ef 42.2%, #f8faf8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

[v-cloak] {
  display: none;
}

.observer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 1rem;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: clamp(0.75rem, 2.4vw, 2rem);
  overflow: hidden;
}

.unity-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(184, 217, 210, 0.28);
  border-radius: 8px;
  background: #071312;
  box-shadow: var(--shadow);
}

#unity-container {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

#unity-canvas {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #071312;
  outline: none;
}

#unity-loading-bar {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  gap: 1rem;
  background: rgba(7, 19, 18, 0.86);
  color: var(--paper);
  letter-spacing: 0.12em;
  text-align: center;
}

.loader-mark {
  font-size: 0.78rem;
  font-weight: 800;
}

.loader-track {
  width: min(16rem, 58vw);
  height: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(245, 248, 246, 0.16);
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--seafoam), var(--signal));
}

#unity-warning {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 2;
  display: none;
  width: min(34rem, calc(100% - 2rem));
  transform: translateX(-50%);
  gap: 0.5rem;
}

.banner-error,
.banner-warning {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: white;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.banner-error {
  background: var(--danger);
}

.banner-warning {
  background: #9b761e;
}

.control-panel {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  align-content: start;
  gap: 1rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid rgba(16, 39, 37, 0.1);
  border-radius: 8px;
  background: rgba(245, 248, 246, 0.86);
  box-shadow: 0 18px 48px rgba(16, 39, 37, 0.16);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.4rem;
  color: var(--deep);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-sigil {
  width: 2.25rem;
  height: 2.25rem;
  border: 0.35rem solid var(--seafoam-dark);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 45%, var(--seafoam-dark) 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 45%, var(--seafoam-dark) 45% 55%, transparent 55%);
}

.dataset-form {
  display: grid;
  gap: 0.65rem;
}

.field-label {
  color: rgba(24, 49, 47, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 2.35rem 0 0.85rem;
  border: 1px solid rgba(16, 39, 37, 0.2);
  border-radius: 7px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%) right 1rem center / 0.42rem 0.42rem no-repeat,
    linear-gradient(135deg, var(--ink) 50%, transparent 50%) right 0.72rem center / 0.42rem 0.42rem no-repeat,
    white;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

select:focus-visible,
.upload-button:focus-visible,
.apply-button:focus-visible,
.clear-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(90, 159, 152, 0.35);
  outline-offset: 2px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border: 1px solid rgba(16, 39, 37, 0.16);
  border-radius: 7px;
  background: var(--deep);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 850;
}

.upload-button span:first-child {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 50%;
  background: var(--seafoam);
  color: var(--deep);
  line-height: 1;
}

.upload-button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secondary-upload {
  background: #355b57;
}

.apply-button {
  min-height: 2.45rem;
  border: 1px solid rgba(16, 39, 37, 0.16);
  border-radius: 7px;
  background: var(--seafoam-dark);
  color: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.apply-button:disabled {
  background: rgba(24, 49, 47, 0.18);
  color: rgba(24, 49, 47, 0.45);
  cursor: not-allowed;
}

.clear-button {
  min-height: 2.45rem;
  border: 1px solid rgba(179, 58, 58, 0.28);
  border-radius: 7px;
  background: white;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.clear-button:disabled {
  border-color: rgba(16, 39, 37, 0.12);
  color: rgba(24, 49, 47, 0.38);
  cursor: not-allowed;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 2.45rem;
  padding: 0 0.8rem;
  border-left: 0.22rem solid var(--signal);
  background: rgba(223, 233, 228, 0.74);
  color: rgba(24, 49, 47, 0.76);
  font-size: 0.75rem;
  font-weight: 800;
}

.meta-strip strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.icon-button {
  align-self: end;
  justify-self: start;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid rgba(16, 39, 37, 0.16);
  border-radius: 7px;
  background: white;
  cursor: pointer;
}

.icon-button span {
  width: 1.15rem;
  height: 1.15rem;
  border: 0.14rem solid var(--ink);
  background:
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 0.42rem 0.14rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) left 0 top 0 / 0.14rem 0.42rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / 0.42rem 0.14rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 top 0 / 0.14rem 0.42rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / 0.42rem 0.14rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) left 0 bottom 0 / 0.14rem 0.42rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / 0.42rem 0.14rem no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 bottom 0 / 0.14rem 0.42rem no-repeat;
}

@media (max-width: 960px) {
  .observer-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .control-panel {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    grid-template-rows: auto;
    align-items: center;
  }

  .dataset-form {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: end;
  }

  .field-label {
    grid-column: 1 / -1;
  }

  .icon-button {
    align-self: center;
  }

  .clear-button {
    align-self: end;
  }
}

@media (max-width: 640px) {
  body {
    background: linear-gradient(180deg, #102725 0 18rem, #f8faf8 18rem 100%);
  }

  .observer-shell {
    height: 100dvh;
    min-height: 0;
    padding: 0.6rem;
  }

  .unity-stage {
    min-height: 0;
  }

  .control-panel {
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .brand-lockup,
  .clear-button,
  .meta-strip {
    grid-column: 1 / -1;
  }

  .dataset-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-button {
    width: 100%;
  }
}

@media (max-height: 620px) {
  .observer-shell {
    gap: 0.6rem;
    padding: 0.6rem;
  }

  .control-panel {
    gap: 0.55rem;
    padding: 0.65rem;
  }

  .brand-lockup {
    min-height: 1.9rem;
  }

  .brand-sigil {
    width: 1.9rem;
    height: 1.9rem;
    border-width: 0.3rem;
  }

  select,
  .upload-button,
  .icon-button {
    min-height: 2.25rem;
  }

  .icon-button {
    width: 2.25rem;
    height: 2.25rem;
  }

  .meta-strip {
    min-height: 2.1rem;
  }
}
