/* The account page: the site's pixel look (stepped borders, Press Start 2P headings, Pixelify Sans text), laid out as one card
   with tabs. Nothing here uses innerHTML; names come from other players, so account.js builds the page with text nodes. */
.acct-page .nav-links a.here { color: var(--text); }
.acct { padding-top: 56px; padding-bottom: 96px; min-height: 70vh; max-width: 980px; }
.acct[hidden], .acct [hidden] { display: none !important; }

.acct-card {
  --edge: var(--line);
  position: relative;
  background: var(--panel);
  margin: var(--p);
  padding: 28px 24px;
  box-shadow:
    0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge),
    inset 0 -4px 0 0 rgba(0, 0, 0, .28), inset 4px 4px 0 0 rgba(255, 255, 255, .03);
}
.acct-card::before { content: ""; position: absolute; top: -4px; left: 12px; width: 48px; height: 4px; background: var(--gold); }
.gate { max-width: 520px; margin: 24px auto 0; }
.panel { margin-top: 32px; }

.acct-h { font-family: var(--head); font-size: clamp(16px, 3vw, 22px); line-height: 1.4; text-transform: uppercase; text-shadow: 3px 3px 0 var(--bg-deep); margin: 0 0 12px; overflow-wrap: anywhere; }
.acct-h2 { font-family: var(--head); font-size: 16px; line-height: 1.5; text-transform: uppercase; color: var(--gold); margin: 0 0 16px; }
.acct-h3 { font-family: var(--head); font-size: 11px; line-height: 1.6; text-transform: uppercase; color: var(--text); margin: 28px 0 12px; }
.acct-h3:first-child { margin-top: 0; }
.acct-note { color: var(--muted); font-size: 18px; margin: 0 0 16px; }
.acct-fine { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
.who-text .acct-note, .who-text .acct-fine { margin: 0; }
#boot { text-align: center; margin-top: 64px; }

/* ---- tabs ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px 20px; }
.main-tabs { margin: 32px 4px 0; }

/* ---- Settings: a side menu inside the Settings tab, plainly a level below the tabs across the top ---- */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; margin-top: 32px; align-items: start; }
.settings-nav { position: sticky; top: 88px; }
.settings-nav-title { font-family: var(--label); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px 16px; }
.subnav { display: flex; flex-direction: column; border-left: 2px solid var(--line); }
.subnav [role="tab"] {
  font-family: var(--body); font-size: 17px; text-align: left; color: var(--muted); background: none; border: 0;
  padding: 10px 16px; margin-left: -2px; border-left: 2px solid transparent; cursor: pointer;
}
.subnav [role="tab"]:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.subnav [role="tab"][aria-selected="true"] { color: var(--gold); border-left-color: var(--gold); background: rgba(255, 255, 255, .04); }
.subnav [role="tab"]:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.settings-body > .panel { margin-top: 0; }
@media (max-width: 760px) {
  .settings { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { position: static; }
  .settings-nav-title { margin-left: 0; }
  .subnav { flex-direction: row; flex-wrap: wrap; gap: 8px; border-left: 0; }
  .subnav [role="tab"] { margin: 0; border: 1px solid var(--line); border-left-width: 1px; padding: 8px 14px; }
  .subnav [role="tab"][aria-selected="true"] { border-color: var(--gold); }
}
.tabs [role="tab"] {
  font-family: var(--label); font-size: 14px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--panel-2); border: 0; padding: 12px 16px; margin: 4px;
  box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line);
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: #1b1408; background: var(--gold); box-shadow: 0 -4px 0 0 var(--gold-deep), 0 4px 0 0 var(--gold-deep), -4px 0 0 0 var(--gold-deep), 4px 0 0 0 var(--gold-deep); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; background: var(--ember); color: #1b0e0c; font-weight: 400; text-align: center; }

/* ---- forms ---- */
.form { display: grid; gap: 18px; margin-top: 8px; }
.form + .form { margin-top: 36px; padding-top: 28px; border-top: 4px solid var(--line); }
.field { display: grid; gap: 8px; }
.field > span, .choice legend { font-family: var(--label); font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.field small, .choice small { color: var(--muted); font-size: 14px; }
.field input, .searchbar input {
  font: inherit; font-size: 19px; color: var(--text); background: var(--bg-deep);
  border: 0; padding: 12px 14px; width: 100%;
  box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line), inset 0 4px 0 0 rgba(0, 0, 0, .35);
  margin: 4px 0;
}
.field input:focus, .searchbar input:focus { outline: none; box-shadow: 0 -4px 0 0 var(--gold), 0 4px 0 0 var(--gold), -4px 0 0 0 var(--gold), 4px 0 0 0 var(--gold), inset 0 4px 0 0 rgba(0, 0, 0, .35); }
.field input:disabled { color: var(--muted); opacity: .8; }
.choice { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.choice legend { padding: 0; margin-bottom: 8px; }
.choice label { display: flex; align-items: center; gap: 12px; font-size: 19px; padding: 10px 12px; background: var(--bg-deep); box-shadow: 0 0 0 4px var(--line); margin: 4px; }
.choice input { appearance: none; width: 20px; height: 20px; margin: 0; background: var(--panel-2); box-shadow: 0 0 0 4px var(--line); flex: none; }
.choice input:checked { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-deep), inset 0 0 0 4px var(--panel); }
.choice label:has(input:checked) { box-shadow: 0 0 0 4px var(--gold-deep); }
.choice input:focus-visible { outline: 4px solid var(--gold); outline-offset: 4px; }

