/* Player panel and account forms. Extends the public site's tokens from styles.css. */

:root {
  --panel-bg: #0b0e17;
  --panel-card: #121724;
  --panel-line: rgba(255, 255, 255, .11);
  --panel-muted: #8e95a2;
  --danger: #d2563f;
  --online: #58c07a;
}

/* ---------- Shared shells ---------- */

.auth-shell,
.panel-body {
  background: var(--panel-bg);
  color: #fff;
}

.auth-shell {
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 140px 0 90px;
  background: radial-gradient(circle at 70% 25%, #1b2132 0, transparent 38%), linear-gradient(115deg, #090b13 30%, #131827 100%);
}

.auth-wrap {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: min(100%, 470px);
  padding: 46px 42px;
  background: rgba(18, 23, 36, .92);
  border: 1px solid var(--panel-line);
}

.auth-card h1 {
  margin: 16px 0 10px;
  font: 400 clamp(2.6rem, 5vw, 3.4rem)/1 var(--serif);
  letter-spacing: -.04em;
}

.auth-lead {
  margin: 0 0 28px;
  color: var(--panel-muted);
  font-size: .95rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--panel-line);
}

.auth-links a {
  color: var(--gold-2);
  font-size: .84rem;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.panel-hero {
  padding: 150px 0 50px;
  background: linear-gradient(115deg, #090b13, #171d2b);
  color: #fff;
}

.panel-hero h1 {
  margin: 14px 0 0;
  font: 400 clamp(2.8rem, 6vw, 4.4rem)/1 var(--serif);
  letter-spacing: -.045em;
}

.panel-hero h1 em {
  color: var(--gold);
  font-weight: 400;
}

.panel-body {
  padding: 60px 0 110px;
}

/* ---------- Cards and data ---------- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 24px;
  margin-bottom: 50px;
}

.panel-card {
  padding: 32px;
  background: var(--panel-card);
  border: 1px solid var(--panel-line);
}

.panel-card h2 {
  margin: 0 0 18px;
  font: 400 1.55rem var(--serif);
}

.panel-card.danger-zone {
  margin-top: 50px;
  border-color: rgba(210, 86, 63, .45);
}

.panel-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin: 48px 0 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-line);
}

.panel-section-head h2 {
  margin: 0;
  font: 400 1.75rem var(--serif);
}

.muted {
  color: var(--panel-muted);
  font-size: .88rem;
}

.data-list {
  margin: 0;
  display: grid;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
}

.data-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 15px;
  background: var(--panel-card);
}

.data-list dt {
  color: var(--panel-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.data-list dd {
  margin: 0;
  font-size: .9rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* ---------- Characters ---------- */

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.character-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  background: var(--panel-card);
  border: 1px solid var(--panel-line);
  color: inherit;
  text-decoration: none;
  transition: .2s;
}

.character-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.character-portrait {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: var(--gold);
  font: 1.6rem/1 var(--serif);
}

.character-portrait.large {
  width: 104px;
  height: 104px;
  font-size: 2.4rem;
}

/*
  A sprite sheet holds one frame per cell: a column per animation frame, a row per direction. The
  window is one cell wide, with the sheet blown up to its full size behind it, so what shows is the
  first cell: the subject standing, facing the camera. The per-grid rule that does the blowing up is
  emitted by the page, because only the page knows the grid, and the script steps the columns.
*/
.slot-icon[class*="sheet-"] > img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  /*
    No width or height here on purpose: the page emits a rule per grid that blows the sheet up to
    the size of the whole sheet, and a rule with this much weight would win over it and squeeze
    every frame into the window at once.
  */
}

/* Art shown as a portrait fills its frame and carries no border of its own. */
.slot-icon.portrait-art,
.slot-icon.large-art {
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
}

.slot-icon.portrait-art > img:not([class]),
.slot-icon.large-art > img:not([class]) {
  max-width: 100%;
  max-height: 100%;
}

