* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, Ubuntu;
  font-size: 16px;
  line-height: 1.5;
  background: transparent;
  color: #f6f8fad0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body::-webkit-scrollbar-track {
  background: rgba(20, 22, 35, 0.827);
  border-radius: 4px;
}

body::-webkit-scrollbar-thumb {
  background-color: rgba(92, 96, 112, 0.641);
  border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
  background-color: rgba(120, 125, 144, 0.6);
}

#starCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: -1;
}

.avatar {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: url("/default-avatar.png") center/cover no-repeat;
  cursor: pointer;
  z-index: 50;
}

.avatar:hover {
  box-shadow: 0 8px 20px rgba(238, 236, 236, 0.181);
  filter: brightness(1.05);
}

.social-panel a {
  display: inline-block;
  margin-right: 17px;
  color: rgba(240, 245, 255, 0.274);
  font-size: 1rem;
  transition: all 0.25s ease;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
}

.social-panel a:hover {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 10px rgba(180, 200, 255, 0.45);
}

#toggleThemeBtn {
  position: fixed;
  top: 16px;
  right: 25px;
  z-index: 50;
  padding: 8px 14px;
  font-size: 1.1rem;
  width: fit-content;
}

.container {
  max-width: 950px;
  margin: 50px auto;
  padding: 0 16px;
  text-align: center;
}

.h1-text {
  margin: 0 0 8px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #dbe2ee 0%, #dbe2ee 50%, #b8c1cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub {
  margin: 0 0 24px;
  color: #c2ccd6;
  font-size: 1rem;
}

.glass {
  background: rgba(20, 24, 40, 0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  padding: 22px;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

form {
  display: grid;
  gap: 16px;
}

.row {
  display: grid;
  gap: 8px;
}

.row.two {
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

label {
  font-weight: 500;
  color: #ddd9da;
  font-size: 0.95rem;
}

input,
select {
  background: rgba(18, 20, 30, 0.75);
  color: #f6f8fa;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

input:hover,
select:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

input:focus,
select:focus {
  border-color: #4ab8ff;
  box-shadow: 0 0 0 3px rgba(74, 184, 255, 0.25);
  transform: translateY(-1px);
}

#min,
#max {
  width: 6rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.375rem;
  outline: none;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.tags-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
  user-select: none;
  font-size: 14.5px;
}

.tag-item:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tag-item.selected {
  background: linear-gradient(
    135deg,
    rgba(85, 95, 135, 0.85) 0%,
    rgba(65, 70, 110, 0.9) 100%
  );
  color: #fafbff;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.35), 0 0 10px rgba(160, 185, 255, 0.18);
}

.btn {
  background: linear-gradient(6deg, #212233 0%, #252737 100%);
  color: #e0e0e0;
  font-weight: 600;
  border: 1px solid #aca8a81e;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 1.05rem;
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(26, 42, 58, 0.4);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.card {
  margin-top: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
}

.hidden {
  display: none;
}

.problem-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.problem-header h2 {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.contest-badges {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.12);
  color: #e8ecf4;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.badge.div1 {
  background: rgba(220, 70, 70, 0.28);
  color: #ffb3b3;
}

.badge.div2 {
  background: rgba(70, 120, 200, 0.28);
  color: #c8dbff;
}

.badge.div3 {
  background: rgba(60, 170, 95, 0.28);
  color: #c7f5d4;
}

.badge.div4 {
  background: rgba(200, 160, 40, 0.28);
  color: #ffe9a6;
}

.badge.educational {
  background: rgba(140, 80, 220, 0.28);
  color: #e5d4ff;
}

.badge.rated {
  background: rgba(50, 180, 150, 0.28);
  color: #c8fff0;
}

.badge.unrated {
  background: rgba(255, 255, 255, 0.14);
  color: #e1e1e1;
}

.badge.other {
  background: rgba(255, 255, 255, 0.18);
  color: #e8e8e8;
}

#probTitle {
  margin: 0 0 8px;
  font-size: 1.4rem;
  color: #ffffff;
}

#probMeta,
#probDate {
  margin: 0 0 6px;
  color: #c2ccd6;
}

#probTags span {
  display: inline-block;
  padding: 4px 10px;
  margin-right: 5px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  background: #14254273;
  border: 1px solid rgba(140, 165, 210, 0.5);
  border-radius: 18px;
  color: #64ab68c9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

#probSolved {
  margin: 0 0 12px;
  color: #c0acdde8;
  font-style: normal;
  font-size: 0.95rem;
}

.checkBox {
  opacity: 70%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  user-select: none;
}

.checkBox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #444;
}

.checkBox input[type="checkbox"]:focus {
  outline: none;
  box-shadow: none;
}

.user-icon {
  color: #50327d !important;
}

.status {
  margin-top: 14px;
  min-height: 20px;
  color: #c2ccd6;
  text-align: center;
}

footer {
  max-width: 820px;
  margin: 32px auto 40px;
  color: #c2ccd6;
  font-size: 13px;
  text-align: center;
  opacity: 0.85;
}

@media (max-width: 480px) {
  .container {
    margin: 20px auto;
    padding: 0 12px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .sub {
    font-size: 0.9rem;
  }

  form {
    gap: 12px;
  }

  .row.two {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  input,
  select,
  #min,
  #max,
  button,
  .btn,
  .ghost {
    width: 100%;
    font-size: 0.9rem;
    padding: 8px 10px;
  }

  .tags-box {
    justify-content: flex-start;
    gap: 6px;
  }

  .tags-box {
    flex-direction: column;
    gap: 4px;
  }

  .tag-item {
    width: 100%;
    text-align: center;
  }

  .glass {
    padding: 16px;
    border-radius: 20px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  footer {
    font-size: 12px;
    margin: 24px auto 32px;
  }
}

@media (max-width: 600px) {
  #result {
    text-align: center;
  }

  #probLink,
  #againBtn,
  #probContestLink {
    width: 100%;
    margin: 6px 0;
  }
}

@media (max-width: 768px) {
  .avatar,
  #toggleThemeBtn {
    top: 2px;
  }

  .avatar {
    left: 1px;
  }

  #toggleThemeBtn {
    right: 1px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .sub {
    font-size: 0.95rem;
  }

  .row.two {
    grid-template-columns: 1fr 1fr;
    gap: 12px !important;
  }

  .glass {
    padding: 18px;
  }

  .card {
    padding: 16px;
  }

  button,
  .btn,
  .ghost {
    font-size: 0.95rem;
    padding: 10px 14px;
  }
}

@media (max-width: 1024px) {
  .container {
    max-width: 720px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .sub {
    font-size: 1rem;
  }

  form {
    gap: 14px;
  }

  .row.two {
    gap: 14px;
  }

  input,
  select,
  #min,
  #max {
    font-size: 0.95rem;
    padding: 10px 12px;
  }
}
