:root {
  color-scheme: dark;
  --bg: #100d18;
  --bg-raised: #1b1627;
  --surface: rgba(35, 29, 49, 0.94);
  --surface-soft: rgba(51, 43, 68, 0.72);
  --text: #f7f4ff;
  --text-muted: #bdb5ca;
  --purple: #8b6ed8;
  --purple-bright: #b59aff;
  --lavender: #dcd0ff;
  --green: #57d49b;
  --red: #ff7b8b;
  --yellow: #f6cf69;
  --border: rgba(220, 208, 255, 0.2);
  --focus: #f6cf69;
  --shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.38);
  --radius-sm: 0.65rem;
  --radius: 1rem;
  --radius-lg: 1.4rem;
  --content-width: 76rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  vertical-align: text-bottom;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 20rem;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(139, 110, 216, 0.23), transparent 28rem),
    radial-gradient(circle at 88% 78%, rgba(87, 212, 155, 0.1), transparent 24rem),
    linear-gradient(145deg, #100d18 0%, #171220 52%, #0d0b12 100%);
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10000;
  padding: 0.7rem 1rem;
  color: #171220;
  background: var(--focus);
  border-radius: var(--radius-sm);
  font-weight: 800;
  transform: translateY(-180%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: min(100%, calc(var(--content-width) + 3rem));
  min-height: 4.75rem;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand__mark {
  min-width: 3.5rem;
  padding: 0.42rem 0.58rem;
  color: #171220;
  background: var(--lavender);
  border: 0.18rem solid var(--purple);
  border-radius: 999px;
  box-shadow: inset 0 -0.2rem 0 rgba(70, 48, 118, 0.24);
  font-size: 0.78rem;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.08em;
}

.brand__title {
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.user-chip {
  max-width: min(50vw, 25rem);
  margin: 0;
  padding: 0.45rem 0.75rem;
  overflow: hidden;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip strong {
  color: var(--text);
  font-variant: all-small-caps;
  font-size: large;
  letter-spacing: 0.5px;
  padding-left: 10px;
  vertical-align: text-bottom;
}

.user-chip__label {
  padding: 0;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  transition: color 140ms ease;
}

.user-chip__label:hover {
  color: var(--text);
}

.user-chip.status-dot, .user-chip[data-status-label]{
  vertical-align: super;
}

.user-chip__label:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: 0.18rem;
}

[data-account-delete]{
  margin-right: 30px;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  display: inline-block;
  vertical-align: middle;
  border-radius: 50%;
}

.status-dot--available {
  background: var(--green);
}

.status-dot--away {
  background: #f0995f;
}

.status-dot--dnd {
  background: var(--red);
}

.status-dot--invisible {
  background: #6b6575;
}

.user-chip__label.status-text--available {
  color: var(--green);
}

.user-chip__label.status-text--away {
  color: #f0995f;
}

.user-chip__label.status-text--dnd {
  color: var(--red);
}

.user-chip__label.status-text--invisible {
  color: #a29bb0;
  vertical-align: text-bottom;
}

.status-menu {
  position: fixed;
  z-index: 10001;
  min-width: 11rem;
  padding: 0.4rem;
  display: grid;
  gap: 0.15rem;
  background: linear-gradient(145deg, var(--surface), rgba(27, 22, 39, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.status-menu__item {
  padding: 0.5rem 0.6rem;
  display: flex;
  align-items: center;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.status-menu__item:hover,
.status-menu__item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.status-menu__item:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: -0.18rem;
}

.status-menu__item--active {
  font-weight: 800;
}

.header-account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logout-icon {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #c98a52;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.logout-icon:hover:not(:disabled),
.logout-icon:focus-visible {
  color: #171220;
  background: #f0995f;
  border-color: #f0995f;
  box-shadow: 0 0.4rem 1rem rgba(240, 153, 95, 0.42);
  transform: scale(1.1) rotate(-8deg);
}

.logout-icon:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: 0.18rem;
}

.logout-icon:disabled {
  cursor: wait;
  opacity: 0.6;
}

.account-icon {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #4a9d94;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.account-icon:hover:not(:disabled),
.account-icon:focus-visible {
  color: #171220;
  background: #4fd1c5;
  border-color: #4fd1c5;
  box-shadow: 0 0.4rem 1rem rgba(79, 209, 197, 0.42);
  transform: scale(1.1) rotate(45deg);
}

.account-icon:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: 0.18rem;
}

.account-icon:disabled {
  cursor: wait;
  opacity: 0.6;
}

.config-icon {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #c66a94;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.config-icon:hover:not(:disabled),
.config-icon:focus-visible {
  color: #171220;
  background: #ec6bb8;
  border-color: #ec6bb8;
  box-shadow: 0 0.4rem 1rem rgba(236, 107, 184, 0.42);
  transform: scale(1.1) rotate(45deg);
}

.config-icon:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: 0.18rem;
}

.config-icon:disabled {
  cursor: wait;
  opacity: 0.6;
}

.import-dialog {
  width: min(calc(100% - 2rem), 32rem);
  max-height: calc(100% - 2rem);
  padding: 0;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
}

.import-dialog::backdrop {
  background: rgba(8, 6, 14, 0.72);
}

.import-form {
  padding: 1.5rem;
  overflow-y: auto;
  display: grid;
  gap: 1rem;
  background: linear-gradient(145deg, var(--surface), rgba(27, 22, 39, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.import-form h2 {
  margin: 0;
  font-size: 1.3rem;
}

.import-form__error {
  margin: 0;
  padding: 0.65rem 0.85rem;
  color: #ffe5e8;
  background: rgba(128, 31, 47, 0.46);
  border: 1px solid rgba(255, 123, 139, 0.72);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.import-form__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

.import-form__actions--split {
  justify-content: space-between;
}

.import-form__actions--split .import-form__actions {
  margin-top: 0;
}

.account-form {
  gap: 0.85rem;
}

.account-form__section {
  display: grid;
  gap: 0.85rem;
}

.account-form hr {
  width: 100%;
  height: 0;
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.account-form__section h3 {
  margin: 0;
  color: var(--lavender);
  font-size: 0.9rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.config-user-info {
  margin: 0;
  padding: 0.75rem 0.85rem;
  display: grid;
  gap: 0.5rem;
  background: rgba(8, 7, 12, 0.56);
  border: 1px solid rgba(220, 208, 255, 0.28);
  border-radius: var(--radius-sm);
}

.config-user-info div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.config-user-info dt {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.config-user-info dd {
  margin: 0;
  color: var(--text);
  font-size: 0.85rem;
  text-align: right;
}

.config-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.config-checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--purple-bright);
  cursor: pointer;
}

.config-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.main-content {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.25rem) 1.5rem clamp(2rem, 5vw, 4rem);
  flex: 1;
}

.main-content:focus {
  outline: none;
}

.site-footer {
  min-height: 3.5rem;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.noscript-message {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  color: #2a1b00;
  background: var(--yellow);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--purple-bright);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.panel {
  background: linear-gradient(145deg, var(--surface), rgba(27, 22, 39, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 0.42rem;
  justify-content: stretch;
}

.field label {
  color: var(--lavender);
  font-size: 0.9rem;
  font-weight: 750;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  background: rgba(8, 7, 12, 0.56);
  border: 1px solid rgba(220, 208, 255, 0.28);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.field input::placeholder {
  color: #8e869b;
}

.field input:hover,
.field select:hover {
  border-color: rgba(220, 208, 255, 0.48);
}

.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 0.2rem rgba(246, 207, 105, 0.2);
  background: rgba(8, 7, 12, 0.76);
}

.field input:user-invalid {
  border-color: var(--red);
}

.field select {
  cursor: pointer;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 6rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  color: var(--lavender);
  background: rgba(139, 110, 216, 0.15);
  border: 0;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.field__help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-0.1rem);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:focus-visible,
.brand:focus-visible,
.game-card__link:focus-visible,
.game-card__edit:focus-visible,
.password-toggle:focus-visible {
  outline: 0.18rem solid var(--focus);
  outline-offset: 0.18rem;
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.button--primary {
  color: #171220;
  background: var(--lavender);
  border-color: var(--lavender);
  box-shadow: 0 0.5rem 1.4rem rgba(139, 110, 216, 0.22);
}

.button--primary:hover:not(:disabled) {
  background: #eee8ff;
  box-shadow: 0 0.7rem 1.8rem rgba(139, 110, 216, 0.34);
}

.button--secondary {
  color: var(--text);
  background: var(--purple);
  border-color: var(--purple-bright);
}

.button--secondary:hover:not(:disabled) {
  background: #9d7fe8;
}

.button--quiet {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.button--quiet:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(220, 208, 255, 0.42);
}

.button--danger {
  align-self: flex-start;
  color: #ffe5e8;
  background: rgba(128, 31, 47, 0.46);
  border-color: rgba(255, 123, 139, 0.72);
  margin-right: 30px;
}

.button--danger:hover:not(:disabled) {
  background: rgba(160, 39, 59, 0.6);
  border-color: var(--red);
}

.button--warning {
  color: #2a1500;
  background: #f0995f;
  border-color: #f0995f;
}

.button--warning:hover:not(:disabled) {
  background: #f5ab7a;
  border-color: #f5ab7a;
}

.button--full {
  width: 100%;
}

@media (max-width: 40rem) {
  .site-header,
  .main-content {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .brand__title,
  .user-chip__label {
    display: none;
  }

  .user-chip {
    max-width: 62vw;
  }
}

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