:root {
  color-scheme: light;
  --app-header-height: 60px;
  --bg: #0f0f0f;
  --bg-soft: #171717;
  --panel: #fffaf2;
  --line: #ff2b2b;
  --line-soft: rgba(255, 43, 43, 0.28);
  --text: #231f20;
  --muted: #6b5e5e;
  --primary: #d71920;
  --accent: #ff8f00;
  --danger: #b42318;
  --canvas: #171111;
  --heading-font: "M PLUS Rounded 1c", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 48% -10%, rgba(255, 198, 65, 0.28), transparent 34%),
    radial-gradient(circle at 96% 16%, rgba(79, 190, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #060606 0%, #111 42%, #050505 100%);
  color: #f5f5f5;
  font-family: "Noto Sans JP", sans-serif;
}

html,
body {
  height: 100%;
  min-height: 100dvh;
}

body {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-header,
.mossan-product-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  background: #1b1012;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  backdrop-filter: blur(10px);
}

.header-inner,
.mossan-product-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  height: var(--app-header-height);
  margin: 0 auto;
  padding: 0 28px;
}

.logo-area,
.mossan-product-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f5f5f5;
  text-decoration: none;
}

.logo-text.attendance-brand,
.mossan-product-header__logo-text {
  font-family: "Noto Sans JP", sans-serif;
  letter-spacing: 0;
}

.logo-text.attendance-brand.brand-v1,
.mossan-product-header__logo-text {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 28px;
  font-weight: 900;
  padding-left: 16px;
}

.logo-text.attendance-brand.brand-v1 .brand-main,
.mossan-product-header__logo-main {
  letter-spacing: 0.05em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 10px rgba(255, 66, 66, 0.24);
}

.logo-text.attendance-brand.brand-v1 .brand-plus,
.mossan-product-header__logo-plus {
  color: var(--accent);
  font-size: 1.2em;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 143, 0, 0.32);
}

.top-nav,
.mossan-product-header__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.header-menu-toggle {
  display: none;
  width: 42px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px;
}

.header-menu-toggle span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #fff8ee;
}

.header-menu-toggle span + span {
  margin-top: 6px;
}

.top-nav a,
.top-nav span,
.top-nav button,
.mossan-product-header__nav a,
.mossan-product-header__nav span,
.mossan-product-header__nav button {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 0 2px;
  background: transparent;
  color: #d1d5db;
  font-family: var(--heading-font);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
}

.top-nav form,
.mossan-product-header__nav form {
  display: flex;
  align-items: center;
  margin: 0;
}

.top-nav button,
.mossan-product-header__nav button {
  cursor: pointer;
}

.top-nav a:hover,
.top-nav button:hover,
.mossan-product-header__nav a:hover,
.mossan-product-header__nav button:hover {
  border-bottom-color: transparent;
  color: #fff;
}

@media (max-width: 900px) {
  .header-inner,
  .mossan-product-header__inner {
    padding: 0 16px;
  }

  .logo-text.attendance-brand.brand-v1,
  .mossan-product-header__logo-text {
    padding-left: 0;
    font-size: 26px;
  }

  .header-menu-toggle {
    display: grid;
    align-content: center;
    flex: 0 0 auto;
  }

  .top-nav,
  .mossan-product-header__nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 12px;
    display: none;
    width: min(280px, calc(100vw - 24px));
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(27, 16, 18, 0.98);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.38);
    padding: 8px;
  }

  .top-nav.is-open,
  .mossan-product-header__nav.is-open {
    display: flex;
  }

  .top-nav a,
  .top-nav span,
  .top-nav button,
  .mossan-product-header__nav a,
  .mossan-product-header__nav span,
  .mossan-product-header__nav button {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 10px 12px;
    text-align: left;
  }

  .top-nav a:hover,
  .top-nav button:hover,
  .mossan-product-header__nav a:hover,
  .mossan-product-header__nav button:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  font-family: var(--heading-font);
}

h2 {
  font-size: 16px;
}

.header-copy {
  max-width: 560px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.app-shell {
  position: fixed;
  top: var(--app-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 12px;
  height: auto;
  min-height: 0;
  margin-top: 0;
  padding: 12px;
}

.viewer-shell {
  position: fixed;
  top: var(--app-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 12px;
  height: auto;
  min-height: 0;
  margin-top: 0;
  padding: 12px;
}

.panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.panel {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.controls-panel,
.viewer-panel {
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.96) 0%, rgba(19, 19, 19, 0.96) 100%);
  color: #f5f5f5;
}

.controls-panel .panel-heading h2,
.viewer-panel .panel-heading h2 {
  color: #ead7b3;
}

.controls-panel .panel-heading span,
.viewer-panel .panel-heading span {
  color: #d7dde6;
}

.controls-panel .settings-card,
.viewer-panel .photometry-item,
.controls-panel .photometry-item,
.controls-panel .shape-edit-panel {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
}

.viewer-panel .photometry-item.is-active,
.controls-panel .project-active-controls.is-active {
  border-color: #ff8f00;
  box-shadow: 0 0 0 1px rgba(255, 143, 0, 0.38);
}

.viewer-panel .photometry-item.is-editing {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.38);
}

.controls-panel .settings-card h3,
.controls-panel .settings-card-label,
.controls-panel .settings-card-toggle,
.controls-panel label,
.viewer-panel label,
.viewer-panel .photometry-title,
.viewer-panel .photometry-controls label {
  color: #f5f5f5;
}

.controls-panel input,
.controls-panel select,
.viewer-panel input:not([type="color"]),
.viewer-panel select {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(13, 17, 22, 0.72);
  color: #f5f5f5;
}

.controls-panel .card-toggle-mark,
.viewer-panel .icon-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff0f3;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
}

