:root {
  color-scheme: dark;
  --bg: #090a0c;
  --panel: #111316;
  --panel-2: #16191d;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .18);
  --text: #f4f5f1;
  --muted: #8c9299;
  --acid: #cbff45;
  --acid-soft: rgba(203, 255, 69, .13);
  --danger: #ff6a6a;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 56px 56px;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at 50% -20%, rgba(203, 255, 69, .08), transparent 38%);
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(120px);
  opacity: .09;
  pointer-events: none;
}

.ambient-one { top: 20%; left: -250px; background: #6df0ff; }
.ambient-two { right: -250px; bottom: 10%; background: var(--acid); }

.site-header {
  width: min(1440px, calc(100% - 56px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .08em;
  text-decoration: none;
}

.brand b { color: var(--acid); }

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #090a0c;
  background: var(--acid);
  border-radius: 10px 3px 10px 3px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -.04em;
  transform: rotate(-3deg);
}

.header-note, .save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--acid);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(203, 255, 69, .08), 0 0 18px rgba(203, 255, 69, .55);
}

main { width: min(1440px, calc(100% - 56px)); margin: 0 auto; }

.hero {
  min-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 88px 0 54px;
  text-align: center;
  animation: reveal .65s ease both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
  color: #b9bdc2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

.eyebrow span, .section-index {
  color: var(--acid);
  font-variant-numeric: tabular-nums;
}

.hero h1 {
  margin: 0;
  max-width: 980px;
  font-size: clamp(58px, 8.7vw, 132px);
  line-height: .82;
  letter-spacing: -.076em;
  font-weight: 900;
}

.hero h1 em {
  position: relative;
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1.5px rgba(244, 245, 241, .7);
}

.hero h1 em::after {
  position: absolute;
  left: 4%;
  right: 1%;
  bottom: -8px;
  height: 9px;
  content: "";
  background: var(--acid);
  clip-path: polygon(0 50%, 100% 0, 97% 55%, 2% 100%);
  opacity: .88;
}

.hero-copy {
  max-width: 610px;
  margin: 38px auto 34px;
  color: #a9adb3;
  font-size: 16px;
  line-height: 1.65;
}

.profile-form { width: min(850px, 100%); text-align: left; }

.profile-form > label {
  display: block;
  margin: 0 0 10px 4px;
  color: #c5c8cb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 8px 8px 8px 18px;
  background: rgba(20, 22, 25, .88);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .3);
  transition: border-color .2s, box-shadow .2s;
}

.input-shell:focus-within {
  border-color: rgba(203, 255, 69, .6);
  box-shadow: 0 0 0 4px var(--acid-soft), 0 24px 80px rgba(0, 0, 0, .3);
}

.input-shell svg, .search-box svg {
  width: 22px;
  flex: 0 0 auto;
  fill: #72777d;
}

.input-shell input {
  min-width: 0;
  flex: 1;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
}

.input-shell input::placeholder { color: #60656b; }

.primary-button {
  min-height: 50px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  color: #0a0b0b;
  background: var(--acid);
  border: 0;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .18s, filter .18s;
}

.primary-button:hover { transform: translateY(-2px); filter: brightness(1.06); }
.primary-button:active { transform: translateY(0); }
.primary-button span { font-size: 18px; }

.form-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 5px 0;
  color: #62676d;
  font-size: 11px;
}

