:root {
  --hextech-night: #020713;
  --hextech-panel: rgba(4, 14, 31, 0.78);
  --hextech-panel-strong: rgba(3, 11, 26, 0.9);
  --hextech-cyan: #54e7ff;
  --hextech-blue: #2b8dff;
  --hextech-gold: #dcb766;
  --hextech-gold-bright: #ffe0a8;
  --hextech-text: #eefaff;
  --hextech-muted: rgba(218, 239, 247, 0.63);
  --hextech-line: rgba(99, 224, 255, 0.24);
  --hextech-radius: 26px;
  color-scheme: dark;
}

html {
  min-width: 320px;
  background: var(--hextech-night);
  scrollbar-color: rgba(84, 231, 255, 0.38) rgba(2, 7, 19, 0.82);
}

body {
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1rem, 3vw, 2.4rem);
  background: #020713;
  color: var(--hextech-text);
}

body::before,
body::after {
  z-index: 1;
  width: 48vw;
  height: 48vw;
  max-width: 760px;
  max-height: 760px;
  opacity: 0.62;
  filter: blur(100px);
  pointer-events: none;
  mix-blend-mode: screen;
}

body::before {
  top: -24vw;
  left: -14vw;
  background: radial-gradient(circle, rgba(30, 171, 255, 0.38), transparent 68%);
}

body::after {
  right: -18vw;
  bottom: -26vw;
  background: radial-gradient(circle, rgba(220, 183, 102, 0.26), transparent 68%);
}

.hextech-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 15%, rgba(19, 63, 91, 0.22), transparent 45%),
    var(--hextech-night);
}

.hextech-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(1, 5, 14, 0.86) 0%, rgba(1, 8, 18, 0.2) 34%, rgba(1, 8, 18, 0.22) 68%, rgba(1, 5, 14, 0.88) 100%),
    linear-gradient(180deg, rgba(1, 5, 14, 0.35) 0%, rgba(1, 5, 14, 0.3) 42%, rgba(1, 5, 14, 0.92) 100%);
}

.hextech-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  opacity: 0.17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.hextech-skins,
.hextech-skin {
  position: absolute;
  inset: 0;
}

.hextech-skins {
  z-index: 1;
}

.hextech-skin {
  opacity: 0;
  transform: scale(1.075);
  transition: opacity 1.8s ease, transform 10s cubic-bezier(0.19, 1, 0.22, 1);
  will-change: opacity, transform;
}

.hextech-skin.is-active {
  opacity: 1;
  transform: scale(1.015);
}

.hextech-skin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--skin-position, 50% 50%);
  filter: saturate(1.12) contrast(1.08) brightness(0.62);
}

.hextech-glow {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at 22% 34%, rgba(65, 221, 255, 0.18), transparent 26%),
    radial-gradient(circle at 78% 62%, rgba(226, 184, 96, 0.14), transparent 30%);
  animation: hextechGlow 9s ease-in-out infinite alternate;
}

.hextech-grid {
  position: absolute;
  z-index: 5;
  left: -20%;
  right: -20%;
  bottom: -29%;
  height: 70%;
  opacity: 0.34;
  transform: perspective(520px) rotateX(62deg);
  transform-origin: center bottom;
  background-image:
    linear-gradient(rgba(63, 221, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 221, 255, 0.24) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to top, #000 8%, transparent 76%);
  -webkit-mask-image: linear-gradient(to top, #000 8%, transparent 76%);
  animation: hextechGrid 8s linear infinite;
}

.hextech-scanline {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: -14%;
  height: 18%;
  opacity: 0.38;
  background: linear-gradient(180deg, transparent, rgba(77, 224, 255, 0.08), rgba(77, 224, 255, 0.25), transparent);
  animation: hextechScan 9s linear infinite;
}

.hextech-particles {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: 100%;
  height: 100%;
  opacity: 0.62;
}

@keyframes hextechGlow {
  to { transform: translate3d(2%, 1%, 0) scale(1.08); opacity: 0.82; }
}

@keyframes hextechGrid {
  to { background-position: 0 48px, 48px 0; }
}

@keyframes hextechScan {
  from { transform: translateY(-10vh); }
  to { transform: translateY(128vh); }
}

/* Public card */
body > .glass-card {
  width: min(100%, 560px);
  max-width: 560px;
  margin-bottom: 1.1rem;
  padding: clamp(1.7rem, 4vw, 2.65rem) clamp(1.15rem, 4vw, 2.35rem) 2.15rem;
}

.glass-card,
.login-box,
.stat-card,
.friend-links,
.copyright-mini {
  border-color: rgba(99, 224, 255, 0.23);
  background:
    linear-gradient(145deg, rgba(11, 29, 51, 0.83), rgba(3, 11, 27, 0.76)),
    radial-gradient(circle at 10% 0%, rgba(60, 205, 255, 0.13), transparent 34%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(220, 183, 102, 0.08) inset,
    0 0 46px rgba(22, 164, 225, 0.08) inset;
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.glass-card {
  position: relative;
  border-radius: var(--hextech-radius);
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 9px;
  border: 1px solid rgba(220, 183, 102, 0.14);
  border-radius: calc(var(--hextech-radius) - 8px);
  pointer-events: none;
  clip-path: polygon(0 16px, 16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px));
}

.glass-card::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 18%;
  width: 64%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hextech-cyan), var(--hextech-gold), transparent);
  box-shadow: 0 0 18px rgba(84, 231, 255, 0.75);
  pointer-events: none;
}