.settings-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.54);
}

.settings-card h3 {
  margin: 0 0 10px;
  color: #4a1b1b;
  font-size: 14px;
}

.settings-card.is-hidden,
.project-active-controls.is-hidden {
  display: none;
}

.settings-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.collapsible-card.is-collapsed .settings-card-header {
  margin-bottom: 0;
}

.settings-card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 28px;
  margin: 0 0 10px;
  border: 0;
  background: transparent;
  color: #4a1b1b;
  font-size: 14px;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.settings-card-header .settings-card-toggle {
  margin-bottom: 0;
}

.settings-card-label {
  color: #4a1b1b;
  font-size: 14px;
  font-weight: 800;
}

.card-inline-action {
  min-height: 28px;
  font-size: 12px;
  padding: 3px 10px;
}

.card-toggle-mark {
  display: grid;
  place-items: center;
  width: 24px;
  min-height: 24px;
  height: 24px;
  border: 1px solid rgba(120, 30, 30, 0.2);
  border-radius: 6px;
  background: #fff;
  color: #4a1b1b;
  font-size: 14px;
  font-weight: 800;
  padding: 0;
}

.collapsible-card.is-collapsed .settings-card-body {
  display: none;
}

.collapsible-card.is-collapsed .settings-card-toggle {
  margin-bottom: 0;
}

.settings-card > :last-child {
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: #3d2b2b;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(120, 30, 30, 0.25);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--text);
}

input[type="range"] {
  appearance: none;
  min-height: 18px;
  padding: 0;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d6efd, #e5e7eb);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border: 0;
  border-radius: 50%;
  background: #0d6efd;
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0d6efd, #e5e7eb);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 50%;
  background: #0d6efd;
  cursor: pointer;
}

.number-value {
  min-height: 30px;
  font-size: 13px;
  text-align: right;
}

.parameter-field {
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}

.parameter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 5px;
}

output {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.project-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.photometry-title .project-action-row {
  margin-top: 0;
}

.project-action-row button {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
  white-space: nowrap;
}

.project-action-row button:hover:not(:disabled) {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.12);
}

.photometry-action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.photometry-action-row button {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
  white-space: nowrap;
}

.photometry-action-row button:hover:not(:disabled) {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.12);
}

button {
  min-height: 34px;
  border: 1px solid rgba(177, 43, 75, 0.55);
  border-radius: 10px;
  background: rgba(177, 43, 75, 0.18);
  color: #fff0f3;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.workspace-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  width: min(190px, calc(100% - 24px));
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(20, 18, 18, 0.9);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.workspace-actions-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  color: #fff8ee;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.workspace-actions-title:active {
  cursor: grabbing;
}

.workspace-actions-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.workspace-actions-buttons button {
  min-height: 32px;
  border-color: #922;
  background: #fff;
  color: #4a1b1b;
  font-size: 12px;
  white-space: nowrap;
  padding: 4px 6px;
}

.workspace-actions-buttons button.is-active {
  background: var(--accent);
  border-color: #b76500;
  color: #211400;
}

.optics-actions {
  position: absolute;
  right: 214px;
  bottom: 12px;
  z-index: 8;
  width: min(330px, calc(100% - 24px));
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(20, 18, 18, 0.9);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.optics-actions-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  color: #fff8ee;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.optics-actions-title:active {
  cursor: grabbing;
}

.optics-actions-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.optics-actions-buttons button {
  min-height: 32px;
  border-color: #922;
  background: #fff;
  color: #4a1b1b;
  font-size: 12px;
  white-space: nowrap;
  padding: 4px 6px;
}

.optics-actions-buttons button.is-active {
  background: var(--accent);
  border-color: #b76500;
  color: #211400;
}

.floating-results {
  position: absolute;
  inset: 10px 10px 54px 10px;
  z-index: 5;
  pointer-events: none;
}

.floating-result-launcher {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 7;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(23, 17, 17, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
  padding: 8px;
  pointer-events: auto;
}

.floating-result-launcher-title {
  display: flex;
  align-items: center;
  min-height: 24px;
  color: #fff8ee;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.floating-result-launcher-title:active {
  cursor: grabbing;
}

.floating-result-launcher-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.floating-result-launcher-buttons button {
  min-height: 28px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 250, 242, 0.94);
  color: #241515;
  font-size: 11px;
  padding: 4px 8px;
}

.floating-result-launcher-buttons button.is-open {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 248, 238, 0.72);
  box-shadow: none;
}

.floating-result-launcher-buttons button.is-hidden {
  display: none;
}

.floating-result-window {
  position: absolute;
  z-index: 6;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 320px;
  height: 198px;
  min-width: 220px;
  min-height: 148px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  gap: 6px;
  border: 1px solid rgba(120, 30, 30, 0.24);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  padding: 8px;
  pointer-events: auto;
  resize: both;
}

.floating-result-window[data-result-window-panel="polar"] {
  height: 310px;
}

.floating-result-window.target-window {
  width: min(620px, calc(100% - 16px));
  height: min(430px, calc(100% - 16px));
}

