:root {
  --accent-light: #84dee1;
  --accent-lighter: #c1eff0;
  --accent: teal;
  --accent-dark: #066;
  --accent-darker: #044;
  --button-shadow-light: #0aab;
  --button-shadow-dark: #055b;
  --button-shadow-size: 3px;
  --button-highlight-size: 2px;
  --input-border-width: 2px;
  --font-family: monospace;
}

* {
  box-sizing: border-box;
}

html {
  background-color: black;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  color: white;
  line-height: 1.2;
  font-family: var(--font-family);
  font-size: 1rem;
}

code {
  background-color: var(--accent-darker);
}

h1 {
  font-family: var(--font-family);
}

hr {
  border: none;
  border-top: 2px solid var(--accent-light);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  font-weight: bold;
  white-space: nowrap;
}

td:not(:last-child) {
  padding-right: 0.5rem;
}

thead tr > td, tbody tr:not(:last-child) > td {
  padding-bottom: 0.5rem;
}

td:last-child {
  text-align: right;
}

a {
  color: var(--accent-lighter);
}

a:visited {
  color: var(--accent-light);
}

.header-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  white-space: nowrap;
}

.divider {
  display: flex;
  align-items: center;
  padding: 5px 0;
  gap: 0.5em;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid white;
}
.openid-logo {
  height: 3rem;
  vertical-align: middle;
}

.logo {
  font-family: Arial, sans-serif;
  color: white;
  text-decoration: none;
  font-size: 2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.1em;
}

.logo:visited {
  color: white;
}

.logo > img {
  width: 1em;
  height: 1em;
}

.honeypot {
  display: none;
}

input {
  font-family: var(--font-family);
}

summary {
  cursor: pointer;
}

input {
  color: white;
  accent-color: var(--accent);
}

input:disabled {
  color: gray;
  filter: grayscale(100%);
}

input[type="text"],
input[type="number"],
input[type="password"] {
  width: 20em;
  margin: 0.5em 0;
  background-color: black;
  padding: 0.5em;
  border: var(--input-border-width) solid var(--accent);
}

input.long {
  width: 34em;
}

@media (max-width: 600px) {
  input[type="text"]:not([hidden]),
  input[type="number"]:not([hidden]),
  input[type="password"]:not([hidden]),
  input.long:not([hidden]) {
    display: block;
    width: 100%;
  }
}

input[type="number"] {
  width: 5rem;
}

input[type="checkbox"]:not(:disabled),
input[type="radio"]:not(:disabled) {
  cursor: pointer;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: white;
  opacity: 0.75;
}

button,
input[type="submit"],
input[type="file"]::file-selector-button {
  margin: 0.5em var(--button-highlight-size);
  font-family: var(--font-family);
  background-color: var(--accent);
  display: inline-block;
  color: white;
  padding: 0.4em 1em;
  border: none;
  box-shadow:
    0 var(--button-shadow-size) 0 0 var(--button-shadow-light) inset,
    var(--button-shadow-size) 0 0 0 var(--button-shadow-light) inset,
    0 calc(-1 * var(--button-shadow-size)) 0 0 var(--button-shadow-dark) inset,
    calc(-1 * var(--button-shadow-size)) 0 0 0 var(--button-shadow-dark) inset,
    0 0 0 var(--button-highlight-size) black;
}

input[type="file"]::file-selector-button {
  margin-right: 0.5em;
}

button:not(:disabled):hover,
input[type="submit"]:not(:disabled):hover,
input[type="file"]:not(:disabled)::file-selector-button:hover {
  box-shadow:
    0 var(--button-shadow-size) 0 0 var(--button-shadow-light) inset,
    var(--button-shadow-size) 0 0 0 var(--button-shadow-light) inset,
    0 calc(-1 * var(--button-shadow-size)) 0 0 var(--button-shadow-dark) inset,
    calc(-1 * var(--button-shadow-size)) 0 0 0 var(--button-shadow-dark) inset,
    0 0 0 var(--button-highlight-size) var(--accent-light);
}

button:not(:disabled):active,
input[type="submit"]:not(:disabled):active,
input[type="file"]:not(:disabled)::file-selector-button:active {
  box-shadow:
    0 var(--button-shadow-size) 0 0 var(--button-shadow-dark) inset,
    var(--button-shadow-size) 0 0 0 var(--button-shadow-dark) inset,
    0 calc(-1 * var(--button-shadow-size)) 0 0 var(--button-shadow-light) inset,
    calc(-1 * var(--button-shadow-size)) 0 0 0 var(--button-shadow-light) inset,
    0 0 0 var(--button-highlight-size) var(--accent-light);
}

