:root {
  --bg: #080716;
  --surface: #131126;
  --surface-2: #19162e;
  --surface-3: #211c3b;
  --line: #312b55;
  --text: #f4f1ff;
  --muted: #aaa2c7;
  --blue: #a875ff;
  --blue-2: #d8c6ff;
  --purple: #9a6cff;
  --purple-bright: #b184ff;
  --green: #54d985;
  --red: #ff7777;
  --added-bg: #21441d;
  --gold: #ffd94d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0, rgba(154, 108, 255, 0.18), transparent 32rem),
    radial-gradient(circle at 84% 18%, rgba(78, 55, 145, 0.18), transparent 28rem),
    linear-gradient(180deg, #11102a 0, var(--bg) 22rem);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Malgun Gothic", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 30px;
  border-bottom: 1px solid #29244a;
  background: rgba(13, 12, 32, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(4, 3, 12, 0.32);
}

.brand img {
  display: block;
  width: 210px;
  max-height: 52px;
  height: auto;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 18px;
}

.profile-link,
button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
}

.profile-link:hover,
button:hover {
  background: #332b5c;
}

.nav a {
  position: relative;
  display: grid;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  padding: 0 2px;
  opacity: 0.94;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  height: 2px;
  border-radius: 99px;
  background: transparent;
}

.nav a:hover,
.nav a.active {
  color: #ffffff;
  opacity: 1;
}

.nav a:hover::after,
.nav a.active::after {
  background: var(--purple-bright);
  box-shadow: 0 0 14px rgba(177, 132, 255, 0.48);
}

button:disabled {
  cursor: not-allowed;
  color: #716a88;
  background: #161426;
}

.shell {
  width: min(1520px, calc(100% - 36px));
  margin: 26px auto 44px;
}

.profile-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #221b42, #151329 58%, #100e21);
  box-shadow: 0 18px 40px rgba(4, 3, 12, 0.38);
}

.avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  background: #100f20;
}

.avatar-wrap img {
  display: none;
  max-width: 190px;
  max-height: 210px;
  object-fit: contain;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: #2b2451;
  color: var(--blue-2);
  font-size: 34px;
  font-weight: 900;
}

.profile-copy {
  padding: 32px 32px 28px;
}

.eyebrow,
.label {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(42px, 6vw, 82px);
  line-height: 0.96;
}

.score-line {
  display: flex;
  flex-wrap: wrap;
  gap: 42px;
  margin-top: 28px;
}

.score-line div {
  display: grid;
  gap: 4px;
}

.score-line strong {
  color: var(--blue-2);
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1;
}

.profile-link {
  align-self: start;
  margin: 24px 24px 0 0;
  white-space: nowrap;
  background: #211c3b;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 17, 38, 0.96);
}

.controls-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.panel-title h2 {
  color: var(--text);
  font-size: 18px;
}

.panel-title span {
  font-size: 13px;
  line-height: 1.45;
}

.lookup-form,
.add-form {
  display: grid;
  gap: 10px;
}

.lookup-form {
  grid-template-columns: 1fr 108px;
}

.search-box {
  position: relative;
  min-width: 0;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 12px;
}

input:focus {
  border-color: var(--blue);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 8;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17142b;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.35);
}

.search-results button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.search-results button:hover {
  background: #282245;
}

.recent-row {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 30px;
}

.recent-list button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.add-form button {
  background: var(--added-bg);
  border-color: #1a3a16;
}

.level-search-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.level-search-box input {
  border-radius: 0;
  border-color: rgba(255, 255, 255, 0.16);
  border-width: 0 0 3px;
  background: #101016;
  font-weight: 800;
}

.level-search-toggle {
  position: relative;
  min-height: 38px;
  border: 2px solid #9fc7ff;
  border-radius: 5px;
  background: #1f5fa9;
  padding: 0;
}

.level-search-toggle::before {
  content: "";
  width: 9px;
  height: 9px;
  border-left: 2px solid #ffffff;
  border-top: 2px solid #ffffff;
  transform: translateY(3px) rotate(45deg);
}

.level-search-toggle[aria-expanded="true"]::before {
  transform: translateY(-2px) rotate(225deg);
}

.level-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 10;
  overflow: auto;
  max-height: 400px;
  border: 1px solid rgba(216, 198, 255, 0.2);
  border-radius: 6px;
  background: rgba(8, 8, 10, 0.96);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.46);
}

.level-search-results[hidden] {
  display: none;
}

