.library-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.library-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.library-topbar h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
}

.library-nav-band,
.library-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
}

.library-nav-band {
  position: relative;
  z-index: 80;
  margin-bottom: 18px;
  padding: 0;
  overflow: visible;
}

.library-panel {
  position: relative;
  z-index: 1;
}

.mega-nav,
.panel-actions,
.summary-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.mega-nav {
  position: relative;
  z-index: 90;
  gap: 0;
}

.mega-group {
  position: relative;
  z-index: 91;
}

.mega-trigger {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.mega-trigger.standalone {
  display: inline-flex;
  align-items: center;
}

.mega-trigger span {
  color: var(--muted);
}

.mega-trigger.active,
.mega-trigger:hover {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.mega-menu {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  z-index: 500;
  display: none;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 18px;
  min-width: 620px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: color-mix(in srgb, var(--panel-solid) 96%, transparent);
  box-shadow:
    var(--shadow),
    0 20px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.mega-menu.narrow {
  grid-template-columns: minmax(120px, 180px);
  min-width: 180px;
  gap: 8px;
}

.mega-group:hover .mega-menu,
.mega-group:focus-within .mega-menu {
  display: grid;
}

.mega-nav.menu-closed .mega-menu {
  display: none !important;
}

.mega-column {
  display: grid;
  align-content: start;
  gap: 8px;
}

.mega-column h3 {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--muted);
}

.mega-menu button {
  border: 0;
  padding: 6px 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.mega-menu button:hover {
  color: var(--accent-strong);
}

.mini-search,
.base-grid label,
.probability-form label,
.stat-form-grid label,
.music-field {
  display: grid;
  gap: 6px;
}

.mini-search span,
.base-grid span,
.probability-form span,
.stat-form-grid span,
.music-field span {
  color: var(--muted);
  font-size: 12px;
}

.mini-search input,
.mini-search select,
.base-grid input,
.probability-form input,
.probability-form select,
.stat-form-grid input,
.stat-form-grid select,
.music-field select {
  min-height: 40px;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
  box-sizing: border-box;
}

.mini-search input,
.mini-search select {
  height: 48px;
}

.music-field select {
  min-width: 0;
  width: 100%;
}

.library-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.calc-card h3,
.reward-section h3 {
  margin: 0;
}

.panel-heading h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.egg-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.egg-toolbar .grow input {
  width: min(320px, 38vw);
}

.egg-archive-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.egg-archive-summary strong {
  color: var(--text);
}

.egg-archive-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.egg-archive-row {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1fr) minmax(330px, auto);
  gap: 16px;
  align-items: center;
  min-height: 62px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}

.egg-archive-row time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.egg-archive-row strong {
  min-width: 0;
  line-height: 1.35;
}

.egg-title-hover {
  position: relative;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  outline: none;
  cursor: zoom-in;
}

.egg-title-hover > strong {
  border-bottom: 1px dashed color-mix(in srgb, var(--accent-strong) 58%, transparent);
}

.egg-title-hover:focus-visible > strong {
  border-radius: 3px;
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.egg-title-preview {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 50;
  width: min(520px, calc(100vw - 72px));
  aspect-ratio: 900 / 377;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-solid);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  pointer-events: none;
}

.egg-archive-row:first-child .egg-title-preview {
  top: calc(100% + 12px);
  bottom: auto;
}

.egg-title-preview img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: contain;
}

.egg-title-hover:hover .egg-title-preview,
.egg-title-hover:focus-within .egg-title-preview {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.egg-archive-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 7px;
}

.egg-archive-links a,
.egg-archive-links > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.egg-archive-links a:hover {
  border-color: var(--line-strong);
  color: var(--accent-strong);
}

.egg-archive-links .is-missing {
  color: var(--muted);
  opacity: 0.6;
}

.egg-archive-links small {
  font-size: 10px;
  font-weight: 700;
}

.source-note,
.status {
  color: var(--muted);
}

.summary-strip {
  margin: 14px 0;
}

.metric {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
}

.metric strong {
  color: var(--text);
}

.library-subtabs,
.probability-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.arcana-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.arcana-picker button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  background: var(--panel);
  font-weight: 850;
  cursor: pointer;
}