button:not(:disabled),
input[type="submit"]:not(:disabled),
input[type="file"]:not(:disabled)::file-selector-button {
  cursor: pointer;
}

select {
  font-family: var(--font-family);
  margin: 0.3em 0;
  background-color: black;
  color: white;
  padding: 0.5em;
  border: none;
  border: var(--input-border-width) solid var(--accent);
}

select:not(:disabled) {
  cursor: pointer;
}

fieldset {
  border: var(--input-border-width) solid var(--accent);
}

.svg-defs {
  width: 0;
  height: 0;
  position: absolute;
}

#background {
  z-index: -1;
  position: fixed;
  inset: 0;
  view-transition-name: background;
}

#content {
  max-width: 800px;
  padding: 1em;
  margin: auto;
}

pre {
  border-left: 2px solid var(--accent-light);
  padding-left: 0.5em;
}

.success-message {
  color: lime;
}

.warning-message {
  color: orange;
}

.error-message {
  color: lightcoral;
}

#skin-container {
  text-align: center;
}

#skin-canvas {
  display: inline-block;
}

.texture-preview {
  width: 256px;
  image-rendering: pixelated;
}

.small-texture-preview {
  width: 64px;
  image-rendering: pixelated;
}

.noscript-hidden {
  display: none !important;
}

.list-profile-picture {
  --list-profile-picture-size: 24px;
  width: var(--list-profile-picture-size);
  height: var(--list-profile-picture-size);
  position: relative;
}

.list-profile-picture-back,
.list-profile-picture-body,
.list-profile-picture-front {
  width: 100%;
  height: 100%;
  position: absolute;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-image: var(--list-profile-picture-image);
  background-position-y: calc(-1 * var(--list-profile-picture-size));
  background-size: calc(8 * var(--list-profile-picture-size)),
    calc(8 * var(--list-profile-picture-size));
}

.list-profile-picture-back {
  background-position-x: calc(-7 * var(--list-profile-picture-size));
}

.list-profile-picture-body {
  transform: scale(0.92);
  background-position-x: calc(-1 * var(--list-profile-picture-size));
}

.list-profile-picture-front {
  background-position-x: calc(-5 * var(--list-profile-picture-size));
}
:root {
  --hue-primary: hsl(270, 35%, 65%);
  --hue-light: hsl(270, 30%, 75%);
  --hue-dark: hsl(270, 25%, 55%);
  --hue-glow: hsla(270, 30%, 60%, 0.25);
  --hue-glow-strong: hsla(270, 35%, 65%, 0.4);
  --hue-bg-dark: #1a1a1f;
  --hue-bg-medium: #252529;
  --hue-bg-light: #2f2f35;
  --hue-text: #e0e0e5;
  --hue-muted: #9898a0;
  --hue-faint: #6a6a75;
  --accent-light: var(--hue-light);
  --accent-lighter: var(--hue-light);
  --accent: var(--hue-primary);
  --accent-dark: var(--hue-dark);
  --accent-darker: #38343f;
  --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --hue-line: rgba(255, 255, 255, 0.06);
}

html {
  background: linear-gradient(145deg, var(--hue-bg-dark) 0%, var(--hue-bg-medium) 50%, var(--hue-bg-light) 100%) fixed;
}

body {
  background: transparent;
  color: var(--hue-text);
  line-height: 1.5;
  min-height: 100vh;
}

#background {
  overflow: hidden;
  pointer-events: none;
  opacity: 0.35;
}

#background::before,
#background::after,
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(12px);
  pointer-events: none;
  z-index: -1;
}

#background::before {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, hsl(270, 55%, 58%) 0%, transparent 70%);
  animation: hue-wander1 48s ease-in-out infinite;
}

#background::after {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, hsl(270, 55%, 58%) 0%, transparent 70%);
  animation: hue-wander2 62s ease-in-out infinite;
}

body::before {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, hsl(270, 55%, 58%) 0%, transparent 70%);
  opacity: 0.35;
  animation: hue-wander3 40s ease-in-out infinite;
}

body::after {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, hsl(270, 55%, 58%) 0%, transparent 70%);
  opacity: 0.35;
  animation: hue-wander4 72s ease-in-out infinite;
}