.level-result-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(100px, 0.7fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
  padding: 9px 14px;
  text-align: left;
}

.level-result-item:hover {
  background: rgba(98, 76, 150, 0.18);
}

.level-result-difficulty {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #18f64d;
  color: #05050a;
  font-size: 16px;
  font-weight: 950;
}

.level-result-difficulty img,
.level-result-difficulty span {
  grid-area: 1 / 1;
}

.level-result-difficulty img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
}

.level-result-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.level-result-main strong,
.level-result-main small,
.level-result-creators {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-result-main strong {
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
}

.level-result-main em {
  color: #ffffff;
  font-style: normal;
}

.level-result-main small {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.level-result-creators {
  justify-self: end;
  max-width: 100%;
  color: #d9e7ff;
  font-size: 13px;
  font-weight: 800;
}

.level-result-empty {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.judgement-calculator {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: #101010;
}

.judge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
}

.judge-grid label {
  display: grid;
  grid-template-rows: auto 30px;
  gap: 5px;
  min-width: 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.judge-grid label:nth-child(4) {
  grid-column: auto;
}

.judge-grid label:nth-child(5) {
  grid-column: auto;
  justify-self: stretch;
}

.judge-grid label:nth-child(6) {
  grid-column: auto;
}

.judge-grid input {
  width: 100%;
  min-height: 28px;
  border-width: 0 0 3px;
  border-radius: 0;
  border-color: rgba(255, 255, 255, 0.2);
  background: #191919;
  padding: 2px 6px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
}

.judge-grid input.judge-good::placeholder {
  color: #16c946;
  opacity: 1;
}

.judge-grid input.judge-good.edge::placeholder {
  color: #b2b424;
  opacity: 1;
}

.judge-grid input.judge-bad::placeholder {
  color: #a4513d;
  opacity: 1;
}

.judge-grid input.judge-bad.strong::placeholder {
  color: #ff1515;
  opacity: 1;
}

.judge-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.judge-results strong {
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
}

.level-preview {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 44px minmax(132px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid rgba(216, 198, 255, 0.16);
  border-radius: 8px;
  background: #0f0e19;
}

.level-preview[hidden] {
  display: none;
}

.preview-difficulty,
.preview-loader {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #18f64d;
  color: #04120a;
  font-size: 13px;
  line-height: 1;
  font-weight: 950;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.24);
}

.preview-difficulty img,
.preview-difficulty span {
  grid-area: 1 / 1;
}

.preview-difficulty img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
}

.preview-loader {
  border: 4px solid rgba(24, 246, 77, 0.22);
  border-top-color: #18f64d;
  background: transparent;
  animation: preview-spin 0.8s linear infinite;
}

.preview-error {
  background: #ff6464;
  color: #210607;
}

.preview-main {
  display: grid;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.preview-main strong {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.05;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-main span {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-check {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #28b84d;
}

.preview-check::before {
  content: "";
  width: 18px;
  height: 10px;
  border-left: 5px solid #09150d;
  border-bottom: 5px solid #09150d;
  transform: translateY(-2px) rotate(-45deg);
}

.preview-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 2px solid #e2d8ff;
  border-radius: 6px;
  background: #29a94b;
  color: #ffffff;
  font-weight: 950;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.preview-link:hover {
  background: #31bd56;
}

@keyframes preview-spin {
  to {
    transform: rotate(360deg);
  }
}

.simulation {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  background: #100f20;
  border: 1px solid #29244a;
}

.simulation-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.simulation h2 {
  font-size: 16px;
}

.simulation-head button,
.ghost {
  background: #211c3b;
}

.sim-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.sim-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sim-row strong {
  color: var(--blue-2);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.sim-row b {
  color: #74669d;
}

.sim-row em {
  min-width: 52px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.delta-up {
  color: var(--green);
}

.delta-down {
  color: var(--red);
}

.delta-neutral {
  color: #9d94ba;
}

.list-panel {
  min-width: 0;
  overflow: hidden;
}

.list-title {
  align-items: center;
  padding: 16px 18px 12px;
}

.list-title i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 1px solid #1a3a16;
  border-radius: 3px;
  background: var(--added-bg);
  vertical-align: -1px;
}

.table-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.scores-controls {
  display: grid;
  gap: 16px;
  margin: 0 16px 0;
  padding: 16px;
  border: 1px solid rgba(216, 198, 255, 0.16);
  border-radius: 7px;
  background:
    radial-gradient(circle at 74% 100%, rgba(177, 132, 255, 0.18), transparent 17rem),
    rgba(30, 25, 61, 0.74);
}

.pass-search {
  display: grid;
  position: relative;
}

.pass-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pass-search input {
  min-height: 44px;
  padding-left: 48px;
  border-color: rgba(216, 198, 255, 0.17);
  background: rgba(255, 255, 255, 0.045);
  color: #f5f1ff;
}

.pass-search::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 2px solid #bdb5d8;
  border-radius: 50%;
  transform: translateY(-58%);
}

.pass-search::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 27px;
  z-index: 1;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: #bdb5d8;
  transform: rotate(45deg);
}

.score-tools {
  display: grid;
  grid-template-columns: 194px 44px;
  align-items: center;
  gap: 14px;
}

.score-tools button {
  min-height: 40px;
  border: 1px solid rgba(216, 198, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 900;
}

.score-tools button {
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
}

.sort-menu {
  position: relative;
  z-index: 4;
}

.sort-menu-button {
  position: relative;
  width: 100%;
  justify-content: start;
  padding: 0 34px 0 14px !important;
  text-align: left;
}

.sort-menu-button::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: translateY(-68%) rotate(45deg);
  transition: transform 160ms ease;
}

.sort-menu.open .sort-menu-button::after {
  transform: translateY(-30%) rotate(225deg);
}

.sort-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(216, 198, 255, 0.28);
  border-radius: 0 0 4px 4px;
  background: #05040c;
  box-shadow: 0 18px 34px rgba(2, 1, 8, 0.42);
  opacity: 0;
  max-height: 0;
  transform: translateY(-6px);
  transition: max-height 170ms ease, opacity 140ms ease, transform 170ms ease;
  pointer-events: none;
}

.sort-menu.open .sort-options {
  opacity: 1;
  max-height: 260px;
  transform: translateY(0);
  pointer-events: auto;
}

.sort-options button {
  justify-content: start;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: #05040c;
  padding: 0 14px;
  color: #ffffff;
  font-size: 14px;
  text-align: left;
}

.sort-options button:hover,
.sort-options button.active {
  background: #1f6bd8;
}

#sortDirection {
  font-size: 0;
}

#sortDirection::before {
  content: "↓";
  font-size: 20px;
  line-height: 1;
}

#sortDirection[data-direction="asc"]::before {
  content: "↑";
}

