/* The Great GatsBI Party — стиль по дизайн-системе СА (ар-деко 1920-х) */

@font-face { font-family: "Great Gatsby Two"; src: url("/assets/fonts/GreatGatsbyTwo.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/Montserrat-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/Montserrat-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/Montserrat-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/assets/fonts/Montserrat-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --burgundy-950: #3B0F12;
  --burgundy-tonal: #4A1518;
  --burgundy-900: #5A1A1C;
  --burgundy-700: #7A2A2A;
  --emerald-950: #13281F;
  --emerald-tonal: #1A3428;
  --emerald-800: #1F3D2F;
  --ink-950: #120B0A;
  --gold-500: #C9A35E;
  --gold-300: #E3C98A;
  --cream-100: #EFE3C8;

  --font-display: "Great Gatsby Two", "Montserrat", serif;
  --font-body: "Montserrat", system-ui, sans-serif;
  --line: 2px;
  --gap: 10px; /* зазор двойной рамки */
  --logo: 128px;
  color-scheme: dark;
}
@media (min-width: 760px) { :root { --logo: 184px; } }

* { box-sizing: border-box; }
html { background: var(--burgundy-950); }
body {
  margin: 0; min-height: 100vh; position: relative;
  background: var(--burgundy-950); color: var(--cream-100);
  font: 400 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* Слои: Фон → Узор → … → Логотип → Зерно */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/img/arches.svg") center bottom / cover no-repeat; }
body::after { content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: url("/assets/img/grain.webp") 0 0 / 256px 256px repeat; }

.logo { position: absolute; left: 0; top: 0; width: var(--logo); height: auto; display: block; z-index: 10; }

.topbar {
  position: relative; z-index: 6; display: flex; justify-content: flex-end;
  padding: 16px 16px 0 calc(var(--logo) + 8px); min-height: calc(var(--logo) * 0.85);
}
.who { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; align-items: baseline;
  font-size: 13px; font-weight: 500; letter-spacing: .06em; text-align: right; }
.who .mail { color: var(--cream-100); opacity: .85; word-break: break-all; }
.who a, .linklike {
  color: var(--gold-500); background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; text-decoration: none; cursor: pointer;
}
.who a:hover, .linklike:hover { color: var(--gold-300); }

.wrap { max-width: 760px; margin: 0 auto; padding: 8px 16px 96px; position: relative; }
.wrap.wide { max-width: 1040px; }
.wrap.mid { max-width: 920px; }

/* ---- Типографика ---- */
.display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; margin: 0; }
h1.display { font-size: clamp(40px, 9vw, 72px); }
h2.display { font-size: clamp(28px, 6vw, 44px); }
h3.display { font-size: clamp(22px, 4.6vw, 30px); }
.eyebrow { font-weight: 500; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-500); line-height: 1.3; }
.event { font-weight: 500; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--cream-100); }
.event b { color: var(--gold-500); font-weight: 500; }
.body-text { font-size: 16px; line-height: 1.5; margin: 0; }
.muted { opacity: .75; font-size: 14px; }
.gold { color: var(--gold-500); }
.center { text-align: center; }

.hero { text-align: center; margin: 8px 0 32px; }
.hero > * + * { margin-top: 12px; }
.hero .lead { max-width: 560px; margin: 16px auto 0; text-align: left; }
.divider { display: block; width: min(320px, 80%); height: auto; margin: 16px auto; }

/* ---- Рамки ---- */
.frame {
  position: relative; background: var(--burgundy-950);
  border: var(--line) solid var(--gold-500);
  outline: var(--line) solid var(--gold-500); outline-offset: calc(-1 * (var(--gap) + var(--line) * 2));
  padding: 32px 24px;
}
.frame.emerald { background: var(--emerald-950); }
.frame.paper { background: var(--cream-100); color: var(--burgundy-950); }
@media (min-width: 760px) { .frame { padding: 48px 56px; } }

