/*
 * Levels, and the profile panel they live in.
 *
 * A level is worn in three places and has to read at three sizes: a badge next
 * to a name in a list, a chip with a thin bar in the top bar, and a full card
 * in the profile with both numbers spelled out. All three take their colour
 * from one custom property the script sets, so a new tier is a line in the
 * server's table and nothing here changes.
 */

.level-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--tier, #8a94a6);
  border-radius: 4px;
  background: color-mix(in srgb, var(--tier, #8a94a6) 16%, #0a1120);
  color: var(--tier, #8a94a6);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* ------------------------------------------------------------- the chip */

/*
 * The level in the top bar.
 *
 * A word, a number and a line: no box, no badge, nothing competing with the
 * balance beside it. The bar is the only thing that moves, and it moves once
 * per bet.
 */
.level-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 86px;
  padding: 0 2px;
}

.level-chip[hidden] {
  display: none;
}

.level-chip-label {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1;
}

.level-chip-bar {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: #16223a;
  overflow: hidden;
}

.level-chip-bar span {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  background: var(--tier, #8a94a6);
  transition: width 400ms ease;
}

/* ------------------------------------------------------------- the card */

.level-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tier) 10%, #0b1424), #0b1424);
}

.level-card-top,
.level-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Inside the card the chip is only a grouping, not a control. */
.level-card .level-chip {
  border: 0;
  background: transparent;
  height: auto;
  padding: 0;
  gap: 8px;
}

.level-tier {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tier, #8a94a6);
}

.level-next {
  font-size: 12px;
  color: var(--text-faint);
}

.level-bar {
  height: 8px;
  margin: 10px 0 8px;
  border-radius: 4px;
  background: #101c30;
  overflow: hidden;
}

.level-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tier) 60%, #0b1424), var(--tier));
  transition: width 500ms ease;
}

.level-card-foot {
  font-size: 12px;
  color: var(--text-faint);
}

/* ==========================================================================
 * The profile panel
 *
 * The old one was a stack of fields with a picture on top. This one is a
 * card: the face sits on a tinted band in the tier's own colour, the level is
 * shown rather than described, and the two numbers that actually say how much
 * somebody has played get a tile each instead of a definition list.
 */

.profile-card {
  margin: -4px -2px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0b1424;
}

.profile-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background:
    radial-gradient(120% 180% at 12% 0%, color-mix(in srgb, var(--tier, #8a94a6) 26%, transparent), transparent 70%),
    linear-gradient(180deg, #111d33, #0b1424);
}

.profile-banner .face {
  width: 68px;
  height: 68px;
  font-size: 24px;
  border: 2px solid color-mix(in srgb, var(--tier, #8a94a6) 70%, #0b1424);
  box-shadow: 0 0 0 4px rgba(6, 10, 18, 0.9);
  flex: none;
}

.profile-identity {
  min-width: 0;
}

.profile-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-name-line .name {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-address {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.profile-card .level-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.profile-stat {
  padding: 10px 12px;
  background: #0b1424;
}

.profile-stat dt {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.profile-stat dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

/* --------------------------------------------------------- the two edits */

.profile-section {
  margin-bottom: 14px;
}

.profile-section h4 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.photo-row {
  display: flex;
  gap: 8px;
}

.photo-row input[type='file'] {
  display: none;
}

.profile-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #0a1120;
}

.profile-field:focus-within {
  border-color: var(--gold);
}

.profile-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.profile-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}

@media (max-width: 560px) {
  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-banner {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
 * The welcome case
 *
 * A strip that rolls past a marker, which is the same idea as the wheel and
 * for the same reason: the result is already decided, and the movement is
 * there so the player watches it arrive rather than reading it.
 */

.case-strip {
  position: relative;
  overflow: hidden;
  height: 132px;
  margin: -2px -2px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(70% 120% at 50% 50%, rgba(66, 92, 140, 0.16), transparent 70%),
    #070c15;
}

.case-track {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  list-style: none;
  will-change: transform;
}

.case-tile {
  flex: none;
  width: 104px;
  height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--tier) 45%, var(--line));
  border-radius: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tier) 14%, #0b1424), #0b1424);
  opacity: 0.85;
}

.case-tile-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--tier);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--tier) 30%, #0b1424), #070c15);
}

.case-tile-name {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tier);
}

.case-tile-value {
  font-size: 11px;
  color: var(--text-faint);
}

.case-track.is-done .case-tile.is-winner {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--tier);
}

.case-marker {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(245, 185, 66, 0.6);
  pointer-events: none;
}

.case-result {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.case-odds {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.case-odds li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #0b1424;
}

.case-odds li:last-child {
  border-bottom: 0;
}

.case-odds-name {
  color: var(--tier);
  font-weight: 600;
}

.case-odds-chance {
  color: var(--text);
}

.case-odds-value {
  color: var(--text-faint);
  min-width: 96px;
  text-align: right;
}