@keyframes hue-wander1 {
  0%, 100% { top: -10%; left: -5%; transform: scale(1); }
  25% { top: 20%; left: 15%; transform: scale(1.1); }
  50% { top: 10%; left: 60%; transform: scale(0.9); }
  75% { top: -5%; left: 40%; transform: scale(1.15); }
}
@keyframes hue-wander2 {
  0%, 100% { top: 75%; left: 80%; transform: scale(1); }
  33% { top: 40%; left: 55%; transform: scale(1.2); }
  66% { top: 20%; left: 15%; transform: scale(0.8); }
}
@keyframes hue-wander3 {
  0%, 100% { top: 40%; left: 5%; transform: scale(1); }
  20% { top: 60%; left: 30%; transform: scale(1.3); }
  40% { top: 20%; left: 50%; transform: scale(0.7); }
  60% { top: 70%; left: 70%; transform: scale(1.1); }
  80% { top: 30%; left: 80%; transform: scale(0.9); }
}
@keyframes hue-wander4 {
  0%, 100% { top: 80%; left: 20%; transform: scale(1); }
  50% { top: 10%; left: 80%; transform: scale(1.4); }
}
@keyframes hue-pulse {
  0%, 100% { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.45), 0 15px 60px var(--hue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -3px 6px rgba(0, 0, 0, 0.3); transform: translateY(0); }
  50% { box-shadow: 0 26px 50px rgba(0, 0, 0, 0.6), 0 10px 20px rgba(0, 0, 0, 0.45), 0 20px 80px var(--hue-glow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -3px 6px rgba(0, 0, 0, 0.3); transform: translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  #background::before, #background::after, body::before, body::after, .logo > img { animation: none !important; }
}

#content {
  max-width: 760px;
  padding: 2rem 1.25rem;
}

hr {
  border-top: 1px solid var(--hue-line);
  margin: 1.5rem 0;
}

a,
a:visited {
  color: var(--hue-light);
  text-underline-offset: 3px;
}

a:hover {
  color: #fff;
}

code,
pre {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

pre {
  border-left: none;
  padding: 0.75rem;
  overflow-x: auto;
}

.header-nav {
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--hue-line);
}

.logo,
.logo:visited,
.logo:hover {
  font-family: var(--font-family);
  font-size: 1.3rem;
  font-weight: 700;
  gap: 0.85rem;
  color: var(--hue-primary);
}

.logo > img {
  width: 3rem;
  height: 3rem;
  padding: 0.55rem;
  object-fit: contain;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--hue-bg-light) 0%, var(--hue-bg-medium) 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 6px 24px var(--hue-glow), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

input,
select {
  color: var(--hue-text);
  accent-color: var(--hue-primary);
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.8em 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select option {
  background: var(--hue-bg-medium);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--hue-primary);
  box-shadow: 0 0 0 3px var(--hue-glow);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--hue-faint);
  opacity: 1;
}

button,
.skin-control,
input[type="submit"],
input[type="file"]::file-selector-button {
  background: linear-gradient(145deg, var(--hue-primary) 0%, var(--hue-dark) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 0.75em 1.4em;
  font-weight: 600;
  box-shadow: 0 8px 25px var(--hue-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

button:not(:disabled):hover,
.skin-control:hover,
input[type="submit"]:not(:disabled):hover,
input[type="file"]:not(:disabled)::file-selector-button:hover {
  background: linear-gradient(145deg, var(--hue-light) 0%, var(--hue-primary) 100%);
  box-shadow: 0 12px 35px var(--hue-glow-strong);
  transform: translateY(-1px);
}

button:not(:disabled):active,
.skin-control:active,
input[type="submit"]:not(:disabled):active,
input[type="file"]:not(:disabled)::file-selector-button:active {
  box-shadow: 0 6px 18px var(--hue-glow);
  transform: none;
}

button:disabled,
input[type="submit"]:disabled {
  background: var(--hue-bg-light);
  color: var(--hue-faint);
  box-shadow: none;
}

fieldset {
  border: 1px solid var(--hue-line);
  border-radius: 14px;
}

.divider::before,
.divider::after {
  border-top-color: var(--hue-line);
}

.success-message { color: #8fd8a5; }
.warning-message { color: #e4b878; }
.error-message { color: #f08a8a; }

/* Страницы без входа: как приглашение HUEChat */
body:not(:has(a[href$="/web/user"])) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

#content:not(:has(a[href$="/web/user"])) {
  width: 100%;
  max-width: 460px;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  text-align: center;
}

#content:not(:has(a[href$="/web/user"])) .header-nav {
  display: contents;
}

#content:not(:has(a[href$="/web/user"])) .logo {
  order: 0;
  flex-direction: column;
  justify-content: center;
  font-size: 3rem;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

#content:not(:has(a[href$="/web/user"])) .logo > img {
  width: 120px;
  height: 120px;
  padding: 26px;
  border-radius: 28px;
  animation: hue-pulse 3s ease-in-out infinite;
}

#content:not(:has(a[href$="/web/user"])) > *:not(.header-nav),
#content:not(:has(a[href$="/web/user"])) .header-nav > div:last-child {
  order: 2;
  margin: 0;
  padding: 0.5rem 2.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 1px solid var(--hue-line);
  border-right: 1px solid var(--hue-line);
}

#content:not(:has(a[href$="/web/user"])) > h3:first-of-type {
  order: 1;
  padding: 2rem 2.5rem 1rem;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hue-faint);
  border-top: 1px solid var(--hue-line);
  border-radius: 20px 20px 0 0;
}

