body.atoms-mode {
  overflow: hidden;
}

body.atoms-mode .app {
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
}

body.atoms-mode .topbar {
  display: none;
}

.view-root.atoms-active {
  width: 100%;
  max-width: none;
  height: calc(100dvh - env(safe-area-inset-top));
  padding: 0;
  overflow: hidden;
}

.atoms-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  color: var(--body-text);
}

.atoms-commandbar {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  padding: 7px 9px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, var(--foreground) 6%);
}

.atoms-heading-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.atoms-home,
.atoms-profile-back,
.atoms-search-clear,
.atoms-retry {
  -webkit-tap-highlight-color: transparent;
}

.atoms-home {
  width: 30px;
  height: 30px;
  padding: 0 1px 2px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--foreground);
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

.atoms-home:active,
.atoms-retry:active,
.atoms-profile-back:active {
  transform: scale(.97);
  background: var(--panel-2);
}

.atoms-heading-copy strong,
.atoms-heading-copy span {
  display: block;
}

.atoms-heading-copy strong {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  letter-spacing: .02em;
}

.atoms-heading-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

.atoms-search-wrap {
  position: relative;
  margin-top: 7px;
}

.atoms-search {
  width: 100%;
  height: 36px;
  padding: 6px 38px 6px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--foreground);
  color: var(--body-text);
  caret-color: var(--accent);
  font-size: 16px;
  line-height: 1;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.atoms-search::-webkit-search-cancel-button {
  display: none;
}

.atoms-search:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line) 30%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.atoms-search::placeholder {
  color: var(--muted);
  opacity: .82;
}

.atoms-search-mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  transform: translateY(-52%);
  pointer-events: none;
}

.atoms-search-clear {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 3px;
  width: 30px;
  height: 30px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 21px;
  line-height: 1;
}

.atoms-search-results {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  z-index: 10;
  max-height: min(340px, 55dvh);
  overflow-y: auto;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 62%, var(--accent) 38%);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg) 88%, var(--foreground) 12%);
  box-shadow: 0 12px 35px color-mix(in srgb, #000 78%, transparent);
  -webkit-overflow-scrolling: touch;
}

.atoms-search-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 5px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.atoms-search-result:last-child {
  border-bottom: 0;
}

.atoms-search-result:active {
  background: color-mix(in srgb, var(--foreground) 82%, var(--accent) 18%);
}

.atoms-result-symbol {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
}

.atoms-result-name {
  color: var(--body-text);
  font-size: 13px;
  font-weight: 700;
}

.atoms-result-number {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.atoms-search-empty {
  margin: 0;
  padding: 11px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.atoms-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.atoms-table-view,
.atoms-profile {
  width: min(100%, 760px);
  margin: 0 auto;
}

.atoms-focus-card {
  display: grid;
  grid-template-columns: 24px 55px minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 7px 10px 7px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 58%, var(--accent) 42%);
  border-radius: 9px;
  background: color-mix(in srgb, var(--foreground) 91%, var(--accent) 9%);
  color: var(--body-text);
  text-align: left;
}

.atoms-focus-card:active {
  transform: scale(.995);
  background: color-mix(in srgb, var(--foreground) 84%, var(--accent) 16%);
}

.atoms-focus-number {
  align-self: start;
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.atoms-focus-symbol {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 33px;
  line-height: 1;
  letter-spacing: -.05em;
}

.atoms-focus-copy {
  min-width: 0;
}

.atoms-focus-name,
.atoms-focus-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atoms-focus-name {
  color: var(--body-text);
  font-size: 16px;
  line-height: 1.05;
}

.atoms-focus-meta {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
}

.atoms-focus-open {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  text-align: right;
}

.atoms-table-frame {
  margin-top: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--foreground) 94%, var(--bg) 6%);
}

.atoms-table {
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  grid-template-rows:
    repeat(7, clamp(27px, 7.4vw, 42px))
    7px
    repeat(2, clamp(27px, 7.4vw, 42px));
  gap: 2px;
  width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.atoms-cell,
.atoms-series-placeholder {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--foreground);
  overflow: hidden;
}

.atoms-cell {
  display: grid;
  place-items: center;
  padding: 5px 0 0;
  color: var(--body-text);
  -webkit-tap-highlight-color: transparent;
}

.atoms-cell strong {
  overflow: hidden;
  max-width: 100%;
  font-family: var(--mono);
  font-size: clamp(7px, 2.3vw, 14px);
  line-height: 1;
  letter-spacing: -.05em;
  text-overflow: clip;
  white-space: nowrap;
}

.atoms-cell-number {
  position: absolute;
  top: 2px;
  left: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(5px, 1.35vw, 8px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.atoms-cell:active,
.atoms-cell.is-selected {
  z-index: 2;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--foreground) 80%, var(--accent) 20%);
  color: var(--accent);
}