.floating-result-window.is-hidden {
  display: none;
}

.floating-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  cursor: move;
  font-size: 12px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
}

.floating-card-heading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  background: rgba(120, 30, 30, 0.14);
  color: #7a1d1d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 2px 7px;
  white-space: nowrap;
}

.workspace-actions .card-kicker {
  background: rgba(255, 214, 102, 0.2);
  color: #ffd666;
}

.optics-actions .card-kicker {
  background: rgba(255, 214, 102, 0.2);
  color: #ffd666;
}

.floating-result-launcher .card-kicker {
  background: rgba(125, 211, 252, 0.18);
  color: #7dd3fc;
}

.axis-nav .card-kicker {
  background: rgba(255, 214, 102, 0.2);
  color: #ffd666;
}

.floating-result-title button {
  display: grid;
  place-items: center;
  width: 26px;
  min-height: 24px;
  border-color: rgba(120, 30, 30, 0.2);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  padding: 0;
}

.floating-result-window canvas {
  display: block;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin-bottom: 0;
}

.secondary-action {
  border-color: #94a3b8;
  background: #fff;
  color: #334155;
}

.workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.scene-canvas-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 360px;
  overflow: hidden;
}

.viewer-stage {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

#photometryViewer {
  box-sizing: border-box;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: radial-gradient(circle at 50% 16%, #2a1a17 0%, var(--canvas) 55%);
}

.axis-nav {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  gap: 7px;
  width: min(200px, calc(100% - 24px));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(23, 17, 17, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: 8px;
  pointer-events: auto;
}

.axis-nav-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 24px;
  color: #fff8ee;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.axis-nav-label:active {
  cursor: grabbing;
}

.axis-nav-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
}

.axis-nav-actions button {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid #922;
  border-radius: 8px;
  background: #fff;
  color: #4a1b1b;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  padding: 0 8px;
}

.axis-nav-actions button:hover {
  border-color: #ff8f00;
  background: #fff;
}

.axis-nav-actions button.is-active {
  background: var(--accent);
  border-color: #b76500;
  color: #211400;
}

.axis-nav-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.axis-nav-actions button.wide {
  grid-column: 1 / -1;
}

.axis-nav-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.axis-nav-buttons button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  background: rgba(255, 250, 242, 0.94);
  color: #241515;
  font-size: 11px;
  font-weight: 800;
  padding: 0;
}

.axis-nav-buttons button:hover {
  border-color: #ff8f00;
  background: #fff;
}

#photometryViewer.is-pan-mode {
  cursor: grab;
}

#photometryViewer.is-panning {
  cursor: grabbing;
}

.photometry-table-card {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 4;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(520px, calc(100% - 36px));
  height: min(320px, calc(100% - 36px));
  min-width: 320px;
  min-height: 220px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(18, 14, 14, 0.94);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  color: #fff8ee;
  padding: 10px;
  pointer-events: auto;
}

.photometry-table-card.is-hidden {
  display: none;
}

.photometry-table-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.photometry-table-card-heading:active {
  cursor: grabbing;
}

.photometry-table-card .card-kicker {
  background: rgba(125, 211, 252, 0.18);
  color: #7dd3fc;
}

.photometry-table-card .icon-button {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
}

.photometry-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-self: start;
  max-width: 100%;
  overflow: visible;
  margin-top: 6px;
}

.photometry-table-toolbar button {
  flex: 0 1 auto;
  min-height: 28px;
  border: 1px solid #922;
  border-radius: 7px;
  background: #fff;
  color: #4a1b1b;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px;
}

.photometry-table-toolbar button.is-active {
  border-color: #b76500;
  background: var(--accent);
  color: #211400;
}

.photometry-table-toolbar button.danger {
  border-color: rgba(177, 43, 75, 0.8);
  background: rgba(177, 43, 75, 0.18);
  color: #fff0f3;
}

.photometry-table-toolbar button.is-hidden {
  display: none;
}

.photometry-table-toolbar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.photometry-table-meta {
  margin: 4px 0 8px;
  color: rgba(255, 248, 238, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.photometry-table-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 2px solid rgba(255, 248, 238, 0.72);
  border-radius: 6px;
  background: rgba(7, 9, 12, 0.82);
  box-shadow: inset 0 0 0 1px rgba(120, 30, 30, 0.5);
}

.photometry-value-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.photometry-value-table th,
.photometry-value-table td {
  box-sizing: border-box;
  border: 1px solid rgba(90, 74, 74, 0.58);
  padding: 0;
}

.photometry-value-table td {
  width: 70px;
  min-width: 70px;
  height: 28px;
}

.photometry-value-table th {
  position: sticky;
  z-index: 1;
  min-width: 54px;
  width: 54px;
  height: 28px;
  background: rgba(37, 29, 29, 0.98);
  color: #ffd6a0;
  font-weight: 900;
  text-align: center;
}

.photometry-value-table thead th {
  top: 0;
}

.photometry-value-table tbody th {
  left: 0;
}

.photometry-value-table thead th:first-child {
  left: 0;
  z-index: 2;
}

.photometry-value-table input {
  appearance: textfield;
  box-sizing: border-box;
  width: 70px;
  min-width: 70px;
  height: 28px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 250, 242, 0.96);
  color: #1f1414;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  padding: 3px 6px;
}