#content:not(:has(a[href$="/web/user"])) .header-nav > div:last-child {
  order: 3;
  padding: 0.75rem 2.5rem 2rem;
  border-bottom: 1px solid var(--hue-line);
  border-radius: 0 0 20px 20px;
  text-align: center !important;
}

#content:not(:has(a[href$="/web/user"])) .header-nav > div:last-child a {
  display: block;
  padding: 0.85em;
  border-radius: 12px;
  color: var(--hue-text);
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(145deg, var(--hue-bg-light) 0%, var(--hue-bg-medium) 100%);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#content:not(:has(a[href$="/web/user"])) > p {
  color: var(--hue-muted);
  font-size: 0.95rem;
}

#content:not(:has(a[href$="/web/user"])) > hr,
#content:not(:has(a[href$="/web/user"])) > small,
#content form[action$="/web/login"] ~ *:not(.header-nav) {
  display: none;
}

#content:not(:has(a[href$="/web/user"])) form input[type="text"],
#content:not(:has(a[href$="/web/user"])) form input[type="password"],
#content:not(:has(a[href$="/web/user"])) form input[type="submit"] {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
}

#content:not(:has(a[href$="/web/user"])) form input[type="submit"] {
  padding: 1em;
  margin: 1.25rem 0 0.25rem;
  font-size: 1rem;
}

/* Страницы аккаунта и администратора */
#content:has(a[href$="/web/user"]) {
  margin: 2rem auto;
  padding: 2rem 2.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hue-line);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#content:has(a[href$="/web/user"]) h3,
#content:has(a[href$="/web/user"]) h4 {
  margin: 1.75rem 0 0.75rem;
  color: var(--hue-text);
}

#content:has(a[href$="/web/user"]) label {
  color: var(--hue-muted);
}

#content:has(a[href$="/web/user"]) small {
  color: var(--hue-faint);
}

#content:has(a[href$="/web/user"]) .header-nav input[type="submit"] {
  margin: 0 0 0 0.75rem;
  padding: 0.5em 1em;
  background: linear-gradient(145deg, var(--hue-bg-light) 0%, var(--hue-bg-medium) 100%);
  color: var(--hue-text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

tbody tr:not(:last-child) > td {
  border-bottom: 1px solid var(--hue-line);
  padding-top: 0.5rem;
}

#content h1 {
  font-size: 1.6rem;
}

details summary {
  color: var(--hue-muted);
}

input.long {
  max-width: 100%;
}

#content:not(:has(a[href$="/web/user"])):not(:has(form[action$="/web/login"])) .header-nav > div:last-child a {
  display: none;
}

/* Таблица администратора шире обычной карточки */
#content:has(form[action*="/web/admin/"]) {
  max-width: 1000px;
}

#content:has(form[action*="/web/admin/"]) thead {
  white-space: normal;
}

/* Опасные действия отличаются от обычных кнопок */
form[action*="delete"] input[type="submit"],
input[type="submit"][form*="delete"] {
  background: rgba(240, 138, 138, 0.12);
  color: #f08a8a;
  box-shadow: none;
}

form[action*="delete"] input[type="submit"]:not(:disabled):hover,
input[type="submit"][form*="delete"]:not(:disabled):hover {
  background: rgba(240, 138, 138, 0.22);
  box-shadow: none;
}
