/* Diffraction foil components: silver, directional spectral accents and dark ink.
 * Structural layout stays in lab.css; scientific palettes stay in the renderers.
 */
:root {
  --foil-image: linear-gradient(112deg, #a9e1e4, #cbc5e1 35%, #edcedf 67%, #e3dfba);
  --foil-light: radial-gradient(ellipse at var(--lamp-x, 72%) var(--lamp-y, 22%), #ffffff66, #ffffff00 230px);
  --foil-grain: repeating-linear-gradient(118deg, #ffffff09 0 1px, #18151f06 1px 3px);
  --focus: #b7ecf3;
}
/* Foil face / dark etched face. IDs exclude steppers and dropdown internals. */
button.foil-action {
  position: relative;
  isolation: isolate;
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 42px;
  padding: 9px 19px;
  background: linear-gradient(#191820, #131219) padding-box, var(--foil-image) border-box;
  color: #eeedf5;
  font-weight: 550;
  letter-spacing: .015em;
  box-shadow: inset 0 1px 0 #ffffff08, 0 7px 16px -13px #000;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.3), filter .16s ease, box-shadow .16s ease;
}
button.foil-action.primary,
#beam-lock.foil-action[aria-pressed=true] {
  background: var(--foil-light), var(--foil-grain), var(--foil-image);
  color: #16151c;
  font-weight: 650;
  text-shadow: 0 1px 0 #ffffff20;
  box-shadow: inset 0 1px 0 #ffffff90, inset 0 -1px 1px #13102055, 0 9px 20px -14px #000;
}
button.foil-action:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }
button.foil-action:not(:disabled):is(:active, [data-pressed=true]) {
  transform: translateY(1px) scale(.975); filter: brightness(.95);
  box-shadow: inset 0 2px 5px #0c091c60, inset 0 -1px 0 #ffffff20;
  transition-duration: 65ms;
}
button.foil-action:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
button.foil-action:disabled { opacity: 1; color: #b3aebf; background: #24232b; border-color: #393640; box-shadow: none; cursor: wait; }
.foil-rule { background: var(--foil-light), var(--foil-grain), var(--foil-image); }
.brand-icon { display: block; flex: none; width: 48px; height: 48px; }
.foil-rule { height: 2px; border-radius: 2px; opacity: .85; }
/* Etched cards and inset inputs keep the scientific workspace calm. */
.panel { border-color: #34313e; box-shadow: inset 0 1px 0 #ffffff04, 0 10px 30px -24px #000; }
.panel h3 { display: flex; align-items: center; gap: 10px; }
.main > div > .panel > h3::before,
.main .panel:not(.panel .panel) > h3::before {
  content: ''; flex: none; width: 5px; height: 16px; border-radius: 3px;
  background: var(--foil-image); opacity: .9;
}
.control { gap: 9px; }
.control > span { color: #bbb8c8; }
.control .dash-input-container:focus-within { border-color: #acccdc !important; box-shadow: 0 0 0 3px #b5cee913; }
.control input:disabled { color: #817b8c; }
.control .dash-input-container:has(input:disabled) { opacity: .55; }
.control input { font-variant-numeric: tabular-nums; }
.control .dash-input-stepper { transition: box-shadow .12s ease, filter .12s ease; touch-action: manipulation; }
.control .dash-input-stepper:not(:disabled):is(:active, [data-pressed=true]) { box-shadow: inset 0 2px 5px #0009; filter: brightness(1.25); }
button.dash-dropdown { border-radius: 8px !important; min-height: 40px; }
button.dash-dropdown:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.result-strip {
  border: 1px solid transparent; border-left-width: 3px;
  background: linear-gradient(#19171f, #16141b) padding-box, linear-gradient(120deg, #91cad6aa, #b4a0d266, #d7afc64d) border-box;
  color: #d7d5e1; line-height: 1.85;
}
.experiment-tab { position: relative; border-radius: 9px 9px 0 0; }
.experiment-tab.selected {
  background: linear-gradient(180deg, #28233233, #30293888) !important;
  border-bottom: 0 !important;
}
.experiment-tab.selected::after { content: ''; position: absolute; inset: auto 16px 0; height: 2px; background: var(--foil-image); }
.experiment-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
/* Compact switch, built independently of Dash's checkbox/listbox styling. */
.substrate-switch { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; }
#substrate-label { color: #cbc7d5; font-size: 14px; }
#substrate-enabled.foil-switch {
  position: relative; flex: none; width: 52px; height: 44px; min-height: 44px;
  margin: 0; padding: 0; border: 0; border-radius: 999px;
  background: transparent; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.foil-switch .switch-track {
  position: absolute; left: 3px; top: 9px; width: 46px; height: 26px; border-radius: 999px;
  background: #25242c; border: 1px solid #3b3745;
  box-shadow: inset 0 1px 3px #0008; transition: border-color .2s;
}
.foil-switch[aria-checked=true] .switch-track {
  background: linear-gradient(#17122235, #17122235), var(--foil-image);
  border-color: #b6b0c040; box-shadow: inset 0 1px 2px #100c1c30;
}
.foil-switch .switch-thumb {
  position: absolute; left: 6px; top: 12px; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff, #eeeef3 42%, #c2becc 100%);
  box-shadow: 0 1px 3px #08060e66, inset 0 1px 0 #ffffffb0;
  transition: transform .2s cubic-bezier(.2,.8,.3,1.2), width .12s ease, box-shadow .12s ease;
}
.foil-switch[aria-checked=true] .switch-thumb { transform: translateX(20px); }
.foil-switch:not(:disabled):is(:active, [data-pressed=true]) .switch-thumb { width: 22px; box-shadow: 0 1px 2px #08060e80, inset 0 1px 2px #aba2c370; }
.foil-switch[aria-checked=true]:not(:disabled):is(:active, [data-pressed=true]) .switch-thumb { transform: translateX(18px); }
.foil-switch:hover .switch-track { border-color: #aaa2b7; }
#substrate-enabled.foil-switch:focus-visible { outline: none; }
.foil-switch:focus-visible .switch-track { outline: 2px solid var(--focus); outline-offset: 4px; }
/* Angle slider: foil track, pearl thumb, and an exact numeric input. */
.angle-range { grid-column: 1 / -1; padding: 13px 16px 8px; background: #100f16; border: 1px solid #38323f; border-radius: 10px; }
.angle-range #control-angle { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.angle-range #control-angle .dash-input-container { max-width: 132px !important; }
#angle-slider { padding: 14px 10px 10px; }
.dash-slider-track { background: #2e2937 !important; border-radius: 8px; height: 5px !important; }
.dash-slider-range { background: var(--foil-image) !important; border-radius: inherit; }
.dash-slider-thumb {
  width: 21px !important; height: 21px !important; border: 1px solid #e7e3f4 !important;
  background: radial-gradient(circle at 35% 25%, #fff, #e3e2ef 45%, #9d97af 95%) !important;
  box-shadow: 0 2px 7px #0007 !important;
}
.dash-slider-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.dash-slider-thumb { transition: box-shadow .14s ease, filter .14s ease; }
.dash-slider-root:is(:active, [data-pressed=true]) .dash-slider-thumb { box-shadow: 0 0 0 5px #b4dbed20, 0 2px 6px #0007 !important; filter: brightness(1.07); }
.dash-slider-mark { font-size: 11px !important; color: #aca5b8 !important; }
.dash-slider-tooltip { background: #272132 !important; color: #f2edf8 !important; }
/* Foil seal scale, not a large diamond over the band. */
.localized-mode-marker { filter: drop-shadow(0 0 3px #b8c9ed70); cursor: pointer; }
.localized-mode-marker:hover { filter: drop-shadow(0 0 5px #bce8f5cc); }
/* Floating laboratory notebook adopts the small seal and inset-card treatment. */
.notebook.floating-notebook { border-color: #797084; box-shadow: 0 16px 55px #0008, inset 0 1px 0 #ffffff0e; background: #15131cf5; }
#notebook-handle { background: linear-gradient(115deg, #20222d, #292332 60%, #2c2330); border-color: #524759; }
.notebook-brand-icon { display: block; flex: none; width: 30px; height: 30px; }
#notebook-toggle.foil-action { min-height: 30px; font-size: 11px; padding: 4px 10px; }
.notebook .dash-input-container { background: #0f0e14 !important; border: 1px solid #45404e !important; border-radius: 6px; width: 100%; margin-top: 6px; }
.notebook .dash-input-container input { background: transparent; border: 0; margin-top: 0; }
.notebook-actions .foil-action { min-height: 34px; padding: 6px 13px; }
.notebook-steps ol { padding-left: 24px; }
.notebook-steps li::marker { color: #b8dae4; font-variant-numeric: tabular-nums; }
.reading-panel > summary { color: #cbc6d7; }
.reading-panel > summary::marker { color: #b6bdd8; }
.model-details { margin-top: 18px; border-top: 1px solid var(--line); }
.model-details > summary::marker { color: #c4b5e8; }
@media (max-width: 760px) {
  .sidebar .model-details[open] .note { display: block; }
}
/* Indeterminate means unknown duration: no percentage or invented completion. */
.foil-progress { position: relative; overflow: hidden; width: min(280px, 75vw); height: 7px; border-radius: 99px; background: #2a2532; box-shadow: inset 0 1px 3px #0009, 0 0 0 1px #ffffff0c; }
.foil-progress > span { display: block; position: absolute; inset: 0 auto 0 0; width: 42%; border-radius: inherit; background: var(--foil-light), var(--foil-image); box-shadow: 0 0 12px #c7c0f45c; animation: foil-progress 1.8s ease-in-out infinite; }
@keyframes foil-progress { from { transform: translateX(-105%); } to { transform: translateX(345%); } }
.foil-loading { display: flex; align-items: center; flex-direction: column; gap: 18px; padding: 28px; border: 1px solid #79708488; border-radius: 16px; color: #eeebf5; background: #17131ee8; box-shadow: 0 15px 40px #0007; backdrop-filter: blur(10px); font-size: 14px; }
.calculation-overlay { background: #100e19df; border-color: #a29bc066; backdrop-filter: blur(7px); gap: 22px; }
.calculation-overlay strong { font-size: 21px; font-weight: 500; }
button.foil-action.primary:disabled::after,
#slab-refine.foil-action:disabled::after { content: ''; position: absolute; height: 2px; bottom: 5px; left: 20%; width: 60%; border-radius: 10px; background: var(--foil-image); animation: foil-busy 1.4s ease-in-out infinite alternate; }
@keyframes foil-busy { from { opacity: .3; transform: scaleX(.25); } to { opacity: 1; transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .foil-progress > span { animation: none; width: 45%; left: 27.5%; }
  button.foil-action:disabled::after { animation: none; }
  button.foil-action:not(:disabled):hover, button.foil-action:not(:disabled):is(:active, [data-pressed=true]) { transform: none; }
}
@media (hover: none) {
  button.foil-action:not(:disabled):hover:not(:is(:active, [data-pressed=true])) { transform: none; filter: none; }
}
@media (max-width: 760px) {
  .angle-range { padding: 10px 12px 7px; }
  button.foil-action { min-height: 42px; padding: 9px 15px; }
  
}

/* Keep the learning steps visible; writing fields expand only when needed. */
#notebook-entry { max-height: none; overflow: visible; margin: 2px 0 8px; }
#notebook-entry summary { cursor: pointer; color: #c8c0d8; padding: 6px 0; font-size: 12px; }
#notebook-entry[open] { max-height: 210px; overflow: auto; }
.notebook-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.notebook-actions button, .notebook-actions .foil-action { padding: 6px 3px; font-size: 11px; white-space: nowrap; min-width: 0; }
#browser-yig-stop { margin: 8px 0 0; border-color: #b9abca; pointer-events: auto; }