.corner { position: absolute; width: 56px; height: 56px; pointer-events: none;
  background: url("/assets/img/corner.svg") 0 0 / 100% 100% no-repeat; }
.corner.tl { left: 6px; top: 6px; }
.corner.tr { right: 6px; top: 6px; transform: scaleX(-1); }
.corner.bl { left: 6px; bottom: 6px; transform: scaleY(-1); }
.corner.br { right: 6px; bottom: 6px; transform: scale(-1, -1); }

/* ---- Формы ---- */
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.centered { justify-content: center; }

label.field { display: block; }
label.field > span { display: block; margin-bottom: 8px; }
input[type="email"], input[type="text"], textarea, input.code {
  width: 100%; padding: 14px 16px; border-radius: 0;
  border: var(--line) solid var(--burgundy-700); background: var(--ink-950);
  color: var(--cream-100); font: 500 16px/1.4 var(--font-body);
}
input::placeholder, textarea::placeholder { color: var(--cream-100); opacity: .4; }
input:focus, textarea:focus { outline: none; border-color: var(--gold-500); }
textarea { min-height: 96px; resize: vertical; }
input.code { font-family: var(--font-display); font-size: 32px; letter-spacing: .3em; text-align: center; padding: 12px; }
input[type="file"] { color: var(--cream-100); font: 400 13px var(--font-body); max-width: 100%; }
input[type="file"]::file-selector-button {
  border: var(--line) solid var(--gold-500); background: transparent; color: var(--gold-500);
  font: 600 12px var(--font-body); letter-spacing: .12em; text-transform: uppercase; padding: 8px 12px; margin-right: 12px; cursor: pointer;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 28px; border-radius: 0;
  border: var(--line) solid var(--gold-500); background: transparent; color: var(--cream-100);
  font: 600 14px/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--burgundy-900); }
.btn.primary { background: var(--gold-500); color: var(--burgundy-950); }
.btn.primary:hover { background: var(--gold-300); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 12px; }
.btn.danger { border-color: var(--burgundy-700); color: var(--cream-100); }
.btn.block { width: 100%; }

.msg { padding: 14px 18px; font-size: 15px; border: var(--line) solid var(--gold-500); background: var(--emerald-950); }
.msg.error { border-color: var(--burgundy-700); background: var(--burgundy-900); }
.msg.ok::before, .msg.info::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 12px 2px 2px;
  background: var(--gold-500); transform: rotate(45deg);
}
.hidden { display: none !important; }

/* ---- Иллюстрация в арке ---- */
.arch {
  position: relative; display: block; overflow: hidden;
  border: var(--line) solid var(--gold-500); border-radius: 999px 999px 0 0;
  outline: var(--line) solid var(--gold-500); outline-offset: calc(-1 * (var(--gap) + var(--line) * 2));
  background: var(--emerald-800);
}
.arch img { display: block; width: 100%; height: 100%; object-fit: cover; }
.arch::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(18,11,10,0) 55%, rgba(18,11,10,.6) 100%); }

/* ---- Вход ---- */
.login { display: grid; gap: 32px; align-items: center; }
.login .arch { width: min(240px, 64vw); aspect-ratio: 508 / 640; margin: 0 auto; }
@media (min-width: 760px) {
  .login { grid-template-columns: 300px 1fr; gap: 48px; }
  .login .arch { width: 300px; }
}

/* ---- Прогресс ---- */
.progress-box { text-align: center; }
.numeral { font-family: var(--font-display); color: var(--gold-300); font-size: 56px; line-height: 1; }
.numeral small { font-size: .5em; color: var(--gold-500); }
.progress { height: var(--line); background: var(--burgundy-700); margin: 16px auto 0; max-width: 360px; }
.progress > div { height: 100%; background: var(--gold-500); transition: width .4s; }