.character-portrait img {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.character-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.character-info strong {
  font: 400 1.3rem var(--serif);
}

.character-info span {
  font-size: .82rem;
  color: #c3c8d2;
}

.character-header {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.character-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 10px 0 0;
  color: var(--panel-muted);
  font-size: .84rem;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--panel-muted);
}

.character-card .status-dot {
  position: absolute;
  top: 16px;
  right: 16px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.online {
  color: var(--online);
}

/* ---------- Bars ---------- */

.xp-bar {
  height: 6px;
  margin-top: 6px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}

.xp-bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.xp-bar.health > i {
  background: linear-gradient(90deg, #a8372a, #d2563f);
}

.xp-bar.mana > i {
  background: linear-gradient(90deg, #2f5fa8, #4f90d8);
}

.xp-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  font-size: .84rem;
}

.xp-row .xp-bar {
  margin: 0;
}

/* ---------- Items and spells ---------- */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.item-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 12px;
  background: var(--panel-card);
  border: 1px solid var(--panel-line);
  text-align: center;
}

.item-cell.equipped {
  border-color: var(--gold);
}

.item-name {
  font-size: .78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-qty {
  position: absolute;
  right: 8px;
  bottom: 6px;
  color: var(--gold-2);
  font-size: .72rem;
  font-weight: 700;
}

.item-tag {
  color: var(--gold);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.slot-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
}

.slot-icon img {
  image-rendering: pixelated;
}

/*
  An animated icon is a sheet of 32x32 frames. The window below shows one frame and the script
  moves the sheet behind it; until the script has measured the image, the sheet is held at its
  first frame, so an icon never shows the whole grid at once.
*/
.slot-icon[data-frame-speed],
.slot-icon[class*="sheet-"] {
  position: relative;
  overflow: hidden;
}

.slot-icon[data-frame-speed]:not([class*="sheet-"]) > img {
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  max-width: none;
  transform-origin: top left;
}

.slot-list,
.friend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
}

.slot-list li,
.friend-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  background: var(--panel-card);
  font-size: .86rem;
}

.slot-list .slot-name {
  flex: 1;
}

.friend-list li strong {
  font: 400 1.05rem var(--serif);
}

.friend-list li .muted:last-child {
  margin-left: auto;
}

/* ---------- Forms ---------- */

.form {
  display: grid;
  gap: 18px;
}

.form-wide {
  max-width: 820px;
}

.form-inline {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span:first-child {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #cfd4dd;
}

.field > span em {
  color: var(--panel-muted);
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: #fff;
  font: inherit;
}

.field input:focus-visible,
.sprite-option input:focus-visible + .sprite-frame,
.button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.field small {
  color: var(--panel-muted);
  font-size: .76rem;
}

.field-check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.field-check input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--gold);
}

.field-check span {
  font-size: .84rem;
  color: #cfd4dd;
}

.field-check a {
  color: var(--gold-2);
}

.field-error,
.form-errors {
  color: #f2a192;
  font-size: .78rem;
}

.form-errors:empty {
  display: none;
}

.form-submit {
  justify-self: start;
  margin-top: 4px;
}

.button-ghost {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold) !important;
}

.button-ghost:hover {
  background: var(--gold);
  color: var(--ink) !important;
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff !important;
}

.button-danger:hover {
  background: #b8452f;
  border-color: #b8452f;
}

.nav-form {
  margin: 0;
}

/* ---------- Class picker ---------- */

.class-picker {
  margin: 0;
  padding: 26px;
  border: 1px solid var(--panel-line);
  background: var(--panel-card);
}

.class-picker legend {
  padding: 0 10px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #cfd4dd;
}

.class-block + .class-block {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--panel-line);
}

.class-block h3 {
  margin: 0 0 14px;
  font: 400 1.3rem var(--serif);
}

.sprite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.sprite-option {
  display: grid;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
}

.sprite-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sprite-frame {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: var(--panel-muted);
  transition: .2s;
}

.sprite-frame img {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.sprite-option input:checked + .sprite-frame {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold) inset;
}

.sprite-label {
  font-size: .74rem;
  color: var(--panel-muted);
}

/* ---------- Alerts ---------- */