.photometry-value-table input::-webkit-outer-spin-button,
.photometry-value-table input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.photometry-value-table input:focus {
  outline: 2px solid #ff8f00;
  outline-offset: -2px;
}

.photometry-value-table td.is-paste-cell {
  box-sizing: border-box;
  width: 70px;
  min-width: 70px;
  height: 28px;
  background: rgba(255, 250, 242, 0.96);
  color: #1f1414;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  padding: 0 6px;
  cursor: cell;
}

.photometry-value-table td.is-paste-cell:focus {
  outline: 2px solid #ff8f00;
  outline-offset: -2px;
}

.photometry-value-table td.is-edit-target input {
  background: #ffe08a;
  color: #1f1400;
  outline: 2px solid #ff8f00;
  outline-offset: -2px;
}

.photometry-value-table td.is-edit-target.is-paste-cell {
  background: #ffe08a;
  color: #1f1400;
  box-shadow: inset 0 0 0 2px #ff8f00;
}

.slider-reset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.slider-reset-button,
.slider-reset-row button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-height: 28px;
  border-color: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 38px;
  margin-bottom: 12px;
  font-size: 13px;
  cursor: pointer;
}

.project-card-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.project-switch-card {
  width: 100%;
  min-width: 0;
  border-color: rgba(255, 255, 255, 0.1);
  text-align: left;
}

.project-switch-card:hover {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.085);
}

.demo-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 143, 0, 0.28);
  border-radius: 8px;
  background: rgba(255, 143, 0, 0.08);
  padding: 12px;
}

.demo-panel h3 {
  margin: 0;
  color: #ead7b3;
  font-size: 15px;
}

.demo-panel p {
  margin: 0;
  color: #d7dde6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
}

.demo-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.viewer-shell.is-demo-mode .file-picker,
.viewer-shell.is-demo-mode .photometry-list {
  display: none;
}

.app-shell.is-demo-mode .file-picker,
.app-shell.is-demo-mode .project-card-list,
.app-shell.is-demo-mode .project-active-controls,
.app-shell.is-demo-mode .sketch-editor-panel,
.app-shell.is-demo-mode .workspace-actions,
.app-shell.is-demo-mode .optics-actions,
.app-shell.is-demo-mode .floating-result-launcher {
  display: none;
}

.app-shell.is-demo-mode .floating-result-window[data-result-window-panel="polar"] {
  width: min(430px, calc(100% - 16px));
  height: min(430px, calc(100% - 16px));
}

.app-shell.is-demo-mode .floating-result-window[data-result-window-panel="polar"] .matching-summary {
  display: none;
}

.app-shell.is-demo-mode .floating-result-window[data-result-window-panel="polar"] #polarCanvas {
  height: 100%;
}

.shape-edit-panel {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(120, 30, 30, 0.16);
  border-radius: 6px;
  background: #fff;
  padding: 9px;
  margin-bottom: 12px;
}

.shape-edit-advanced {
  display: grid;
  gap: 5px;
}

.shape-edit-advanced.is-hidden {
  display: none;
}

.shape-edit-panel button {
  min-height: 34px;
  border-color: rgba(120, 30, 30, 0.22);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.shape-edit-panel button.is-active {
  border-color: rgba(177, 43, 75, 0.55);
  background: rgba(177, 43, 75, 0.18);
  color: #fff0f3;
}

.shape-edit-panel button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shape-edit-panel label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 0;
}

.shape-edit-panel label span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}

.shape-edit-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.shape-edit-panel input[type="range"] {
  width: 100%;
}

.shape-edit-panel select {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(120, 30, 30, 0.22);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 7px;
}

#editTargetLabel {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 143, 0, 0.16), transparent 34%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 120, 120, 0.32);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.96);
  color: #fff0f3;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  padding: 14px;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-heading .icon-button {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
}

.add-methods {
  display: grid;
  gap: 8px;
}

.add-methods.is-hidden {
  display: none;
}

.add-methods button {
  display: grid;
  gap: 3px;
  min-height: 62px;
  border-color: rgba(255, 120, 120, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #fff8ee;
  text-align: left;
  padding: 10px 12px;
}

.add-methods span {
  color: rgba(255, 240, 243, 0.68);
  font-size: 12px;
  font-weight: 500;
}

.sample-form {
  display: grid;
  gap: 10px;
}

.sample-form.is-hidden {
  display: none;
}

.sample-form label {
  display: grid;
  gap: 5px;
  color: #fff8ee;
  font-size: 12px;
  font-weight: 700;
}

.sample-form input,
.sample-form select,
.sample-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 120, 120, 0.3);
  border-radius: 6px;
  background: rgba(8, 8, 8, 0.9);
  color: #f5f5f5;
  padding: 7px 9px;
}

.sample-form input,
.sample-form select {
  min-height: 36px;
}

.sample-form textarea {
  min-height: 180px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.direct-input-guide {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 210, 74, 0.2);
  border-radius: 8px;
  background: rgba(255, 210, 74, 0.1);
  color: #fff4d1;
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
}

.direct-input-guide span {
  color: rgba(255, 248, 238, 0.7);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.modal-actions-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-actions button {
  min-height: 38px;
}

.modal-actions .secondary-action,
.modal-actions button:not(.primary-action) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
}

.modal-actions .primary-action {
  border-color: rgba(177, 43, 75, 0.55);
  background: rgba(177, 43, 75, 0.18);
  color: #fff0f3;
}