/* ---- Список номинаций ---- */
.section { margin-top: 48px; }
.section-head { text-align: center; margin-bottom: 24px; }
.section-head .divider { margin: 12px auto 0; width: 220px; }
.nom-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.nom-item {
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px; min-height: 120px;
  padding: 20px; border: var(--line) solid var(--gold-500); background: var(--burgundy-950);
  color: var(--cream-100); text-decoration: none;
}
.frame.emerald .nom-item { background: var(--emerald-950); }
a.nom-item:hover { background: var(--burgundy-900); }
.frame.emerald a.nom-item:hover { background: var(--emerald-800); }
.nom-item .t { font-family: var(--font-display); text-transform: uppercase; font-size: 22px; line-height: 1.15; }
.nom-item.done { border-color: var(--burgundy-700); }
.frame.emerald .nom-item.done { border-color: var(--emerald-800); }
.nom-item.wait { opacity: .55; border-style: dashed; }
@media (max-width: 560px) {
  .nom-list { gap: 12px; }
  .nom-item { min-height: 0; padding: 16px 18px; gap: 12px; }
  .section.frame { padding: 28px 16px; }
}
.status { display: flex; align-items: center; gap: 10px; }
.status::before { content: ""; width: 8px; height: 8px; flex: none; border: var(--line) solid var(--gold-500); transform: rotate(45deg); }
.nom-item.done .status::before { background: var(--gold-500); }

.thanks { text-align: center; }
.thanks .arch { width: 200px; aspect-ratio: 476 / 610; margin: 0 auto 24px; }

/* ---- Ранжирование ---- */
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rank-item {
  display: grid; grid-template-columns: 64px 152px 1fr auto; gap: 20px; align-items: center;
  padding: 20px 20px; border: var(--line) solid var(--burgundy-700); background: var(--burgundy-950);
  user-select: none; -webkit-user-select: none;
}
.rank-list.sortable .rank-item { cursor: grab; }
.rank-item:first-child { border-color: var(--gold-500); }
.rank-item.sortable-ghost { opacity: .3; }
.rank-item.sortable-chosen { border-color: var(--gold-300); background: var(--burgundy-900); }

.mark { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.mark svg { position: absolute; inset: 0; }
.mark b { position: relative; font-family: var(--font-display); font-weight: 400; font-size: 20px; padding-top: 2px; }
.rank-item:first-child .mark b { color: var(--gold-300); }

.photo {
  position: relative; width: 80px; height: 80px; overflow: hidden; border-radius: 50%;
  border: var(--line) solid var(--gold-500); background: var(--emerald-800);
  box-shadow: 0 0 0 4px var(--burgundy-950), 0 0 0 6px var(--gold-500);
  margin: 6px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 24px; color: var(--gold-500);
}
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo::before { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(90,26,28,.22); }
.photo::after { content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(ellipse at 50% 45%, rgba(18,11,10,0) 55%, rgba(18,11,10,.6) 100%); }

.info { min-width: 0; }
.rank-item .photo { width: 140px; height: 140px; font-size: 40px; }
.info .name { font-weight: 600; font-size: 19px; line-height: 1.3; }
.info .desc { opacity: .85; font-size: 15px; line-height: 1.5; margin-top: 8px; white-space: pre-line; cursor: pointer; }
.info .desc.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

.moves { display: flex; flex-direction: column; gap: 8px; }
.moves button {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 0; padding: 0;
  border: var(--line) solid var(--gold-500); background: transparent; cursor: pointer;
}
.moves button:hover { background: var(--burgundy-900); }
.moves button:disabled { opacity: .25; cursor: default; background: transparent; }
.moves svg { width: 16px; height: 16px; }

@media (max-width: 560px) {
  /* На телефоне: номер, фото и стрелки сверху, текст на всю ширину снизу */
  .rank-item { grid-template-columns: 44px 1fr auto; grid-template-areas: "mark photo moves" "info info info";
    gap: 12px; padding: 14px; }
  .rank-item .mark { grid-area: mark; width: 44px; height: 44px; }
  .rank-item .photo { grid-area: photo; justify-self: center; width: 132px; height: 132px; font-size: 36px; }
  .rank-item .info { grid-area: info; text-align: center; }
  .rank-item > .moves, .rank-item > div:last-child:empty { grid-area: moves; }
  .mark b { font-size: 16px; }
  .info .name { font-size: 17px; }
  .info .desc { font-size: 14px; }
  .moves button { width: 40px; height: 40px; }
}

.actions { margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.actions .btn { min-width: min(320px, 100%); }

/* ---- Диалог ---- */
dialog {
  border: var(--line) solid var(--gold-500); border-radius: 0;
  outline: var(--line) solid var(--gold-500); outline-offset: calc(-1 * (var(--gap) + var(--line) * 2));
  background: var(--burgundy-950); color: var(--cream-100);
  padding: 32px 24px; width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(18,11,10,.75); }
dialog ol { padding: 0; margin: 20px 0 24px; list-style: none; counter-reset: n; }
dialog li { counter-increment: n; display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--burgundy-700); }
dialog li::before { content: "0" counter(n); font-family: var(--font-display); color: var(--gold-500); min-width: 32px; }
dialog li span { flex: 1; font-weight: 500; }

/* ---- Админка ---- */
.tabs { display: flex; gap: 12px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.tabs .btn.active { background: var(--gold-500); color: var(--burgundy-950); }

.admin-bar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding: 20px 24px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.switch input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border: var(--line) solid var(--gold-500); background: transparent; cursor: pointer; display: grid; place-items: center; }
.switch input:checked::before { content: ""; width: 8px; height: 8px; background: var(--gold-500); transform: rotate(45deg); }

.res-block { margin-top: 40px; }
.res-block .head { text-align: center; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--burgundy-700); text-align: left; }
th { color: var(--gold-500); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.pos { font-family: var(--font-display); color: var(--gold-500); width: 48px; }
tr.winner td { color: var(--gold-300); font-weight: 600; }
tr.winner td.pos { color: var(--gold-300); }
.table-scroll { overflow-x: auto; }

.nominee-edit { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--burgundy-700); }
.nominee-edit:first-child { border-top: 0; padding-top: 0; }
.nominee-edit .fields > * + * { margin-top: 10px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }

/* ---- Категории ---- */
.nom-desc { max-width: 600px; margin: 16px auto 0; text-align: center; font-size: 16px; line-height: 1.55; opacity: .9; }
.nom-desc:empty { display: none; }
.done-block .nom-desc { margin-bottom: 20px; }
.category { margin-top: 32px; }
.category:first-child { margin-top: 0; }
.nom-names { list-style: none; margin: 0 auto; padding: 24px 24px; max-width: 400px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  border: 1px solid var(--gold-500); outline: 1px solid var(--gold-500); outline-offset: -7px; }
.nom-names li { font-weight: 500; font-size: 16px; }
.nom-names li.major { font-weight: 700; color: var(--gold-300); }
.nom-names li.major:first-of-type, .nom-names li:not(.major) + li.major { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--gold-500); }
.nom-names li.major + li.major { margin-top: 0; padding-top: 0; border-top: 0; }
.category-action { margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.category-action .btn { min-width: min(280px, 100%); }
.status.done-mark::before { background: var(--gold-500); }

/* ---- Шаги ---- */
.steps { display: flex; justify-content: center; gap: 8px; }
.steps span { width: 10px; height: 10px; border: var(--line) solid var(--gold-500); transform: rotate(45deg); }
.steps span.past { background: var(--gold-500); }
.steps span.now { background: var(--gold-300); border-color: var(--gold-300); width: 12px; height: 12px; }

/* ---- Сводка в подтверждении ---- */
.summary { max-height: 55vh; overflow-y: auto; margin: 20px 0 24px; padding-right: 4px; }
.summary-item + .summary-item { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--burgundy-700); }
dialog .summary ol { margin: 8px 0 0; }
dialog .summary li { padding: 4px 0; border: 0; font-size: 15px; justify-content: flex-start; gap: 12px; }

.done-block { margin-top: 40px; }
.done-block h3 { margin-bottom: 16px; }