.glass-card > *,
.login-box > * {
  position: relative;
  z-index: 2;
}

.glass-card:hover,
.stat-card:hover,
.friend-links:hover {
  border-color: rgba(99, 224, 255, 0.44);
  box-shadow:
    0 32px 88px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(220, 183, 102, 0.12) inset,
    0 0 54px rgba(22, 164, 225, 0.12) inset;
}

.card-header {
  margin-bottom: 1.65rem;
}

.icon-wrapper {
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: 21px 7px;
  color: #ffe39b;
  font-size: 2rem;
  border-color: rgba(220, 183, 102, 0.5);
  background:
    linear-gradient(145deg, rgba(220, 183, 102, 0.22), rgba(35, 151, 211, 0.13));
  box-shadow:
    0 0 0 1px rgba(84, 231, 255, 0.12) inset,
    0 0 32px rgba(220, 183, 102, 0.2);
  filter: drop-shadow(0 0 16px rgba(84, 231, 255, 0.24));
  transform: rotate(3deg);
}

.icon-wrapper i {
  transform: rotate(-3deg);
}

.card-header h1 {
  font-size: clamp(1.58rem, 5vw, 2.05rem);
  letter-spacing: 0.08em;
  background: linear-gradient(105deg, #f8efd1 6%, #e9bf62 43%, #79ecff 84%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 34px rgba(84, 231, 255, 0.16);
}

.card-header .subtitle,
.email-tip,
.copy-hint,
.copyright-mini,
.friend-links {
  color: var(--hextech-muted);
}

.status-badge {
  border-color: rgba(84, 231, 255, 0.32);
  color: rgba(225, 248, 255, 0.8);
  background: linear-gradient(90deg, rgba(21, 119, 157, 0.22), rgba(220, 183, 102, 0.1));
  box-shadow: 0 0 22px rgba(84, 231, 255, 0.08) inset;
}

.status-badge i,
.email-input-wrapper i.email-icon,
.code-input-wrapper i,
.glass-card h2 i {
  color: var(--hextech-cyan);
}

.email-input-wrapper,
.code-input-wrapper,
.input-wrapper,
.card-display {
  border-color: rgba(99, 224, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(2, 10, 24, 0.83), rgba(10, 31, 51, 0.58));
  box-shadow: 0 0 24px rgba(10, 148, 202, 0.05) inset;
}

.email-input-wrapper,
.code-input-wrapper,
.input-wrapper {
  border-radius: 13px;
}

.email-input-wrapper:focus-within,
.code-input-wrapper:focus-within,
.input-wrapper:focus-within {
  border-color: rgba(84, 231, 255, 0.74);
  box-shadow:
    0 0 0 3px rgba(84, 231, 255, 0.08),
    0 0 30px rgba(29, 172, 230, 0.15);
}

.email-input-wrapper input,
.code-input-wrapper input,
.input-wrapper input,
.input-wrapper textarea {
  color: #effcff;
  caret-color: var(--hextech-cyan);
}

.email-input-wrapper input::placeholder,
.code-input-wrapper input::placeholder,
.input-wrapper input::placeholder,
.input-wrapper textarea::placeholder {
  color: rgba(207, 232, 241, 0.38);
}

.card-display {
  position: relative;
  border-radius: 18px;
  padding: 1.75rem 1.4rem;
}

.card-display::before,
.card-display::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.card-display::before {
  top: 9px;
  left: 9px;
  border-top: 1px solid rgba(220, 183, 102, 0.72);
  border-left: 1px solid rgba(220, 183, 102, 0.72);
}

.card-display::after {
  right: 9px;
  bottom: 9px;
  border-right: 1px solid rgba(84, 231, 255, 0.72);
  border-bottom: 1px solid rgba(84, 231, 255, 0.72);
}

.label {
  color: rgba(164, 229, 242, 0.62);
  letter-spacing: 0.2em;
}

.card-code {
  background: linear-gradient(100deg, #fff7d8, #f3ca72 44%, #79efff);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(84, 231, 255, 0.15));
}

.button-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.btn,
.btn-get-code,
.back-btn,
.logout-btn,
.tab-btn {
  min-height: 46px;
  border-radius: 11px;
  border-color: rgba(99, 224, 255, 0.28);
  color: #eafaff;
  background: linear-gradient(135deg, rgba(10, 42, 65, 0.74), rgba(4, 17, 34, 0.82));
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(84, 231, 255, 0.05) inset;
}

.btn-primary,
.btn-get-code {
  border-color: rgba(220, 183, 102, 0.46);
  color: #fff2ca;
  background: linear-gradient(135deg, rgba(159, 117, 38, 0.45), rgba(9, 74, 105, 0.72));
}

.btn#queryBtn {
  border-color: rgba(84, 231, 255, 0.36);
  color: #d8f9ff;
  background: linear-gradient(135deg, rgba(20, 126, 164, 0.34), rgba(6, 35, 65, 0.72));
}

.btn:hover:not(:disabled),
.btn-get-code:hover:not(:disabled),
.back-btn:hover,
.tab-btn:hover {
  color: #fff;
  border-color: rgba(99, 224, 255, 0.72);
  background: linear-gradient(135deg, rgba(22, 120, 156, 0.62), rgba(9, 45, 74, 0.88));
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34), 0 0 22px rgba(84, 231, 255, 0.14);
}