.alert {
  margin: 0 0 24px;
  padding: 14px 18px;
  border-left: 3px solid var(--panel-muted);
  background: rgba(255, 255, 255, .05);
  font-size: .88rem;
}

.alert-success {
  border-color: var(--online);
}

.alert-error {
  border-color: var(--danger);
}

.alert-info {
  border-color: var(--gold);
}

/* Store: token packages, the PIX charge and the order list. */
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: #fff;
  font: inherit;
}

.field textarea {
  width: 100%;
  padding: 12px 15px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: #fff;
  font: .82rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
  word-break: break-all;
}

.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.token-option {
  cursor: pointer;
}

.token-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.token-body {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 20px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  transition: .2s;
}

.token-option input:checked + .token-body {
  border-color: var(--gold);
  background: #11151f;
}

.token-option input:focus-visible + .token-body {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.token-body strong {
  font: 400 1.3rem var(--serif);
}

.token-price {
  color: var(--gold-2);
  font-weight: 700;
}

.token-body .muted {
  font-size: .8rem;
}

.pix-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin: 18px 0;
}

.pix-qr {
  width: 240px;
  height: 240px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--panel-line);
}

.pix-code {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.order-card .data-list {
  margin-bottom: 18px;
}

.order-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--panel-line);
}

.order-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #0a0d15;
}

.order-list a {
  display: grid;
  gap: 3px;
  text-decoration: none;
}

.order-list a:hover strong {
  color: var(--gold-2);
}

.order-list .muted {
  font-size: .78rem;
}

.order-status {
  flex-shrink: 0;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--panel-muted);
}

.order-status.paid {
  color: #7fd19a;
}

.order-status.pending {
  color: var(--gold);
}

.order-status.closed {
  color: #f2a192;
}

/* Rarity, in the colour the game server reports for the tier. */
.item-cell.rare,
.slot-list li.rare {
  border-color: var(--rarity-color, var(--panel-line));
  box-shadow: inset 0 0 14px -4px var(--rarity-color, transparent);
}

.item-cell.rare .item-name,
.slot-list li.rare .slot-name {
  color: var(--rarity-color, inherit);
}

.item-rarity {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--rarity-color, var(--panel-muted));
}

/* Wiki: category navigation, search and the entry cards. */
.wiki-search {
  margin-bottom: 24px;
}

.wiki-search .field {
  min-width: 260px;
}

.wiki-search input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  background: #0a0d15;
  border: 1px solid var(--panel-line);
  color: #fff;
  font: inherit;
}

.wiki-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-bottom: 28px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
}

.wiki-nav a {
  flex: 1 1 auto;
  padding: 12px 18px;
  background: #0a0d15;
  color: #cfd4dd;
  text-align: center;
  text-decoration: none;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.wiki-nav a:hover {
  color: var(--gold-2);
}

.wiki-nav a.current {
  background: #11151f;
  color: var(--gold);
}

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
}

.wiki-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #0a0d15;
  text-decoration: none;
  transition: .2s;
}

.wiki-card:hover {
  background: #11151f;
}

.wiki-card:hover strong {
  color: var(--gold-2);
}

.wiki-card-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wiki-card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiki-card-body .muted {
  font-size: .74rem;
}

.wiki-pages {
  margin-top: 20px;
}

.wiki-portrait {
  width: 104px;
  height: 104px;
  padding: 0;
}

/* The composed character, drawn frame by frame into a canvas and scaled up without blurring. */
.appearance-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

@media (max-width: 600px) {
  .auth-card {
    padding: 34px 22px;
  }

  .panel-hero {
    padding: 126px 0 40px;
  }

  .xp-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .data-list > div {
    flex-direction: column;
    gap: 4px;
  }

  .data-list dd {
    text-align: left;
  }

  .friend-list li {
    flex-wrap: wrap;
  }

  .friend-list li .muted:last-child {
    margin-left: 0;
  }

  .pix-box {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .pix-qr {
    width: 100%;
    max-width: 240px;
    height: auto;
  }

  .order-list li {
    flex-wrap: wrap;
  }
}
