/* The pages for adding a server, signing in, the account area and moderation. Colors, radii and fonts come only from the theme variables (themes.css). */
.form-page { padding-block: 24px 40px; }
/* overflow-wrap is inherited: long addresses and emails wrap and do not cause horizontal scrolling */
.form-panel { max-width: 640px; margin-inline: auto; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; overflow-wrap: anywhere; }
.form-panel h1 { margin: 0; font-size: clamp(26px, 6vw, 32px); line-height: 1.15; }
.form-panel h2 { margin: 8px 0 0; font-size: 20px; line-height: 1.25; }
.form-panel p { margin: 0; }
/* The weight is set explicitly: the monospace font has only the 500 style, and in a heading the browser would draw a fake bold */
.form-panel code { padding: 2px 6px; font: 500 .9em var(--font-mono); background: var(--surface-2); border-radius: var(--radius-xs); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.form-panel h1 code { padding: 0; background: none; }
/* The user agreement and the data processing policy. Links lead to the sections, and in the dark theme the header lies over the page */
.form-panel.legal { max-width: 820px; }
.legal ul { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.legal :is(h2, h3) { scroll-margin-top: 112px; }
.legal-short { display: grid; gap: 10px; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-md); }
.legal-short h2 { margin: 0; }
/* Purpose of processing: labels on the left, above the text on a phone */
.legal-purpose { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.legal-purpose h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.legal-purpose dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; margin: 0; }
.legal-purpose dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.legal-purpose dd { margin: 0 0 8px; }
.legal-purpose dd:last-child { margin-bottom: 0; }
@media (min-width: 640px) {
  .legal-purpose dl { grid-template-columns: 110px minmax(0, 1fr); }
  .legal-purpose dt { padding-top: 1px; }
}

/* Fields */
.form-stack, .form-field, .form-endpoint { display: grid; grid-template-columns: minmax(0, 1fr); }
.form-stack { gap: 14px; }
.form-field { gap: 6px; }
/* A link on the label row, on the right («Забыли пароль?» on /login). In the markup it comes after the field, so the keyboard reaches it after the password */
.form-field.with-link { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: baseline; }
.form-field.with-link > .field-label { grid-area: 1 / 1; }
.form-field.with-link > input { grid-area: 2 / 1 / 3 / 3; }
.form-field.with-link > .field-link { grid-area: 1 / 2; font-size: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
/* Community links two per row: the hint in the Telegram field is long */
.form-row.form-links { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
:is(.form-panel, .mod-edit) input:not([type="radio"], [type="checkbox"], [type="hidden"]), :is(.form-panel, .mod-edit) textarea {
  display: block; width: 100%; min-height: 48px; padding: 10px 14px;
  font: 16px/1.4 var(--font-body); background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--field-edge); border-radius: var(--radius-md);
  -webkit-appearance: none; appearance: none;
}
:is(.form-panel, .mod-edit) textarea { resize: vertical; }
:is(.form-panel, .mod-edit) ::placeholder { color: var(--muted); opacity: 1; }
/* The focus outline (--focus, --focus-style) is set by the general :focus-visible rule in site.css */
:is(.form-panel, .mod-edit) :is(input, textarea):focus { border-color: var(--focus); }

/* Choice of options. The browser gives a fieldset a minimum width based on its content, which would cause scrolling */
.form-choice, .form-endpoint { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 12px; }
.form-choice legend { padding: 0; }
.form-choice label, .form-check { display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; }
:is(.form-panel, .mod-edit) :is([type="radio"], [type="checkbox"]) { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.form-endpoint { gap: 12px; padding: 4px 14px 14px; border: var(--divider-w) solid var(--line); border-radius: var(--radius-md); }
.form-endpoint legend { margin-inline-start: -6px; padding-inline: 6px; font-weight: 600; }
/* On the add page the desktop-only fields are hidden when a phone is chosen. The server does not read these fields for a phone */
.form-stack:has([name="PlatformCode"][value="bedrock"]:checked) .java-only { display: none; }

/* Buttons and messages */
.form-actions, .form-result { display: flex; flex-wrap: wrap; gap: 10px; }
.form-actions .btn { flex: 1 1 auto; }
.form-stack > .btn, .form-actions .btn { min-height: 48px; }
.form-result > p { flex-basis: 100%; }
.form-ok, .form-errors { margin: 0; padding: 10px 14px; font-weight: 500; border-radius: var(--radius-md); }
.form-ok { background: var(--done); color: var(--done-ink); }
.form-errors { display: grid; gap: 4px; list-style: none; background: var(--red); color: var(--on-red); }

/* Lists of servers and submissions */
.form-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
/* In the moderation queue the list can be empty and would add extra spacing */
.form-list:not(:has(li)) { display: none; }
.form-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.form-list li + li { padding-top: 12px; border-top: var(--divider-w) solid var(--line); }
/* The button stays on the right while there is enough room for the text beside it, otherwise it drops to the next line */
.form-list li > div { flex: 1 1 140px; }
.form-list .note { display: block; font-size: 14px; }

/* Found servers: the panel is wider than usual so the marks about the link to the owner fit on one line.
   The marks and the message draft take the full row width */
.form-panel.discovery-panel { max-width: 880px; }
.discovery-status { display: flex; flex-wrap: wrap; flex-basis: 100%; gap: 6px; }
.discovery-status .btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.discovery-letter { flex-basis: 100%; }
.discovery-letter textarea { display: block; width: calc(100% - 28px); margin: 0 14px 14px; font-size: 15px; }

.form-details { border: var(--divider-w) solid var(--line); border-radius: var(--radius-md); }
.form-details summary { padding: 12px 14px; font-weight: 600; cursor: pointer; border-radius: var(--radius-md); }
.form-details form { padding: 0 14px 14px; }

.form-art { display: block; max-width: 100%; max-height: 280px; border-radius: var(--radius-md); }

/* On a phone the main buttons are full width, on desktop they fit their label */
@media (min-width: 640px) {
  .form-panel { padding: 32px; }
  .form-panel > .btn, .form-stack > .btn { justify-self: start; min-width: 160px; }
  .form-actions .btn { flex: none; }
}

/* Like page */
.like-head { display: flex; align-items: center; gap: 14px; }
.like-head .ava { flex: none; width: 56px; height: 56px; }
.like-head .ava img { width: 100%; height: 100%; }
.like-count { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.like-submit { justify-self: start; gap: 8px; }
.like-panel .smart-captcha { min-height: 102px; }

/* Boost page: the term choice is a plain field like the others, without the fieldset frame; the options in one row, wrapping on a phone */
.boost-terms { display: flex; flex-wrap: wrap; column-gap: 24px; min-width: 0; margin: 0; padding: 0; border: 0; }
.boost-terms > legend { margin-bottom: 2px; padding: 0; }
.boost-terms .form-check { min-height: 44px; }

/* Sign-in via Yandex ID and VK ID above the email form */
.external-logins { flex-direction: column; }
.external-logins .btn { min-height: 48px; gap: 10px; }
/* The service mark: a white sign on a tile of the service color, as on the community buttons */
.external-login[data-provider]::before { content: ""; flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--ext-icon) center / 18px no-repeat, var(--ext-tile); }
:is(.external-login, .signin-method)[data-provider="yandex"] { --ext-tile: #fc3f1d; --ext-icon: url("../img/social/yandex.svg"); }
:is(.external-login, .signin-method)[data-provider="vk"] { --ext-tile: #0077ff; --ext-icon: url("../img/social/vk.svg"); }
.form-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.form-or::before, .form-or::after { content: ""; flex: 1; border-top: var(--divider-w) solid var(--line); }
/* Sign-in methods on the account page: the same service tiles as on the sign-in buttons, the mail tile for email and password */
.signin-method { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; align-items: center; }
.signin-method::before { content: ""; grid-row: span 2; width: 32px; height: 32px; border-radius: 9px; background: var(--ext-icon) center / 22px no-repeat, var(--ext-tile); }
.signin-method[data-provider="email"] { --ext-tile: var(--accent); --ext-icon: url("../img/social/mail.svg"); }

/* Account page (/account): separate blocks. On a computer the servers, sign-in methods and deletion on the left, the points
   on the right; on a phone one column in the order head, servers, points, sign-in methods, deletion */
.account-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.account-page .form-panel { max-width: none; margin: 0; }
.account-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; overflow-wrap: anywhere; }
.account-avatar { flex: none; width: 56px; height: 56px; object-fit: contain; }
.account-who { display: grid; gap: 8px; min-width: 0; }
.account-head h1 { margin: 0; font-size: clamp(20px, 5.4vw, 28px); line-height: 1.2; }
.account-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.account-meta span { padding: 2px 10px; font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-pill); }

.account-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.account-col { display: contents; }
.account-servers { order: 1; }
.account-points { order: 2; }
.account-signin { order: 3; }
.account-delete { order: 4; }
.account-block h2 { margin: 0; }
.account-block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.account-page .account-delete { padding: 0; }
.account-delete .form-details { background: var(--surface); }

/* Rows of servers, spendings and sign-in methods: the icon, the name with a line under it, the button or the points on the right */
.account-rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.account-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; background: var(--surface); border: var(--divider-w) solid var(--line); border-radius: var(--radius-md); }
.account-row > .signin-method { flex: 1 1 auto; min-width: 0; }
.account-row .note { display: block; font-size: 14px; }
.account-row :is(.btn, form) { flex: none; }
.account-row .btn { padding-inline: 14px; }
.account-icon { flex: none; width: 44px; height: 44px; overflow: hidden; border-radius: var(--radius-sm); }
.account-icon :is(img, svg) { display: block; width: 100%; height: 100%; image-rendering: pixelated; shape-rendering: crispEdges; }
.is-hidden .account-icon { filter: grayscale(1); opacity: .55; }
.account-row-text { display: grid; flex: 1 1 auto; gap: 4px; justify-items: start; min-width: 0; }
/* Names break between words; only a word longer than the row breaks inside */
.account-row-name { font-weight: 700; line-height: 1.3; overflow-wrap: break-word; }
.account-row-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; color: var(--muted); }
.account-tag { padding: 1px 8px; overflow-wrap: normal; font-size: 13px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border-radius: var(--radius-pill); }
.account-empty { display: grid; gap: 14px; justify-items: start; padding: 18px; border: 1.5px dashed var(--line); border-radius: var(--radius-md); }
.account-empty p { color: var(--muted); }

/* Points: the balance as a big number, the spendings as rows with «+N баллов» on the right */
.points-card { display: grid; gap: 6px; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-md); }
.points-balance { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 18px; font-weight: 700; }
.points-num { font: 800 56px/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--accent-text); }
.points-weekly { color: var(--muted); font-size: 15px; }
.points-pill { flex: none; padding: 3px 10px; font-size: 14px; font-weight: 700; white-space: nowrap; color: var(--accent-text); background: var(--accent-soft); border-radius: var(--radius-pill); }
/* The share of a spending's term that is left. <progress> needs its own pseudo-elements in Chrome and Safari and in Firefox */
.boost-bar { display: block; justify-self: stretch; width: 100%; height: 6px; margin: 4px 0 2px; overflow: hidden; color: var(--accent); background: var(--xp-track); border: 0; border-radius: var(--radius-pill); -webkit-appearance: none; appearance: none; }
.boost-bar::-webkit-progress-bar { background: var(--xp-track); border-radius: var(--radius-pill); }
.boost-bar::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
.boost-bar::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-pill); }
.boost-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; justify-self: stretch; font-size: 14px; color: var(--muted); }
/* The points block stands out from the others: an accent frame and a tint at the top */
.account-page .account-points { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 180px); }
.account-sub { margin: 4px 0 -4px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.account-hint { color: var(--muted); font-size: 15px; }

@media (min-width: 640px) {
  .account-head { gap: 20px; padding: 24px 32px; }
  .account-avatar { width: 72px; height: 72px; }
  .account-icon { width: 48px; height: 48px; }
}
@media (min-width: 960px) {
  .account-page, .account-cols { gap: 20px; }
  .account-cols { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
  .account-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .account-points { padding: 28px; }
}

/* /admin: all active spendings of points, admin only (docs/points.md) */
.boost-admin-list li { align-items: center; }
.boost-admin-icon { flex: none; width: 40px; height: 40px; }
.boost-admin-icon img { width: 100%; height: 100%; }