.atoms-cell.is-selected {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.atoms-table.has-search .atoms-cell:not(.is-match) {
  opacity: .28;
}

.atoms-table.has-search .atoms-cell.is-match {
  border-color: var(--accent);
  color: var(--accent);
}

.atoms-cell.has-custom-color {
  border-color: color-mix(in srgb, var(--atoms-cell-color) 76%, var(--atoms-cell-ink) 24%);
  background: var(--atoms-cell-color);
  color: var(--atoms-cell-ink);
}

.atoms-cell.has-custom-color .atoms-cell-number {
  color: color-mix(in srgb, var(--atoms-cell-ink) 72%, transparent);
}

.atoms-cell.has-custom-color:active,
.atoms-cell.has-custom-color.is-selected,
.atoms-table.has-search .atoms-cell.has-custom-color.is-match {
  border-color: var(--accent);
  color: var(--atoms-cell-ink);
}

.atoms-lanthanide,
.atoms-actinide {
  background: color-mix(in srgb, var(--foreground) 89%, var(--standard) 11%);
}

.atoms-series-placeholder {
  display: grid;
  place-items: center;
  padding: 1px;
  border-style: dashed;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1;
}

.atoms-series-placeholder strong {
  font-size: clamp(6px, 1.8vw, 10px);
}

.atoms-series-placeholder span {
  font-size: clamp(4.5px, 1.15vw, 7px);
}

.atoms-scrub-note {
  margin: 7px 1px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .06em;
  text-align: center;
}

.atoms-profile {
  padding-bottom: 18px;
}

.atoms-profile-back {
  min-height: 32px;
  margin: 0 0 7px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
}

.atoms-identity {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 58%, var(--accent) 42%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--foreground) 91%, var(--accent) 9%);
}

.atoms-identity-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--foreground);
}

.atoms-identity-tile > span {
  position: absolute;
  top: 7px;
  left: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.atoms-identity-tile > strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 43px;
  line-height: 1;
  letter-spacing: -.06em;
}

.atoms-identity-tile > small {
  position: absolute;
  right: 7px;
  bottom: 6px;
  left: 7px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atoms-profile-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .12em;
}

.atoms-identity-copy h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(27px, 8vw, 42px);
  line-height: .95;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}

.atoms-identity-copy > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.25;
}

.atoms-color-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 8px;
  padding: 6px 7px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--foreground);
}

.atoms-color-control label,
.atoms-color-control label strong,
.atoms-color-control label small {
  display: block;
}

.atoms-color-control label strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

.atoms-color-control label small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .04em;
}

.atoms-color-input {
  width: 54px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  -webkit-appearance: none;
  appearance: none;
}

.atoms-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.atoms-color-input::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

.atoms-color-input::-moz-color-swatch {
  border: 0;
  border-radius: 4px;
}

.atoms-color-reset {
  min-width: 50px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
}

.atoms-color-reset:active {
  color: var(--accent);
  background: var(--panel-2);
}

.atoms-reference-section {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--foreground);
  overflow: hidden;
}

.atoms-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, var(--foreground) 14%);
}

.atoms-section-heading p,
.atoms-section-heading span {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .1em;
}

.atoms-section-heading p {
  color: var(--accent);
}

.atoms-section-heading span {
  color: var(--muted);
}

.atoms-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.atoms-fact {
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.atoms-fact:nth-child(2n):not(.is-wide),
.atoms-fact.is-wide {
  border-right: 0;
}

.atoms-fact.is-wide {
  grid-column: 1 / -1;
}

.atoms-fact:last-child,
.atoms-fact:nth-last-child(2):not(.is-wide) {
  border-bottom: 0;
}

.atoms-fact dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.atoms-fact dd {
  margin: 4px 0 0;
  color: var(--body-text);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.atoms-context-facts .atoms-fact dd {
  color: color-mix(in srgb, var(--body-text) 88%, var(--standard) 12%);
  font-size: 11px;
  line-height: 1.45;
}

.atoms-source-link {
  display: block;
  margin: 8px 2px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  text-decoration: none;
}

.atoms-loading-shell {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.atoms-loading-shell .atoms-home {
  position: absolute;
  top: 8px;
  left: 9px;
}

.atoms-retry {
  min-width: 82px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--foreground);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 380px) {
  .atoms-commandbar {
    padding-right: 7px;
    padding-left: 7px;
  }

  .atoms-stage {
    padding-right: 5px;
    padding-left: 5px;
  }

  .atoms-table-frame {
    padding: 3px;
  }

  .atoms-table {
    gap: 1px;
  }

  .atoms-cell,
  .atoms-series-placeholder {
    border-radius: 2px;
  }
}

@media (min-width: 700px) {
  .atoms-commandbar > * {
    width: min(100%, 760px);
    margin-right: auto;
    margin-left: auto;
  }

  .atoms-search-wrap {
    margin-top: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atoms-focus-card:active,
  .atoms-home:active,
  .atoms-retry:active,
  .atoms-profile-back:active {
    transform: none;
  }
}