.photometry-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.photometry-item {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(120, 30, 30, 0.42);
  border-radius: 6px;
  padding: 9px;
  background: #fff;
}

.photometry-title {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.photometry-title-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.photometry-name-block {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.photometry-title input[type="color"] {
  width: 38px;
  min-height: 30px;
  border: 1px solid rgba(120, 30, 30, 0.2);
  border-radius: 6px;
  background: #fff;
  padding: 2px;
}

.viewer-panel .photometry-title .icon-button,
.controls-panel .photometry-title .icon-button {
  border-color: rgba(120, 30, 30, 0.18);
  background: rgba(255, 250, 242, 0.96);
  color: #4a1b1b;
}

.viewer-panel .photometry-title .icon-button:hover,
.controls-panel .photometry-title .icon-button:hover {
  border-color: #ff8f00;
  background: #fff;
}

.controls-panel .project-active-controls {
  margin-top: 12px;
}

.controls-panel .project-name-input {
  width: 100%;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #fff8ee;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  padding: 0;
}

.controls-panel .project-name-input:focus {
  outline: 2px solid rgba(255, 143, 0, 0.42);
  outline-offset: 3px;
  border-radius: 4px;
}

.photometry-name-label {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  min-height: 30px;
  color: #fff8ee;
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photometry-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.photometry-details {
  display: grid;
  gap: 8px;
}

.photometry-item.is-collapsed .photometry-details {
  display: none;
}

.photometry-controls label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 0;
}

.photometry-controls input[type="range"] {
  width: 100%;
}

.photometry-editor-panel {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  gap: 10px;
  width: min(300px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  overflow: auto;
  border: 1px solid rgba(255, 143, 0, 0.26);
  border-radius: 8px;
  background: rgba(18, 14, 14, 0.94);
  color: #f5f5f5;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  padding: 10px;
  pointer-events: auto;
}

.photometry-editor-panel.is-hidden {
  display: none;
}

.photometry-editor-panel.is-editing {
  border-color: rgba(125, 211, 252, 0.38);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.18);
}

.photometry-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.photometry-editor-heading:active {
  cursor: grabbing;
}

.photometry-editor-heading h3 {
  margin: 3px 0 0;
  color: #fff8ee;
  font-size: 15px;
  line-height: 1.3;
}

.editor-status {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 143, 0, 0.42);
  border-radius: 999px;
  background: rgba(255, 143, 0, 0.16);
  color: #ffd08a;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 8px;
}

.photometry-editor-panel.is-editing .editor-status {
  border-color: rgba(125, 211, 252, 0.46);
  background: rgba(125, 211, 252, 0.16);
  color: #bdeaff;
}

.editor-control-group {
  display: grid;
  gap: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 9px;
}

.editor-control-group h4 {
  margin: 0;
  color: #ead7b3;
  font-size: 12px;
}

.editor-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sketch-editor-panel .editor-group-heading {
  display: grid;
  grid-template-columns: var(--setting-label-width) minmax(0, 1fr) auto;
}

.sketch-editor-panel .editor-group-heading h4 {
  white-space: nowrap;
}

.sketch-editor-panel .source-position-heading {
  grid-template-columns: var(--setting-label-width) minmax(0, 1fr) minmax(0, 1fr);
}

.sketch-editor-panel .source-position-heading .compact-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.sketch-editor-panel .source-position-heading .source-x-field {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sketch-editor-panel .source-position-heading .source-x-field span {
  transform: translateX(-14px);
}

.sketch-editor-panel .source-position-heading input {
  min-width: 0;
  padding-inline: 5px;
}

.model-edit-guide {
  flex: 0 1 auto;
  border: 1px solid rgba(125, 211, 252, 0.38);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  color: #bdeaff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  padding: 3px 7px;
  text-align: right;
  animation: model-edit-guide-pulse 1.6s ease-in-out infinite;
}

@keyframes model-edit-guide-pulse {
  0%,
  100% {
    opacity: 0.72;
    box-shadow: 0 0 0 rgba(125, 211, 252, 0);
  }

  50% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(125, 211, 252, 0.28);
  }
}

.editor-control-group label {
  display: grid;
  gap: 5px;
  margin-bottom: 0;
  color: #f5f5f5;
  font-size: 11px;
  font-weight: 800;
}

.editor-control-group input[type="text"] {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.72);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.model-operation-row {
  display: grid;
  grid-template-columns: 30px 36px 30px 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.model-operation-row .icon-button {
  width: 30px;
  min-height: 30px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
}

.model-operation-row .icon-button:hover:not(:disabled) {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.12);
}

.model-operation-row .icon-button svg {
  width: 18px;
  height: 18px;
}

.editor-control-group .editor-color-control {
  position: relative;
  display: block;
  width: 36px;
  min-width: 0;
  height: 30px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.editor-control-group .editor-color-control span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8ee;
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.editor-control-group .editor-color-control input[type="color"] {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  opacity: 0.82;
  padding: 0;
  cursor: pointer;
}

.model-operation-row > button:not(.icon-button) {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 6px;
  min-width: 0;
  white-space: nowrap;
}

.model-operation-row > button:not(.icon-button):hover:not(:disabled) {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.12);
}

.model-operation-row > button:not(.icon-button).is-active {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 248, 238, 0.72);
  box-shadow: none;
}

.editor-control-group label.editor-range-row {
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.editor-control-group input[type="color"] {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.72);
  padding: 2px;
}

