:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f7f8fa;
  color: #15171a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.viewer {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(141, 205, 161, 0.28), transparent 32%),
    linear-gradient(135deg, #fdfefe 0%, #dfe7e5 100%);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud div {
  display: grid;
  gap: 4px;
}

.hud span {
  color: #15171a;
  font-size: 24px;
  font-weight: 800;
}

.hud strong {
  font-size: 18px;
  color: #3f4a54;
}

.view-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud button {
  pointer-events: auto;
  border: 1px solid #cbd5df;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.panel {
  border-left: 1px solid #dde4eb;
  background: #ffffff;
  padding: 24px;
  overflow: auto;
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.brand p,
.notes p {
  color: #64707c;
  line-height: 1.45;
  margin: 8px 0 0;
}

.app-version {
  display: block;
  margin-top: 6px;
  color: #8a96a3;
  font-size: 12px;
}

.file-drop {
  display: grid;
  gap: 6px;
  margin: 24px 0;
  border: 1px dashed #9fb2c4;
  border-radius: 8px;
  padding: 18px;
  cursor: pointer;
  background: #f9fbfc;
}

.file-drop input {
  width: 100%;
}

.file-drop span {
  font-weight: 700;
}

.file-drop small {
  color: #697783;
}

.ticker-form {
  display: grid;
  gap: 8px;
  margin: -6px 0 24px;
  border: 1px solid #d7e0e8;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.ticker-form label {
  color: #3f4a54;
  font-size: 13px;
  font-weight: 800;
}

.ticker-form div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ticker-form input {
  min-width: 0;
  border: 1px solid #b9c7d4;
  border-radius: 6px;
  padding: 9px 10px;
  text-transform: uppercase;
}

.ticker-form button {
  border: 1px solid #2f7d4c;
  background: #2f7d4c;
  color: #ffffff;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
}

.ticker-form button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.ticker-form small {
  color: #697783;
  line-height: 1.35;
}

.download-button {
  width: 100%;
  border: 1px solid #1f4e78;
  background: #1f4e78;
  color: #ffffff;
  border-radius: 6px;
  padding: 10px 12px;
  margin: -8px 0 24px;
  cursor: pointer;
  font-weight: 700;
}

.download-button:hover {
  background: #173b5b;
}

.download-button.secondary {
  background: #ffffff;
  color: #1f4e78;
  margin-top: 8px;
}

.download-button.secondary:hover {
  background: #eef5fb;
}

.download-link {
  display: block;
  margin: -12px 0 8px;
  color: #1f4e78;
  font-weight: 700;
  text-decoration: none;
}

.download-link:hover {
  text-decoration: underline;
}

.download-status {
  min-height: 18px;
  margin: -2px 0 18px;
  color: #64707c;
  font-size: 13px;
}

.csv-output {
  width: 100%;
  min-height: 150px;
  margin: 8px 0 10px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 10px;
  resize: vertical;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.35;
}

.control-group {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.control-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #3f4a54;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.control-grid label {
  display: grid;
  gap: 8px;
  color: #3f4a54;
  font-size: 13px;
  font-weight: 700;
}

.toggle-control {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.toggle-control input {
  width: 16px;
  height: 16px;
}

.metrics {
  display: grid;
  gap: 8px;
}

.metric {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eef2f5;
  padding: 8px 0;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.metric span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  font-variant-numeric: tabular-nums;
}

.notes {
  margin-top: 24px;
  border-top: 1px solid #e8edf2;
  padding-top: 16px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .viewer {
    min-height: 58vh;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid #dde4eb;
  }
}