.pass-count {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid rgba(216, 198, 255, 0.12);
  border-radius: 6px;
  color: #d8d0eb;
  font-size: 14px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.045);
}

.level-list {
  display: grid;
  overflow: auto;
  max-height: 680px;
  border-top: 1px solid var(--line);
}

.level-card {
  display: grid;
  grid-template-columns: 54px minmax(220px, 1fr) 132px 96px 64px 116px;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 14px 18px 14px 14px;
  border-bottom: 1px solid rgba(216, 198, 255, 0.12);
  background:
    radial-gradient(circle at 72% 50%, rgba(177, 132, 255, 0.18), transparent 17rem),
    linear-gradient(90deg, rgba(26, 22, 61, 0.98), rgba(18, 14, 40, 0.98));
}

.level-card:hover {
  background:
    radial-gradient(circle at 72% 50%, rgba(191, 150, 255, 0.26), transparent 18rem),
    linear-gradient(90deg, rgba(34, 28, 79, 0.98), rgba(21, 17, 48, 0.98));
}

.level-card.added {
  background:
    radial-gradient(circle at 72% 50%, rgba(84, 217, 133, 0.12), transparent 17rem),
    linear-gradient(90deg, rgba(28, 57, 28, 0.98), rgba(18, 35, 26, 0.98));
}

.level-card.not-applied {
  opacity: 0.76;
}

.level-difficulty {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 48px;
}

.level-difficulty .difficulty-icon,
.level-difficulty span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid #d487b4;
  border-radius: 50%;
  background: rgba(18, 14, 40, 0.72);
  color: #f1d5ff;
  font-size: 14px;
  font-weight: 900;
  object-fit: contain;
}

.level-difficulty .difficulty-icon {
  border: 0;
  background: transparent;
}

.level-difficulty small {
  color: #938aad;
  font-size: 10px;
  font-weight: 900;
}

.level-main {
  min-width: 0;
}