.arcana-picker button:hover,
.arcana-picker button.active {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.arcana-detail {
  min-height: 170px;
}

.arcana-overview {
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.arcana-profile {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 2px 0;
}

.arcana-profile h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 20px;
}

.arcana-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}

.arcana-link-effect {
  display: grid;
  align-content: start;
  gap: 8px;
  width: 100%;
  justify-self: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.arcana-link-effect span,
.arcana-section-heading span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.arcana-link-effect p {
  margin: 0;
  white-space: pre-line;
  line-height: 1.55;
}

.arcana-skills-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.arcana-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.arcana-section-heading h3 {
  margin: 0;
}

.arcana-skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.arcana-skill {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
  cursor: help;
}

.arcana-skill:hover,
.arcana-skill:focus-visible {
  border-color: var(--accent-strong);
}

.arcana-skill img,
.arcana-skill-fallback {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.arcana-skill-fallback {
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.arcana-skill > span:last-of-type {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arcana-skill::after {
  position: absolute;
  z-index: 20;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(360px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.22);
  content: attr(data-effect);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
}

.arcana-skill:hover::after,
.arcana-skill:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.dps-import-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.dps-import-panel label {
  display: grid;
  gap: 6px;
}

.dps-import-panel label > span {
  color: var(--muted);
  font-size: 12px;
}

.dps-import-panel input,
.dps-import-panel select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
  box-sizing: border-box;
}

.dps-import-panel .primary {
  min-height: 42px;
  white-space: nowrap;
}

.dps-window {
  overflow: hidden;
  margin-top: 16px;
  border: 2px solid #3a3a3a;
  border-radius: 2px;
  color: #f4f4f4;
  background: linear-gradient(180deg, #96928d 0%, #817d78 48%, #716d69 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.44), 0 12px 28px rgba(0, 0, 0, 0.18);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  text-shadow: -0.65px -0.65px 0 rgba(20, 20, 20, 0.96), 0.65px -0.65px 0 rgba(20, 20, 20, 0.96), -0.65px 0.65px 0 rgba(20, 20, 20, 0.96), 0.65px 0.65px 0 rgba(20, 20, 20, 0.96);
}

.dps-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 10px 0 6px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.65);
  background: rgba(47, 47, 47, 0.42);
  font-size: 14px;
}

.dps-window-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dps-window-actions {
  gap: 5px !important;
}

.dps-window-icon,
.dps-window-close {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(35, 35, 35, 0.9);
  background: rgba(220, 220, 220, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  color: #4a4a4a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
}

.dps-window-close {
  cursor: pointer;
}

.dps-share-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(35, 35, 35, 0.9);
  background: rgba(220, 220, 220, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  color: #4a4a4a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-shadow: none;
  cursor: pointer;
}

.dps-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dps-metrics > div {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 13px 8px 11px;
  border-right: 1px solid rgba(35, 35, 35, 0.5);
}

.dps-metrics > div:last-child {
  border-right: 0;
}

.dps-metrics span {
  font-size: 16px;
  font-weight: 700;
}

.dps-metrics strong {
  font-size: 15px;
}

.dps-window-tabs {
  display: flex;
  gap: 3px;
  padding: 8px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.dps-window-tabs button {
  min-width: 78px;
  border: 1px solid #252525;
  border-radius: 2px 2px 0 0;
  padding: 6px 12px;
  color: #f4f4f4;
  background: rgba(46, 46, 46, 0.72);
  font-weight: 700;
  text-shadow: inherit;
  cursor: pointer;
}

.dps-window-tabs button.active {
  color: #fff47a;
  background: rgba(21, 21, 21, 0.82);
}

.dps-skill-table {
  display: grid;
  gap: 5px;
  margin: 7px 12px 14px;
  border: 1px solid rgba(32, 32, 32, 0.72);
  padding: 5px;
  background: linear-gradient(180deg, rgba(52, 52, 52, 0.62), rgba(34, 34, 34, 0.5));
}

.dps-summary {
  margin: 7px 12px 14px;
  border: 1px solid rgba(32, 32, 32, 0.72);
  background: rgba(56, 56, 56, 0.42);
}

.dps-skill-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(140px, 1.15fr) repeat(5, minmax(90px, 0.8fr));
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(40, 40, 40, 0.82);
  background: linear-gradient(180deg, rgba(232, 232, 232, 0.36), rgba(168, 168, 168, 0.42));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.22), 0 1px 1px rgba(15, 15, 15, 0.45);
  font-size: 12px;
}

.dps-skill-row > span,
.dps-skill-row > div,
.dps-skill-row > strong {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 3px 7px;
  text-align: center;
}

.dps-skill-head {
  min-height: 36px;
  background: rgba(33, 33, 33, 0.52);
  font-weight: 700;
}

.dps-skill-head > span {
  margin: 3px;
  border: 1px solid #2c2c2c;
  padding: 5px 4px;
  background: #767676;
  box-shadow: inset 0 1px rgba(245, 245, 245, 0.32), inset 0 -1px rgba(20, 20, 20, 0.55), 0 1px 1px rgba(20, 20, 20, 0.55);
}

.dps-skill-head > span:first-child {
  margin-right: 51px;
}

.dps-skill-name {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 4px;
  text-align: center !important;
  font-size: 12px;
  font-weight: 700;
}

.dps-skill-name em {
  margin-left: 6px;
  color: #f9e773;
  font-size: 11px;
  font-style: normal;
}

.dps-skill-name em.missing {
  color: #ffd0a0;
}

.dps-skill-name img,
.dps-skill-fallback {
  width: 30px;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid rgba(38, 38, 38, 0.75);
  object-fit: cover;
}

.dps-skill-fallback {
  display: grid;
  place-items: center;
  background: rgba(35, 35, 35, 0.72);
}

.dps-row-track {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 3px;
  left: 37px;
  overflow: hidden;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid rgba(55, 55, 55, 0.8);
  background: linear-gradient(180deg, #bdbdbd, #999999);
  transform: translateY(-50%);
}

.dps-row-fill {
  display: block;
  height: 100%;
  border-right: 1px solid #5e980c;
  background: linear-gradient(180deg, #a9df55, #8bcf31);
}

.dps-skill-row > strong {
  font-weight: 700;
}

.dps-skill-row:not(.dps-skill-head) > span {
  font-weight: 700;
}

.dps-summary {
  padding: 10px 12px 14px;
}

.dps-summary h3 {
  margin: 4px 0 8px;
  font-size: 16px;
}

.dps-summary p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.6;
}

.dps-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-bottom: 16px;
  border-top: 1px solid rgba(44, 44, 44, 0.65);
  border-left: 1px solid rgba(44, 44, 44, 0.65);
}

.dps-summary-grid span,
.dps-summary-grid strong {
  padding: 9px 12px;
  border-right: 1px solid rgba(44, 44, 44, 0.65);
  border-bottom: 1px solid rgba(44, 44, 44, 0.65);
}

.dps-summary-grid strong {
  text-align: right;
}

.library-subtabs button,
.probability-toolbar button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--panel);
  font-weight: 900;
  cursor: pointer;
}

