/* Accounts: log in / sign up, settings, arcade initials, and the one-time token reveal.
   Builds on retro.css (tokens, .panel, .btn, .form, .notice, .tabs, .meter, .table, .copy-block);
   every token has a fallback so these pages still look right on their own. */

/* ── Log in / sign up ─────────────────────────────────────────────────────── */

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px;
  max-width: 880px;
  margin: 8px auto 24px;
  align-items: start;
}
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
}

.auth-form input[type="text"]:not(.initials-input),
.auth-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
}

.auth-perks {
  list-style: none;
  margin: 10px 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.auth-perks li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  background: var(--rr-bg, #fffbea);
  border: 2px dashed var(--rr-border, #c9b98a);
  border-radius: 8px;
  line-height: 1.35;
}
.perk-icon {
  flex: none;
  font-size: 18px;
  line-height: 1;
}

/* ── Form states ──────────────────────────────────────────────────────────── */

.form-row-error input,
.form-row-error textarea {
  border-color: var(--rr-red, #e8392c);
  box-shadow: 0 0 0 2px rgba(232, 57, 44, 0.2);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.check-row input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--rr-green, #1fa34a);
}
/* A long label stays beside its box and wraps there (it used to drop below the checkbox). */
.check-row label {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-weight: bold;
}
.check-row .muted {
  font-weight: normal;
}
.check-row .form-error {
  flex-basis: 100%;
  margin: 0;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* ── Arcade initials ──────────────────────────────────────────────────────── */
/* The input itself is the live preview: a pixel font on a cabinet screen with three underline slots,
   so what you type looks like the board while you type it, no JavaScript needed. */

.initials-input {
  --slot: var(--rr-yellow, #ffd400);
  box-sizing: border-box;
  width: calc(5.3em + 6px);
  padding: 0.45em 0.2em 0.55em 0.5em;
  font-family: "Press Start 2P", "Silkscreen", ui-monospace, monospace;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--rr-yellow, #ffd400);
  caret-color: var(--rr-pink, #e0379b);
  background-color: #0b0b2a;
  background-image: linear-gradient(
    90deg,
    var(--slot) 0 1em,
    transparent 1em 1.5em,
    var(--slot) 1.5em 2.5em,
    transparent 2.5em 3em,
    var(--slot) 3em 4em,
    transparent 4em
  );
  background-size: 4.5em 3px;
  background-repeat: no-repeat;
  background-position: 0.5em calc(100% - 0.25em);
  border: 3px solid #000;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #2b2b8f, 3px 3px 0 rgba(0, 0, 0, 0.25);
}
.initials-input::placeholder {
  color: rgba(255, 212, 0, 0.35);
}
.initials-input:focus-visible {
  outline: 3px solid var(--rr-pink, #e0379b);
  outline-offset: 2px;
}
.initials-input-small {
  font-size: 18px;
}

.initials-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-start;
}
.initials-editor > .form-row {
  flex: 1 1 240px;
}

.initials-board {
  flex: 0 1 280px;
  margin: 0;
  padding: 12px 16px 14px;
  color: #fff;
  background: #0b0b2a;
  border: 4px solid #000;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #2b2b8f, 4px 4px 0 rgba(0, 0, 0, 0.25);
  font-family: "Press Start 2P", "Silkscreen", ui-monospace, monospace;
  font-size: 11px;
}
.initials-board figcaption {
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
  color: var(--rr-red, #e8392c);
  animation: rr-account-blink 1.4s steps(2, start) infinite;
}
.initials-board ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.initials-board li {
  display: grid;
  grid-template-columns: 4ch 4ch minmax(0, 1fr);
  gap: 12px;
  color: #9fb0ff;
}
.initials-board .board-you {
  color: var(--rr-yellow, #ffd400);
}
.board-score {
  text-align: right;
}

@keyframes rr-account-blink {
  to { visibility: hidden; }
}

/* ── Settings ─────────────────────────────────────────────────────────────── */

.settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* long tokens and commands scroll inside their box, never widen the page */
  gap: 16px;
  max-width: 880px;
  margin: 8px auto 24px;
}
.settings > * {
  min-width: 0;
}
.settings-head {
  display: grid;
  gap: 12px;
}
.settings-who {
  display: flex;
  gap: 12px;
  align-items: center;
}
.settings-who p {
  margin: 2px 0 0;
}
.settings-title {
  margin: 0;
  font-size: 22px;
}
.settings-initials {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  font-family: "Press Start 2P", "Silkscreen", ui-monospace, monospace;
  font-size: 15px;
  color: var(--rr-yellow, #ffd400);
  background: #0b0b2a;
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px #2b2b8f, 3px 3px 0 rgba(0, 0, 0, 0.25);
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.settings-section {
  scroll-margin-top: 16px;
}
.settings-section:target {
  outline: 3px solid var(--rr-yellow, #ffd400);
  outline-offset: 2px;
}

.playtester-level {
  margin: 12px 0;
}
.playtester-level p {
  margin: 6px 0;
}
.playtester-level .meter {
  max-width: 440px;
}
.level-chip {
  display: inline-block;
  padding: 4px 6px;
  font-size: 10px;
  color: #fff;
  background: var(--rr-purple, #8a3ffc);
  border: 2px solid #000;
  border-radius: 4px;
}

.plan-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.plan-chip {
  display: inline-block;
  padding: 5px 8px;
  font-size: 10px;
  border: 2px solid #000;
  border-radius: 4px;
}
.plan-chip-free {
  color: #223;
  background: #e7edf7;
}
.plan-chip-premium {
  color: #3a2400;
  background: linear-gradient(180deg, #ffe76a, #ffb800);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.3);
}

/* ── API tokens ───────────────────────────────────────────────────────────── */

.token-create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-start;
}
.token-create-row .form-row {
  flex: 1 1 260px;
  margin: 0;
}
.token-create-row input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}
.token-create-row > .btn {
  margin-top: 1.7em;
}

.table-scroll {
  position: relative; /* contains .sr-only labels so they never widen the page */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.token-table code {
  font-size: 12px;
  white-space: nowrap;
}
.token-table form {
  margin: 0;
}
.token-new {
  background: rgba(255, 212, 0, 0.2);
}

.token-reveal .notice {
  border-width: 3px;
}
.token-reveal-title {
  margin: 0 0 6px;
  font-size: 17px;
}
.token-reveal h3 {
  margin: 16px 0 6px;
  font-size: 13px;
}
.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.copy-row .copy-block {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}
.copy-row > .btn {
  flex: none;
  align-self: center;
}
.token-secret {
  font-size: 15px;
  font-weight: bold;
  color: #1b1b1b;
  background: #fffbe0;
  border: 2px dashed var(--rr-orange, #ff8a00);
}
@media (max-width: 560px) {
  .copy-row { flex-direction: column; }
  .copy-row > .btn { align-self: flex-start; }
  .token-create-row > .btn { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .initials-board figcaption { animation: none; }
}