.editor-control-group input[type="range"] {
  width: 100%;
}

.editor-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.editor-button-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.editor-button-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-project-group {
  border-top: 0;
  padding-top: 0;
}

.sketch-editor-panel {
  --setting-label-width: 58px;
  right: 18px;
  left: auto;
  bottom: 18px;
  width: min(300px, calc(100% - 36px));
  max-height: calc(100% - 36px);
}

.sketch-editor-panel .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sketch-editor-panel label {
  margin: 0;
}

.sketch-editor-panel input:not([type="color"]),
.sketch-editor-panel select {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.72);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 7px;
}

.sketch-editor-panel input:not([type="range"]) {
  text-align: left;
}

.sketch-editor-panel input[type="range"] {
  min-height: 18px;
  padding: 0;
}

.sketch-editor-panel .parameter-field {
  display: grid;
  gap: 5px;
}

.sketch-editor-panel .parameter-row {
  display: grid;
  grid-template-columns: var(--setting-label-width) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.sketch-editor-panel .parameter-row > span:first-child {
  white-space: nowrap;
}

.sketch-editor-panel .number-value {
  text-align: left;
  padding-inline: 5px;
}

.sketch-editor-panel .slider-reset-row {
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 4px;
}

.sketch-editor-panel .editor-group-heading button {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 9px;
}

.editor-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sketch-editor-panel .editor-heading-actions .help-icon-button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  color: #bdeaff;
}

.optics-help-panel {
  max-width: 520px;
}

.optics-help-animation {
  position: relative;
  height: 170px;
  overflow: hidden;
  border: 1px solid rgba(255, 143, 0, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.08), transparent 58%),
    rgba(15, 18, 24, 0.96);
}

.help-ray {
  position: absolute;
  left: 26px;
  width: 210px;
  height: 3px;
  border-radius: 999px;
  background: #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.75);
  transform-origin: left center;
  animation: help-ray-bend 2.2s ease-in-out infinite;
}

.help-ray-a {
  top: 62px;
  transform: rotate(8deg);
}

.help-ray-b {
  top: 108px;
  transform: rotate(-8deg);
  animation-delay: 0.18s;
}

.help-optic {
  position: absolute;
  left: 230px;
  top: 34px;
  display: grid;
  place-items: center;
  width: 72px;
  height: 102px;
  border: 2px solid rgba(125, 211, 252, 0.86);
  border-radius: 50%;
  background: rgba(125, 211, 252, 0.18);
  color: #e0f7ff;
  font-size: 12px;
  font-weight: 900;
}

.modal-backdrop[data-help-type="reflector"] .help-optic {
  width: 108px;
  height: 18px;
  top: 78px;
  border-color: rgba(229, 231, 235, 0.9);
  border-radius: 6px;
  background: rgba(229, 231, 235, 0.18);
  transform: rotate(-18deg);
}

.help-result {
  position: absolute;
  right: 38px;
  top: 38px;
  width: 86px;
  height: 94px;
  border-radius: 50%;
  border: 1px dashed rgba(250, 204, 21, 0.62);
  animation: help-result-pulse 2.2s ease-in-out infinite;
}

.optics-help-copy h3 {
  margin: 14px 0 6px;
  color: #4a1b1b;
  font-size: 16px;
}

.optics-help-copy p {
  margin: 0;
  color: #3d2b2b;
  line-height: 1.7;
}

@keyframes help-ray-bend {
  0%,
  100% {
    width: 190px;
    opacity: 0.72;
  }

  50% {
    width: 280px;
    opacity: 1;
  }
}

@keyframes help-result-pulse {
  0%,
  100% {
    transform: scale(0.84);
    opacity: 0.36;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.84;
  }
}

.editor-button-grid button,
.editor-control-group > button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8ee;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
}

.editor-button-grid button:hover:not(:disabled),
.editor-control-group > button:hover:not(:disabled) {
  border-color: #ff8f00;
  background: rgba(255, 255, 255, 0.12);
}

.editor-button-grid button.is-active {
  border-color: rgba(125, 211, 252, 0.46);
  background: rgba(125, 211, 252, 0.16);
  color: #bdeaff;
}

.photometry-editor-panel button:disabled,
.photometry-editor-panel input:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border-color: #94a3b8;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.photometry-title .icon-button {
  border-color: rgba(120, 30, 30, 0.2);
  color: #4a1b1b;
}

canvas {
  display: block;
  width: 100%;
  border-radius: 6px;
}

#sceneCanvas {
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--canvas);
  touch-action: none;
}

#sceneCanvas.is-pan-mode {
  cursor: grab;
}

#sceneCanvas.is-panning {
  cursor: grabbing;
}

#distributionCanvas,
#curveCanvas,
#polarCanvas {
  margin-bottom: 8px;
  border: 1px solid #dce3eb;
  background: #f8fafc;
}

.floating-result-window #distributionCanvas,
.floating-result-window #curveCanvas,
.floating-result-window #polarCanvas,
.floating-result-window #targetDistributionCanvas {
  height: 100%;
  margin-bottom: 0;
}

#distributionCanvas,
#curveCanvas {
  height: 147px;
}

#polarCanvas {
  height: 300px;
}

.matching-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  border-top: 1px solid rgba(120, 30, 30, 0.16);
  color: #4a1b1b;
  font-size: 12px;
  padding-top: 6px;
}

.matching-summary.is-hidden {
  display: none;
}