/* ---- buttons ---- */
.ab {
  --edge: var(--line); --fill: var(--panel-2); --ink: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--head); font-size: 11px; line-height: 1; text-transform: uppercase; text-decoration: none;
  color: var(--ink); background: var(--fill); border: 0; padding: 14px 18px 16px; margin: 4px;
  box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge), inset 0 -4px 0 0 rgba(0, 0, 0, .25), inset 4px 4px 0 0 rgba(255, 255, 255, .12);
  transition: transform .1s steps(2);
}
.ab.primary { --edge: var(--gold-deep); --fill: var(--gold); --ink: #1b1408; }
.ab.danger { --edge: #8a3a32; --fill: #3a1d1b; --ink: var(--ember); }
.ab:hover:not(:disabled) { transform: translateY(-2px); }
.ab:active:not(:disabled) { transform: translateY(2px); }
.ab:disabled { opacity: .5; cursor: not-allowed; }
.ab.small { font-size: 9px; padding: 10px 12px 12px; }
.ab.file { cursor: var(--sword); position: relative; overflow: hidden; }
.ab.file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: var(--sword); font-size: 0; }
.ab.file:focus-within { outline: 4px solid var(--gold); outline-offset: 4px; }
.link { font: inherit; font-size: 17px; color: var(--muted); background: none; border: 0; padding: 4px 0; text-align: left; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; justify-self: start; }
.link:hover { color: var(--text); }
.btns { display: flex; flex-wrap: wrap; gap: 4px; }

.msg { margin: 0; min-height: 1.5em; font-size: 17px; color: var(--jade); overflow-wrap: anywhere; }
.msg.error { color: var(--ember); }
.notice { margin: 12px 0; padding: 12px 14px; background: var(--bg-deep); box-shadow: 0 0 0 4px var(--line); color: var(--muted); }

/* ---- who / avatars ---- */
.who { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.who-text { flex: 1 1 220px; min-width: 0; }
.who .acct-h { margin: 0 0 4px; }
.avatar { flex: none; display: grid; place-items: center; background: var(--gold); color: #1b1408; font-family: var(--head); overflow: hidden; image-rendering: pixelated; box-shadow: 0 0 0 4px var(--gold-deep); margin: 4px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.avatar.small { width: 44px; height: 44px; font-size: 16px; }
.avatar.big { width: 72px; height: 72px; font-size: 28px; }
.avatar.huge { width: 112px; height: 112px; font-size: 44px; }
.row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 20px; }
.col { flex: 1 1 260px; min-width: 0; }

/* ---- stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 8px 4px 0; }
.stat { background: var(--bg-deep); padding: 14px 14px 12px; box-shadow: 0 0 0 4px var(--line); }
.stat span { display: block; font-family: var(--label); font-size: 12px; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; font-family: var(--head); font-size: 18px; font-weight: 400; margin-top: 8px; color: var(--text); }
.table-wrap { overflow-x: auto; margin: 4px; }
.matches { width: 100%; border-collapse: collapse; font-size: 17px; }
.matches th { font-family: var(--label); font-size: 12px; text-align: left; color: var(--muted); padding: 8px 10px; border-bottom: 4px solid var(--line); white-space: nowrap; }
.matches td { padding: 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.matches .won { color: var(--jade); } .matches .lost { color: var(--ember); }

/* ---- friends ---- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } .acct { padding-top: 32px; } }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-deep); box-shadow: 0 0 0 4px var(--line); margin: 4px; }
.people li.open { box-shadow: 0 0 0 4px var(--gold-deep); }
.people .who-text { flex: 1 1 0; }
.people .name { font-weight: 600; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.people .user { color: var(--muted); font-size: 15px; }
.status { margin: 2px 0 0; font-family: var(--label); font-size: 12px; color: var(--muted); }
.status.online { color: var(--jade); }
.status.online::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--jade); margin-right: 8px; }
.searchbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.searchbar input { flex: 1; }
.detail { margin: 36px 4px 0; padding-top: 24px; border-top: 4px solid var(--line); }
.detail-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head .acct-h3 { margin: 0 0 4px; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { .ab { transition: none; } }

/* ---- match history: a click opens a line to show its players ---- */
.matches tr.openable { cursor: pointer; }
.matches tr.openable:hover td { background: rgba(255, 255, 255, .04); }
.matches tr.open td { background: rgba(255, 255, 255, .06); }
.matches tr.detail td { padding: 12px 14px 16px; background: rgba(0, 0, 0, .25); }
.matches .detail .facts { margin: 0 0 10px; color: var(--muted, #9aa); font-size: 13px; }
.matches .detail .sides { display: flex; flex-wrap: wrap; gap: 24px 48px; }
.matches .detail .side { min-width: 220px; flex: 1; }
.matches .detail h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold, #e5bc76); }
.matches .detail p { display: flex; justify-content: space-between; gap: 16px; margin: 2px 0; font-size: 14px; }
.matches .detail em { font-style: normal; color: var(--muted, #9aa); }