.library-subtabs button.active,
.probability-toolbar button.active {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.probability-toolbar {
  margin: 14px 0;
}

.probability-section .probability-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(360px, 1fr);
  align-items: end;
}

.probability-toolbar .grow {
  min-width: 0;
}

.probability-toolbar .grow input {
  width: 100%;
}

#echoColorTabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#echoColorTabs {
  display: flex;
  align-items: center;
}

#echoColorTabs img {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}

.reforge-tool-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.reforge-tool-card {
  min-height: 72px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.reforge-tool-card.active {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.reforge-tool-card img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
}

.reforge-tool-card strong,
.reforge-tool-card small {
  display: block;
}

.reforge-tool-card strong {
  font-weight: 900;
}

.reforge-tool-card small,
.reforge-tool-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.probability-table-wrap {
  overflow-x: auto;
}

.probability-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.reforge-probability-table {
  table-layout: fixed;
  min-width: 940px;
}

.reforge-probability-table th:nth-child(1),
.reforge-probability-table td:nth-child(1) {
  width: 30%;
}

.reforge-probability-table th:nth-child(2),
.reforge-probability-table td:nth-child(2) {
  width: 26%;
}

.reforge-probability-table th:nth-child(3),
.reforge-probability-table td:nth-child(3) {
  width: 20%;
  white-space: nowrap;
}

.reforge-probability-table th:nth-child(4),
.reforge-probability-table td:nth-child(4) {
  width: 9%;
  white-space: nowrap;
}

.reforge-probability-table th:nth-child(5),
.reforge-probability-table td:nth-child(5) {
  width: 15%;
}

.probability-table th,
.probability-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.probability-table th {
  color: var(--muted);
}

.probability-table td strong,
.probability-table td small {
  display: block;
}

.probability-table td small {
  margin-top: 4px;
  color: var(--muted);
}

.reforge-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.limit-break-mark {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff7ed;
  background: #e9701a;
  box-shadow: 0 0 0 2px color-mix(in srgb, #e9701a 30%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.effect-text {
  color: var(--muted);
  font-weight: 800;
}

.level-stack {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.limit-break-level {
  color: #fbbf24;
  font-weight: 900;
}

.effective-row {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.effective-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 15%, var(--panel));
  font-weight: 900;
}

.effective-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.effective-badge.tag-career {
  color: #7dd3fc;
  background: color-mix(in srgb, #38bdf8 16%, var(--panel));
}

.effective-badge.tag-importance {
  color: #facc15;
  background: color-mix(in srgb, #facc15 15%, var(--panel));
}

.reward-sections,
.music-inputs,
.probability-result {
  display: grid;
  gap: 14px;
}

.reward-section {
  display: grid;
  gap: 10px;
}

.library-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.drop-grid,
.enchant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.drop-card,
.enchant-card {
  position: relative;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.drop-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 14px;
  text-align: center;
}

.pending-name {
  color: var(--muted);
  font-size: 12px;
}

.drop-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
}

.drop-icon img {
  max-width: 54px;
  max-height: 54px;
  image-rendering: auto;
}

.enchant-card {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  cursor: help;
}

.enchant-card > span {
  color: var(--muted);
  font-size: 13px;
}

.enchant-tooltip {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 10px);
  z-index: 40;
  display: none;
  width: min(360px, 80vw);
  padding: 12px;
  border: 1px solid #60708a;
  border-radius: 8px;
  background: #050716;
  color: #d9e8ff;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.38);
}

.enchant-card:hover .enchant-tooltip,
.enchant-card:focus-within .enchant-tooltip {
  display: grid;
  gap: 6px;
}

.tooltip-kicker {
  color: #ff7f20;
  font-weight: 900;
  font-size: 12px;
}

.enchant-tooltip h4,
.enchant-tooltip p {
  margin: 0;
}

.enchant-tooltip h4 {
  font-size: 15px;
}

.tooltip-lines {
  display: grid;
  gap: 3px;
  margin-top: 4px;
}

.tooltip-lines .good {
  color: #1699ff;
}

.tooltip-lines .bad {
  color: #ff3131;
}

.erg-layout {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.erg-jump-list {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.erg-jump-list a {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.erg-jump-list a:hover {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.erg-table-card,
.calc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.erg-table-card {
  padding: 14px;
}

.erg-table-card h3 {
  margin: 0 0 10px;
}

.erg-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.erg-table-wrap {
  overflow-x: auto;
}

.erg-table th,
.erg-table td {
  padding: 10px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.erg-table th {
  color: var(--muted);
  text-align: left;
}

.erg-table td:first-child {
  width: 96px;
  font-weight: 900;
}

.erg-table td {
  min-width: 120px;
}

.compact-table {
  min-width: 0;
  width: auto;
}

.dark-erg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.dark-erg-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.dark-erg-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
}

.dark-erg-item ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.dark-erg-exp {
  margin-top: 12px;
}

.dark-erg-exp h4 {
  margin: 0 0 8px;
}

.dark-erg-exp .erg-table-wrap {
  max-width: 360px;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.stat-conversion-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.calc-card {
  padding: 14px;
}

.calc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-status {
  margin: 8px 0 12px;
  font-size: 13px;
}

.base-grid,
.probability-form,
.stat-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.probability-form input,
.probability-form select,
.stat-form-grid input,
.stat-form-grid select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.stat-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  background: var(--panel);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.stat-help::after {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  color: var(--text);
  content: attr(data-note);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.stat-help:hover::after,
.stat-help:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stat-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat-form-grid .stat-input-unit input {
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.stat-form-grid .stat-input-unit > span {
  padding: 0 10px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.stat-summary-grid .metric {
  position: relative;
  display: grid;
  gap: 4px;
  border-radius: 8px;
}

.stat-tooltip {
  cursor: help;
}

.stat-tooltip::after {
  position: absolute;
  z-index: 5;
  left: 12px;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
  color: var(--text);
  content: attr(data-note);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
}

.stat-tooltip:hover::after,
.stat-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.stat-conversion-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat-conversion-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(140px, 180px) minmax(120px, 150px);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.stat-conversion-row:first-child {
  border-top: 0;
}

.stat-conversion-row strong {
  text-align: right;
}

.stat-conversion-row > span:nth-child(2),
.stat-conversion-row > span:nth-child(3) {
  text-align: right;
}

.stat-conversion-head {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 700;
}

.stat-conversion-row.is-baseline {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.music-block {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}

.music-block > header,
.music-block > summary {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.music-block > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.music-block > summary span {
  color: var(--muted);
  font-size: 13px;
}

.music-block-body {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

.music-group {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.music-group h4 {
  margin: 0;
}

.music-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

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

.skill-base-row {
  display: grid;
  grid-template-columns: repeat(2, 320px);
  gap: 14px;
  align-items: end;
}

.skill-base-row label {
  display: grid;
  gap: 6px;
}

.skill-base-row select,
.skill-base-row input {
  box-sizing: border-box;
  min-height: 52px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel);
}

.music-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 240px));
  gap: 10px;
}

.music-field-row + .music-field-row {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.sticky-result {
  align-self: start;
}

.result-grid {
  display: grid;
  gap: 10px;
}

.simulator-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 0 2px;
  border: 0;
  background: transparent;
}

.simulator-hint span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.simulator-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 720px) {
  .skill-base-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.result-placeholder {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.skill-result-list {
  display: grid;
  gap: 12px;
}

.skill-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.skill-result-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.skill-result-card img {
  width: 32px;
  height: 32px;
}

.skill-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 0;
}

.skill-stage-grid section {
  padding: 12px;
  border-right: 1px solid var(--line);
}

.skill-stage-grid section:last-child {
  border-right: 0;
}

.skill-stage-grid h4 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.35;
}

.skill-stage-grid p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0;
  min-width: 0;
  line-height: 1.45;
}

.skill-stage-grid p span,
.skill-stage-grid p b {
  word-break: keep-all;
  white-space: nowrap;
}

.skill-stage-grid b {
  color: #52cbb2;
}

.result-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.result-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.result-box strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.probability-card {
  margin-top: 14px;
}

.timer-card {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.timer-card h3 {
  margin: 0;
}

.inline-setting {
  display: inline-grid;
  grid-template-columns: auto 72px auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.inline-setting input {
  box-sizing: border-box;
  width: 72px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--panel);
}

.music-timer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 420px));
  gap: 12px;
  align-items: start;
  justify-content: start;
}

.music-timer-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.music-timer-picker button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border-radius: 8px;
}

.music-timer-picker img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.music-timer-skill {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  overflow: hidden;
}

.music-timer-skill header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.timer-skill-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timer-skill-title img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.music-timer-rows {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.music-timer-row {
  display: grid;
  grid-template-columns: 74px 70px minmax(90px, 1fr) 46px 40px;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.music-timer-row label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.music-timer-row input {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
}

.timer-start-button,
.timer-delete-button,
.timer-primary-button {
  min-height: 38px;
  border-radius: 8px;
  white-space: nowrap;
}

.timer-start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.timer-delete-button {
  width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.boss-timer-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  align-items: start;
}

.timer-primary-button {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  font-weight: 800;
}

.boss-schedule-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.boss-schedule-preview strong {
  font-size: 14px;
}

.boss-schedule-preview div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 6px;
}

.boss-schedule-preview span {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  text-align: center;
  font-weight: 800;
}

.timer-overlay {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: min(620px, calc(100vw - 32px));
  pointer-events: auto;
}

.timer-overlay-stack {
  display: grid;
  gap: 8px;
}

.timer-overlay .timer-item {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid rgba(95, 224, 199, 0.48);
  border-radius: 8px;
  color: #e9fffb;
  background: rgba(13, 46, 53, 0.94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.timer-overlay .timer-item img {
  width: 56px;
  height: 56px;
  border-radius: 4px;
}

.timer-overlay .boss-timer-item {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-right: 12px;
}

.timer-overlay .boss-timer-item > div:first-child {
  display: none;
}

.timer-overlay .boss-timer-item > div:nth-of-type(2) {
  grid-column: 1;
}

.timer-overlay .timer-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #9ac6c4;
  font-size: 18px;
  line-height: 1.2;
}

.timer-overlay .timer-title strong {
  color: #e9fffb;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-overlay .timer-title span {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 800;
}

.timer-overlay .timer-time {
  margin-top: 0;
  color: #5fe0c7;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
}

.timer-overlay .timer-time.warn {
  color: #facc15;
}

.timer-overlay .timer-time.danger {
  color: #ff5c64;
}

.timer-overlay .boss-timer-item .timer-time {
  font-size: 46px;
}

.timer-overlay .timer-actions {
  display: flex;
  align-self: start;
  gap: 6px;
}

.timer-overlay .timer-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(154, 198, 196, 0.45);
  border-radius: 8px;
  color: #e9fffb;
  background: rgba(7, 31, 37, 0.66);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.timer-overlay .timer-actions button:hover {
  border-color: #5fe0c7;
  color: #5fe0c7;
}

body.night-mode .library-nav-band,
body.night-mode .library-panel,
body.night-mode .result-box {
  background: #0f2c33;
}

body.night-mode .erg-card,
body.night-mode .dark-erg-item,
body.night-mode .erg-table-card,
body.night-mode .calc-card,
body.night-mode .probability-table th,
body.night-mode .effective-badge,
body.night-mode .reward-table th,
body.night-mode .metric,
body.night-mode .drop-card,
body.night-mode .enchant-card,
body.night-mode .skill-result-card,
body.night-mode .simulator-hint,
body.night-mode .music-block,
body.night-mode .music-timer-skill,
body.night-mode .erg-jump-list,
body.night-mode .reforge-tool-card {
  background: #12343b;
}

@media (max-width: 900px) {
  .calculator-layout,
  .stat-conversion-layout {
    grid-template-columns: 1fr;
  }

  .reforge-tool-tabs,
  .probability-section .probability-toolbar {
    grid-template-columns: 1fr;
  }

  .mega-menu {
    position: static;
    min-width: 100%;
  }

  .skill-stage-grid {
    grid-template-columns: 1fr;
  }

  .skill-stage-grid section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sticky-result {
    position: static;
  }

  .boss-timer-layout {
    grid-template-columns: 1fr;
  }

  .dps-import-panel {
    grid-template-columns: 1fr 1fr;
  }

  .dps-import-panel .primary {
    grid-column: 1 / -1;
  }

  .dps-skill-table {
    overflow-x: auto;
  }

  .dps-skill-row {
    min-width: 980px;
  }

  .egg-archive-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .egg-title-preview {
    left: 0;
    width: min(520px, calc(100vw - 56px));
  }

  .egg-archive-links {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .library-shell {
    padding: 18px 12px;
  }

  .panel-heading {
    flex-direction: column;
  }

  .egg-toolbar {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .egg-toolbar .mini-search input,
  .egg-toolbar .mini-search select,
  .egg-toolbar .grow input {
    width: 100%;
    min-width: 0;
  }

  .egg-archive-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 12px 0;
  }

  .egg-archive-links {
    grid-column: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 5px;
  }

  .egg-archive-links a,
  .egg-archive-links > span {
    gap: 4px;
    padding-inline: 8px;
  }

  .calc-card-head,
  .music-timer-skill header {
    align-items: flex-start;
    flex-direction: column;
  }


  .music-timer-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-conversion-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-conversion-row strong {
    text-align: left;
  }

  .timer-note-field,
  .timer-start-button {
    max-width: none;
  }

  .music-timer-grid {
    grid-template-columns: 1fr;
  }

  .dps-import-panel,
  .dps-metrics,
  .dps-summary-grid {
    grid-template-columns: 1fr;
  }

  .dps-metrics > div {
    border-right: 0;
    border-bottom: 1px solid rgba(35, 35, 35, 0.5);
  }

  .dps-import-panel .primary {
    grid-column: auto;
  }

  .timer-overlay .timer-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .timer-overlay .timer-item img {
    width: 44px;
    height: 44px;
  }

  .timer-overlay .timer-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