.matching-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  color: #4a1b1b;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.matching-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  margin: -1px;
  padding: 0;
  white-space: nowrap;
}

.matching-toggle-text {
  min-width: 0;
  line-height: 28px;
}

.matching-switch {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #b7bdc3;
  box-shadow: inset 0 0 0 1px rgba(35, 31, 32, 0.08);
  transition: background 0.18s ease;
}

.matching-switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease;
}

.matching-toggle input:checked + .matching-switch {
  background: #5fc97d;
}

.matching-toggle input:checked + .matching-switch::after {
  transform: translateX(22px);
}

.matching-toggle:focus-within .matching-switch {
  box-shadow: 0 0 0 2px rgba(95, 201, 125, 0.28);
}

.matching-score {
  display: grid;
  gap: 2px;
}

.matching-score strong {
  color: #d71920;
  font-size: 17px;
  line-height: 1.1;
}

.target-editor {
  display: grid;
  grid-template-columns: minmax(240px, 1.05fr) minmax(210px, 0.95fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.target-editor-stage,
.target-editor-controls {
  min-width: 0;
  min-height: 0;
}

.target-editor-stage {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 6px;
}

#targetDistributionCanvas {
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  justify-self: center;
  border: 1px solid #dce3eb;
  background: #f8fafc;
  touch-action: none;
}

.target-editor-help {
  color: #6b5e5e;
  font-size: 11px;
  line-height: 1.4;
}

.target-editor-controls {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.target-editor-controls label {
  margin: 0;
}

.target-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(120, 30, 30, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.54);
  padding: 6px;
}

.target-range-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.target-range-tool button {
  min-height: 32px;
  border-radius: 7px;
  background: rgba(177, 43, 75, 0.12);
  color: #4a1b1b;
  font-size: 12px;
  white-space: nowrap;
  padding: 4px 9px;
}

.target-value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
}

.target-value-row {
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #4a1b1b;
  font-size: 11px;
}

.target-value-row input {
  min-height: 26px;
  padding: 3px 6px;
  font-size: 11px;
}

.legend {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.legend.is-hidden {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.dashboard-reggae-title {
  font-family: var(--heading-font);
  letter-spacing: 0.04em;
  color: #ead7b3;
}

.admin-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 41px;
  border: 1px solid rgba(177, 43, 75, 0.55);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(177, 43, 75, 0.18);
  color: #fff0f3;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.admin-primary-btn:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.admin-login-shell {
  min-height: calc(100vh - 254px);
  display: grid;
  align-content: center;
  margin-top: 112px;
  padding: 18px;
}

.page-shell {
  height: calc(100vh - 60px);
  margin-top: 60px;
  overflow: auto;
  padding: 24px;
}

.page-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: linear-gradient(180deg, #1a1a1a 0%, #131313 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  color: #f5f5f5;
  padding: 28px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  color: #ead7b3;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: 0;
}

.page-heading p {
  margin-top: 8px;
  color: #d7dde6;
  line-height: 1.7;
}

.page-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff0f3;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.contact-form {
  display: grid;
  gap: 16px;
}

.contact-form label {
  color: #f5f5f5;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.72);
  color: #f5f5f5;
  padding: 10px 12px;
}

.contact-form textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: rgba(255, 120, 120, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 43, 43, 0.18);
}

.contact-actions {
  display: flex;
  justify-content: flex-end;
}

.contact-table-wrap {
  overflow: auto;
}

.contact-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: #f5f5f5;
  font-size: 13px;
}

.contact-table th,
.contact-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.contact-table th {
  color: #ead7b3;
  font-weight: 900;
}

.contact-message-cell {
  max-width: 360px;
  white-space: pre-wrap;
}

.contact-table select {
  min-width: 110px;
  border-color: rgba(255, 255, 255, 0.12);
  background: #0d1116;
  color: #f5f5f5;
}

.admin-section {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.admin-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-section-heading h2 {
  color: #ead7b3;
  font-size: 18px;
}

.admin-section-heading span {
  color: #d7dde6;
  font-size: 13px;
  font-weight: 800;
}

.admin-account-table {
  min-width: 1040px;
}

.admin-pending-table {
  min-width: 760px;
}

.delete-account-details {
  display: grid;
  gap: 8px;
}

.delete-account-details summary {
  color: #ffb4b4;
  cursor: pointer;
  font-weight: 800;
}

.delete-account-details form {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.delete-account-details label {
  color: #f5f5f5;
  font-size: 12px;
}

.delete-account-details input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.72);
  color: #f5f5f5;
  padding: 8px 10px;
}

.danger-action {
  border-color: rgba(255, 120, 120, 0.42);
  background: rgba(180, 35, 35, 0.22);
  color: #fff0f3;
  font-size: 12px;
}

.contact-form input:-webkit-autofill,
.contact-form input:-webkit-autofill:hover,
.contact-form input:-webkit-autofill:focus,
.contact-form textarea:-webkit-autofill,
.contact-form textarea:-webkit-autofill:hover,
.contact-form textarea:-webkit-autofill:focus,
.delete-account-details input:-webkit-autofill,
.delete-account-details input:-webkit-autofill:hover,
.delete-account-details input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f5f5f5;
  box-shadow: 0 0 0 1000px #0d1116 inset;
  -webkit-box-shadow: 0 0 0 1000px #0d1116 inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: #f5f5f5;
}