.level-meta {
  overflow: hidden;
  color: #8f86ad;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-main h3 {
  overflow: hidden;
  margin: 2px 0 3px;
  color: #f6f1ff;
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-main p {
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-stat {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  text-align: center;
}

.level-stat span {
  color: #d7cfff;
  font-size: 13px;
  font-weight: 800;
}

.level-stat strong {
  color: #f8f3ff;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
}

.level-stat.score-stat strong {
  font-variant-numeric: tabular-nums;
}

.level-stat em {
  justify-self: center;
  border-radius: 8px;
  background: rgba(20, 125, 50, 0.72);
  padding: 4px 8px;
  font-size: 15px;
  font-style: normal;
  line-height: 1;
}

.accuracy-stat {
  justify-items: center;
}

.accuracy-stat strong.perfect {
  color: #fff200;
  font-size: 20px;
  font-weight: 950;
  text-shadow: 0 0 8px rgba(255, 242, 0, 0.28);
}

.speed-stat strong {
  font-size: 18px;
}

.judgement-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  z-index: 6;
  display: grid;
  gap: 2px;
  min-width: 90px;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(52, 47, 72, 0.96);
  box-shadow: 0 10px 24px rgba(3, 2, 10, 0.38);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.level-card:hover .judgement-popover,
.level-card:focus-within .judgement-popover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.judge-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  align-items: center;
  justify-items: center;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.judge-row.good span:first-child,
.judge-row.good span:last-child {
  color: #f1ef30;
}

.judge-row.good span:nth-child(2) {
  color: #32ff47;
}

.judge-row.bad span {
  color: #ff2f39;
}

.judge-row.bad span:nth-child(3) {
  color: #ff7a2d;
}

.level-action {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-width: 116px;
}

.level-action a,
.level-action button {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #ffffff;
  padding: 0;
  text-decoration: none;
  font-size: 0;
  font-weight: 900;
}

.level-action a::before,
.level-action button::before {
  content: "";
  width: 20px;
  height: 20px;
  background: #ffffff;
  mask: url("assets/pass-open-icon.png") center / contain no-repeat;
  -webkit-mask: url("assets/pass-open-icon.png") center / contain no-repeat;
}

.level-action small {
  color: #a79fbd;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  max-height: 680px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #211c3b;
  color: var(--text);
  font-size: 13px;
}

td {
  color: #e5def7;
  font-size: 14px;
}

td:nth-child(4),
td:nth-child(5) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td:nth-child(6),
td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:nth-child(even) {
  background: rgba(177, 132, 255, 0.045);
}

tr.added {
  background: var(--added-bg) !important;
}

tr.not-applied td {
  color: var(--red);
}

.difficulty-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
}

.perfect {
  color: var(--gold);
  font-weight: 900;
}

.contrib {
  color: var(--green);
  font-weight: 900;
}

.empty-row,
.empty-row td {
  height: 160px;
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
  }

  .profile-hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .avatar-wrap {
    min-height: 180px;
  }

  .profile-link {
    justify-self: start;
    margin: 0 0 24px 24px;
  }

  .lookup-form {
    grid-template-columns: 1fr;
  }

  .level-preview {
    grid-template-columns: 58px minmax(0, 1fr) 44px;
  }

  .preview-link {
    grid-column: 1 / -1;
  }

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

  .level-result-creators {
    grid-column: 2;
    justify-self: start;
    color: #aaa2c7;
  }

  .judge-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
  }

  .judge-grid label,
  .judge-grid label:nth-child(4),
  .judge-grid label:nth-child(5),
  .judge-grid label:nth-child(6) {
    grid-column: auto;
    justify-self: stretch;
  }

  .judge-grid label {
    grid-template-columns: none;
    grid-template-rows: auto 30px;
    font-size: 13px;
  }

  .score-tools {
    grid-template-columns: 1fr 44px;
  }

  .level-card {
    grid-template-columns: 54px minmax(0, 1fr) 96px 64px;
    gap: 12px;
  }

  .level-action small {
    display: none;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1520px);
    margin-top: 14px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .score-line,
  .sim-row {
    grid-template-columns: 1fr;
  }

  .sim-row b {
    display: none;
  }

  .level-preview {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .preview-difficulty,
  .preview-loader {
    width: 42px;
    height: 42px;
    font-size: 12px;
  }

  .preview-check {
    display: none;
  }

  .level-search-box {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .judge-grid,
  .judge-results {
    grid-template-columns: 1fr 1fr;
  }

  .judge-grid label:last-child {
    grid-column: 1 / -1;
    width: min(160px, 100%);
    justify-self: center;
  }

  .level-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .level-stat,
  .level-action {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }

  .level-action {
    display: none;
  }
}