.btn-primary:hover:not(:disabled),
.btn-get-code:hover:not(:disabled) {
  border-color: rgba(255, 222, 145, 0.78);
  background: linear-gradient(135deg, rgba(186, 137, 43, 0.58), rgba(10, 97, 130, 0.8));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), 0 0 24px rgba(220, 183, 102, 0.18);
}

.btn:focus-visible,
.btn-get-code:focus-visible,
.back-btn:focus-visible,
.logout-btn:focus-visible,
.tab-btn:focus-visible,
.friend-links a:focus-visible {
  outline: 2px solid var(--hextech-cyan);
  outline-offset: 3px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

.copyright-mini,
.friend-links {
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(4, 17, 34, 0.76), rgba(11, 35, 54, 0.66));
}

.friend-links a {
  color: #8eeeff;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(37, 153, 194, 0.08);
}

.friend-links a:hover {
  color: #fff1c1;
  border-color: rgba(220, 183, 102, 0.3);
  background: rgba(220, 183, 102, 0.12);
}

/* Admin surface */
.admin-container {
  max-width: 920px;
}

.admin-container > .glass-card {
  width: 100%;
  max-width: none;
}

.top-nav h2,
.glass-card h2 {
  color: #eafaff !important;
  letter-spacing: 0.04em;
}

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

.stat-card .stat-value {
  background: linear-gradient(110deg, #f5cc74, #71e9ff);
  -webkit-background-clip: text;
  background-clip: text;
}

.tab-btn.active {
  color: #fff1c8;
  border-color: rgba(220, 183, 102, 0.55);
  background: linear-gradient(135deg, rgba(166, 122, 38, 0.32), rgba(23, 110, 145, 0.42));
  box-shadow: 0 0 18px rgba(220, 183, 102, 0.1) inset;
}

.kami-list::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--hextech-cyan), var(--hextech-blue));
}

.kami-item {
  border-bottom-color: rgba(99, 224, 255, 0.12);
}

.kami-item:hover {
  background: rgba(84, 231, 255, 0.055);
}

.kami-item .kami-code {
  color: #9cefff;
}

.login-overlay {
  background: rgba(1, 6, 15, 0.56);
  backdrop-filter: blur(5px) saturate(120%);
  -webkit-backdrop-filter: blur(5px) saturate(120%);
}

.login-box {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

@media (max-width: 620px) {
  body {
    padding: 0.85rem;
  }

  body > .glass-card {
    padding: 1.55rem 1rem 1.35rem;
    border-radius: 20px;
  }

  .glass-card::before {
    inset: 6px;
    border-radius: 14px;
  }

  .icon-wrapper {
    width: 60px;
    height: 60px;
    margin-bottom: 0.8rem;
    font-size: 1.72rem;
  }

  .card-header .subtitle {
    line-height: 1.55;
  }

  .code-row {
    flex-direction: column;
  }

  .btn-get-code {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .button-group {
    grid-template-columns: 1fr 1fr;
  }

  .button-group .btn-primary {
    grid-column: 1 / -1;
  }

  .btn {
    min-width: 0;
    padding-inline: 0.75rem;
  }

  .hextech-skin img {
    object-position: var(--skin-position-mobile, var(--skin-position, 50% 50%));
  }

  .admin-container .glass-card {
    padding: 1.35rem 1rem;
  }
}

@media (max-width: 380px) {
  .card-header h1 {
    font-size: 1.42rem;
  }

  .button-group {
    grid-template-columns: 1fr;
  }

  .button-group .btn-primary {
    grid-column: auto;
  }

  .card-code {
    font-size: 1.22rem;
    letter-spacing: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .hextech-skin {
    transition: none;
  }

  .hextech-skin:not(.is-active),
  .hextech-particles,
  .hextech-scanline {
    display: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card,
  .login-box,
  .stat-card,
  .friend-links,
  .copyright-mini {
    background: rgba(3, 12, 27, 0.96);
  }
}