.privacy-hint::before { content: "◈ "; color: #8f959b; }

.demo-button {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #858b91;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
}

.demo-button b { color: #d3d6d8; border-bottom: 1px solid #5c6064; }
.demo-button:hover b { color: var(--acid); border-color: var(--acid); }
.demo-play { color: var(--acid); font-size: 9px; }

.hero-proof {
  width: min(620px, 100%);
  margin-top: 60px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.hero-proof div { padding: 22px 10px 0; display: flex; flex-direction: column; gap: 5px; }
.hero-proof strong { font-size: 20px; font-weight: 750; }
.hero-proof span { color: #646a70; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.workspace { padding: 32px 0 96px; animation: reveal .5s ease both; }

.workspace-topline {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-button {
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 12px;
}
.back-button:hover { color: var(--text); }

.profile-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 32px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(24, 27, 31, .97), rgba(14, 16, 18, .97));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .2);
}

.profile-identity { display: flex; align-items: center; gap: 15px; }
.profile-avatar { width: 58px; height: 58px; object-fit: cover; background: #22262a; border: 1px solid var(--line-strong); border-radius: 15px; }
.profile-kicker { color: var(--acid); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.profile-identity h2 { margin: 3px 0 2px; font-size: 20px; letter-spacing: -.03em; }
.profile-identity a { color: var(--muted); font-size: 11px; text-decoration: none; }
.profile-identity a:hover { color: var(--text); }

.profile-stats { display: flex; }
.profile-stats div { min-width: 100px; padding: 2px 24px; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.profile-stats div:last-child { border-right: 1px solid var(--line); }
.profile-stats strong { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.profile-stats span { margin-top: 6px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }

.profile-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ghost-button {
  padding: 10px 13px;
  color: #aeb2b6;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
}
.ghost-button:hover { color: var(--text); border-color: var(--line-strong); }
.ghost-button.danger:hover { color: var(--danger); border-color: rgba(255,106,106,.35); }

.board-toolbar { margin: 52px 0 20px; display: flex; justify-content: space-between; align-items: flex-end; }
.board-toolbar > div:first-child { display: flex; align-items: baseline; gap: 14px; }
.section-index { font-size: 10px; font-weight: 800; }
.board-toolbar h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.progress-wrap { width: 220px; }
.progress-copy { margin-bottom: 7px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.progress-copy strong { color: var(--text); font-variant-numeric: tabular-nums; }
.progress-track { height: 3px; overflow: hidden; background: #2b2e32; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--acid); box-shadow: 0 0 12px var(--acid); transition: width .35s ease; }

.studio-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }

.library-panel {
  min-height: 660px;
  padding: 18px;
  background: rgba(17, 19, 22, .86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
}

.panel-heading > div { display: flex; align-items: center; justify-content: space-between; }
.panel-heading span { color: #c1c5c9; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.panel-heading strong { min-width: 26px; padding: 4px 7px; color: var(--acid); background: var(--acid-soft); border-radius: 99px; text-align: center; font-size: 10px; }
.panel-heading p { margin: 8px 0 16px; color: #666c72; font-size: 11px; line-height: 1.45; }

.library-controls { display: grid; grid-template-columns: 1fr 108px; gap: 7px; margin-bottom: 12px; }
.search-box { min-width: 0; height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 7px; background: #0c0e10; border: 1px solid var(--line); border-radius: 9px; }
.search-box:focus-within { border-color: rgba(203,255,69,.35); }
.search-box svg { width: 15px; }
.search-box input { width: 100%; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 11px; }
.search-box input::placeholder { color: #62676c; }
.library-controls select { width: 100%; padding: 0 8px; color: #aeb3b8; background: #0c0e10; border: 1px solid var(--line); border-radius: 9px; outline: 0; font-size: 10px; cursor: pointer; }

.game-grid { min-height: 104px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; align-content: start; }
.library-grid { max-height: 548px; min-height: 150px; overflow-y: auto; padding: 2px 3px 8px 2px; scrollbar-width: thin; scrollbar-color: #373b3f transparent; }

.game-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #202327;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  box-shadow: 0 9px 20px rgba(0,0,0,.18);
  cursor: grab;
  isolation: isolate;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.game-card:hover, .game-card:focus-visible, .game-card.selected {
  z-index: 2;
  border-color: rgba(203,255,69,.7);
  box-shadow: 0 10px 26px rgba(0,0,0,.38), 0 0 0 2px rgba(203,255,69,.08);
  outline: 0;
  transform: translateY(-3px);
}

.game-card.dragging { opacity: .32; transform: scale(.96); }
.game-art { position: relative; aspect-ratio: 460 / 215; overflow: hidden; background: linear-gradient(135deg, #30343a, #17191c); }
.game-art img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .28s; }
.game-card:hover .game-art img { transform: scale(1.045); }
.game-card.image-error .game-art::after { position: absolute; inset: 0; display: grid; place-items: center; content: "STEAM"; color: #5f656b; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.game-card.image-error img { opacity: 0; }

.game-copy { min-height: 45px; padding: 7px 8px 8px; }
.game-title { overflow: hidden; display: -webkit-box; color: #e4e6e3; font-size: 10px; font-weight: 700; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.game-time { display: block; margin-top: 4px; color: #72777c; font-size: 8px; }
.unrank-button { position: absolute; top: 5px; right: 5px; z-index: 3; width: 22px; height: 22px; display: none; place-items: center; padding: 0; color: #f0f1ed; background: rgba(4,5,6,.8); border: 1px solid rgba(255,255,255,.16); border-radius: 50%; cursor: pointer; }
.tier-dropzone .game-card:hover .unrank-button, .tier-dropzone .game-card:focus-within .unrank-button { display: grid; }

.tier-board { display: flex; flex-direction: column; gap: 8px; }
.tier-row {
  min-height: 126px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  overflow: hidden;
  background: rgba(17,19,22,.82);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .18s, background .18s;
}

.tier-row.drag-over { border-color: rgba(203,255,69,.55); background: rgba(203,255,69,.035); }
.tier-label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid rgba(0,0,0,.18); isolation: isolate; }
.tier-label::after { position: absolute; inset: 0; z-index: -1; content: ""; background: radial-gradient(circle at 50% 20%, rgba(255,255,255,.22), transparent 58%); }
.tier-label strong { font-size: 53px; line-height: .8; letter-spacing: -.08em; text-shadow: 0 4px 20px rgba(0,0,0,.15); }
.tier-label span { margin-top: 12px; font-size: 8px; font-weight: 900; letter-spacing: .18em; opacity: .64; }
.tier-s .tier-label { color: #21140a; background: #ff9e3d; }
.tier-a .tier-label { color: #131b09; background: #cfff58; }
.tier-b .tier-label { color: #091b19; background: #5ee3c6; }
.tier-c .tier-label { color: #101626; background: #6e91e8; }
.tier-d .tier-label { color: #1d111f; background: #c67ad2; }

.tier-dropzone { position: relative; min-height: 124px; padding: 10px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.tier-dropzone:empty::after { position: absolute; inset: 0; display: grid; place-items: center; content: "ПЕРЕТАЩИ ИГРУ СЮДА"; color: #373b40; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.board-tip { margin: 7px 5px 0; color: #5d6267; font-size: 10px; }
.board-tip span { margin-right: 6px; color: var(--acid); }

.dropzone.drop-target { outline: 2px dashed rgba(203,255,69,.5); outline-offset: -5px; }
.empty-library { padding: 70px 15px; text-align: center; }
.empty-library span { width: 40px; height: 40px; margin: 0 auto 12px; display: grid; place-items: center; color: #0b0c0d; background: var(--acid); border-radius: 50%; font-weight: 900; }
.empty-library strong { display: block; font-size: 13px; }
.empty-library p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }

.quick-rank {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  width: min(720px, calc(100% - 28px));
  padding: 12px 50px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(18,20,23,.97);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(0,0,0,.62);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  animation: slideUp .24s ease both;
}
.quick-game { min-width: 0; display: flex; align-items: center; gap: 10px; }
.quick-game img { width: 72px; aspect-ratio: 460/215; object-fit: cover; border-radius: 7px; }
.quick-game div { min-width: 0; display: flex; flex-direction: column; }
.quick-game span { color: var(--acid); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.quick-game strong { max-width: 220px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.quick-actions { display: flex; gap: 6px; }
.quick-actions button { min-width: 34px; height: 34px; padding: 0 10px; color: #101214; border: 0; border-radius: 8px; cursor: pointer; font-weight: 900; transition: transform .15s; }
.quick-actions button:hover { transform: translateY(-2px); }
.quick-actions .rank-s { background: #ff9e3d; }
.quick-actions .rank-a { background: #cfff58; }
.quick-actions .rank-b { background: #5ee3c6; }
.quick-actions .rank-c { background: #6e91e8; }
.quick-actions .rank-d { background: #c67ad2; }
.quick-actions .rank-none { color: #a9adb1; background: #292c30; font-size: 9px; font-weight: 700; }
.quick-close { position: absolute; top: 50%; right: 14px; padding: 0; color: #777c81; background: transparent; border: 0; cursor: pointer; font-size: 24px; transform: translateY(-50%); }

.loading-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(7,8,9,.9);
  backdrop-filter: blur(12px);
}
.loading-overlay strong { margin-top: 20px; font-size: 16px; }
.loading-overlay span { margin-top: 6px; color: var(--muted); font-size: 11px; }
.loader-ring { width: 48px; height: 48px; border: 2px solid #292c30; border-top-color: var(--acid); border-radius: 50%; animation: spin .8s linear infinite; }

.toast {
  position: fixed;
  z-index: 120;
  top: 100px;
  left: 50%;
  max-width: min(520px, calc(100% - 30px));
  padding: 12px 16px;
  color: #111;
  background: var(--acid);
  border-radius: 10px;
  box-shadow: 0 16px 50px rgba(0,0,0,.4);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: #fff; background: #d95050; }

footer {
  width: min(1440px, calc(100% - 56px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #50555a;
  border-top: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: .1em;
}
footer span { color: #74797e; font-weight: 800; }
footer p { margin: 0; }

@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1040px) {
  .profile-strip { grid-template-columns: 1fr auto; }
  .profile-stats { order: 3; grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }
  .profile-stats div:first-child { border-left: 0; padding-left: 0; }
  .profile-actions { align-self: start; }
  .studio-layout { grid-template-columns: 270px minmax(0, 1fr); }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .tier-row { grid-template-columns: 92px minmax(0,1fr); }
  .tier-label strong { font-size: 44px; }
}

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 28px, 1440px); }
  .site-header { height: 72px; }
  .header-note { display: none; }
  .hero { min-height: calc(100vh - 72px); padding: 62px 0 36px; }
  .hero h1 { font-size: clamp(48px, 16vw, 82px); line-height: .86; }
  .hero-copy { margin-top: 30px; font-size: 14px; }
  .input-shell { padding: 10px; flex-wrap: wrap; }
  .input-shell > svg { margin-left: 5px; }
  .input-shell input { min-height: 42px; }
  .primary-button { width: 100%; justify-content: center; }
  .form-meta { display: none; }
  .hero-proof { margin-top: 42px; }
  .hero-proof span { font-size: 8px; }
  .workspace { padding-top: 18px; }
  .profile-strip { grid-template-columns: 1fr; gap: 18px; }
  .profile-actions { justify-content: flex-start; }
  .profile-stats { order: initial; grid-column: auto; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .profile-stats div { min-width: 0; flex: 1; padding: 0 13px; }
  .profile-stats div:first-child { padding-left: 0; border-left: 0; }
  .profile-stats div:last-child { border-right: 0; }
  .board-toolbar { margin-top: 38px; align-items: flex-start; gap: 18px; }
  .board-toolbar > div:first-child { align-items: flex-start; }
  .board-toolbar h2 { font-size: 19px; }
  .progress-wrap { width: 115px; flex: 0 0 auto; }
  .studio-layout { display: flex; flex-direction: column; }
  .library-panel { width: 100%; min-height: 0; }
  .library-grid { max-height: 360px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .tier-board { width: 100%; }
  .tier-row { min-height: 112px; grid-template-columns: 74px minmax(0, 1fr); }
  .tier-label strong { font-size: 38px; }
  .tier-label span { font-size: 6px; }
  .tier-dropzone { min-height: 110px; padding: 7px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .quick-rank { align-items: flex-start; flex-direction: column; gap: 10px; }
  .quick-actions { width: 100%; flex-wrap: wrap; }
  .quick-actions button { flex: 1; }
  .quick-actions .rank-none { flex-basis: 100%; }
  footer { align-items: flex-start; flex-direction: column; gap: 8px; line-height: 1.5; }
}

@media (max-width: 430px) {
  .brand { font-size: 11px; }
  .hero h1 { font-size: 50px; }
  .hero-proof strong { font-size: 17px; }
  .profile-actions { width: 100%; }
  .profile-actions button { flex: 1; }
  .board-toolbar { flex-direction: column; }
  .progress-wrap { width: 100%; }
  .tier-row { grid-template-columns: 58px minmax(0, 1fr); }
  .tier-label strong { font-size: 31px; }
  .tier-label span { display: none; }
  .game-grid, .tier-dropzone { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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