.login-panel {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 28px 34px 32px;
  background: linear-gradient(180deg, #1a1a1a 0%, #131313 100%);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.login-panel .login-title {
  margin: 0 0 22px;
  color: #ead7b3;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: 0;
}

.login-panel form {
  display: grid;
  gap: 20px;
}

.login-panel .notice {
  white-space: pre-line;
}

.notice {
  border: 1px solid;
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  white-space: pre-line;
}

.notice-flash {
  overflow: hidden;
  max-height: 240px;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    max-height 0.45s ease,
    margin-bottom 0.45s ease,
    padding-top 0.45s ease,
    padding-bottom 0.45s ease,
    border-width 0.45s ease;
}

.notice-flash.is-dismissing {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  pointer-events: none;
}

.notice.success {
  border-color: #2f9a50;
  background: rgba(41, 146, 73, 0.2);
}

.notice.error {
  border-color: #c53f3f;
  background: rgba(180, 35, 35, 0.2);
}

.app-notice-wrap {
  position: fixed;
  top: 78px;
  left: 50%;
  z-index: 30;
  width: min(620px, calc(100% - 36px));
  transform: translateX(-50%);
  pointer-events: none;
}

.app-notice-wrap .notice {
  margin-bottom: 0;
}

.login-field {
  margin: 0;
}

.login-field label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  margin: -1px;
  padding: 0;
  white-space: nowrap;
}

.login-input-wrap {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0 12px;
  background: rgba(13, 17, 22, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.login-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d9e3ec;
  opacity: 0.78;
}

.login-input-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.login-input-wrap input[type="email"],
.login-input-wrap input[type="password"] {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  padding: 9px 6px;
  background: transparent;
  color: #f5f5f5;
  font-size: 15px;
  font-weight: 400;
  box-shadow: none;
}

.login-input-wrap input[type="email"]:focus,
.login-input-wrap input[type="password"]:focus {
  outline: none;
  box-shadow: none;
}

.login-input-wrap:focus-within {
  border-color: rgba(255, 120, 120, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 43, 43, 0.18);
}

.login-input-wrap input[type="email"]::placeholder,
.login-input-wrap input[type="password"]::placeholder {
  color: #a7b0ba;
}

.login-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
}

.login-options {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  margin-bottom: 0;
  color: #d7dde6;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

.remember-row input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: auto;
  margin: 0;
  padding: 0;
  accent-color: #b12b4b;
}

.remember-row span {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

.login-help-link {
  display: inline-block;
  color: #ead7b3;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.login-help-link:hover {
  color: #fff0f3;
  text-decoration: underline;
}

.login-demo-links {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.login-demo-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(234, 215, 179, 0.42);
  border-radius: 8px;
  color: #ead7b3;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  padding: 0 14px;
}

.login-demo-links a:hover {
  border-color: rgba(255, 143, 0, 0.72);
  color: #fff0f3;
}

.login-panel input[type="email"]:-webkit-autofill,
.login-panel input[type="email"]:-webkit-autofill:hover,
.login-panel input[type="email"]:-webkit-autofill:focus,
.login-panel input[type="password"]:-webkit-autofill,
.login-panel input[type="password"]:-webkit-autofill:hover,
.login-panel input[type="password"]:-webkit-autofill:focus {
  -webkit-text-fill-color: #f5f5f5;
  box-shadow: 0 0 0 1000px #0d0d0d inset;
  -webkit-box-shadow: 0 0 0 1000px #0d0d0d inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: #f5f5f5;
}

.login-submit-btn {
  width: 184px;
  min-width: 164px;
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .app-shell {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
  }

  .viewer-shell {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
  }

  #photometryViewer {
    min-height: 520px;
  }

  .header-inner {
    align-items: start;
    flex-direction: column;
    height: auto;
    min-height: 68px;
    padding: 10px 20px;
  }

  .site-header {
    position: static;
  }

  .app-shell {
    margin-top: 0;
  }

  .admin-login-shell {
    margin-top: 0;
  }

  .page-shell {
    height: auto;
    margin-top: 0;
  }

  .workspace-actions {
    width: min(190px, calc(100% - 24px));
  }

  .optics-actions {
    width: min(330px, calc(100% - 24px));
  }

  .workspace-actions-buttons {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .workspace-actions {
    width: min(190px, calc(100% - 24px));
    gap: 6px;
    padding: 6px;
  }

  .optics-actions {
    right: 12px;
    bottom: 200px;
    width: min(330px, calc(100% - 24px));
    gap: 6px;
    padding: 6px;
  }

  .workspace-actions-buttons {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .optics-actions-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .workspace-actions-buttons button {
    min-height: 28px;
    font-size: 11px;
    padding: 4px 6px;
  }

  .optics-actions-buttons button {
    min-height: 28px;
    font-size: 11px;
    padding: 4px 6px;
  }

  .workspace-actions-title {
    min-height: 20px;
  }

  .scene-canvas-shell {
    min-height: 420px;
  }

  .login-panel {
    padding: 24px 18px 26px;
  }

  .login-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .login-options {
    gap: 10px;
  }

  .login-submit-btn {
    width: 100%;
  }

  .page-shell {
    padding: 14px;
  }

  .page-panel {
    padding: 20px 16px;
  }

  .page-heading {
    display: grid;
  }

  .page-link-button,
  .contact-actions .admin-primary-btn {
    width: 100%;
  }
}
