:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #262b36;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --ok: #38b26a;
  --err: #e2564a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { max-width: 560px; margin: 0 auto; }

h1 { font-size: 1.4rem; margin: 0 0 .25rem; }

.sub { color: var(--muted); margin: 0 0 1.75rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }

input {
  width: 100%;
  padding: .65rem .75rem;
  background: #10131a;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}

input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  margin-top: 1rem;
  width: 100%;
  padding: .7rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font: 600 15px/1 inherit;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: default; }

.result { margin-top: 1.25rem; }

.msg { padding: .7rem .8rem; border-radius: 6px; font-size: .9rem; }
.msg.ok { background: rgba(56, 178, 106, .12); color: var(--ok); }
.msg.err { background: rgba(226, 86, 74, .12); color: var(--err); }


.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.account-label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.account-name {
  display: block;
  margin-top: .15rem;
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-all;
}

button.link {
  width: auto;
  margin: 0;
  padding: .35rem .7rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  flex: none;
}

button.link:hover { color: var(--text); border-color: var(--accent); }

#otp {
  font: 600 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .35em;
  text-align: center;
  padding: .8rem .75rem;
}

.card + .card { margin-top: 1rem; }

/* Attempt log, pinned bottom-right on wide screens. */
.history {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  width: 290px;
  max-height: 55vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* display:flex would otherwise override the hidden attribute. */
.history[hidden] { display: none; }

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--border);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.history-head .link { padding: .2rem .5rem; font-size: .7rem; }

.history-list {
  margin: 0;
  padding: .5rem;
  list-style: none;
  overflow-y: auto;
}

.history-item {
  padding: .55rem .65rem;
  border-radius: 6px;
  border-left: 3px solid var(--border);
  background: #10131a;
}

.history-item + .history-item { margin-top: .4rem; }

.history-item.ok { border-left-color: var(--ok); }
.history-item.err { border-left-color: var(--err); }

.history-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}

.history-code {
  font: 600 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

.history-verdict { font-size: .7rem; font-weight: 600; }
.history-item.ok .history-verdict { color: var(--ok); }
.history-item.err .history-verdict { color: var(--err); }

.history-meta {
  margin-top: .3rem;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.history-reason { margin-top: .15rem; font-size: .72rem; color: var(--muted); }

/* Not enough room to pin it: fall back to a block under the card. */
@media (max-width: 1000px) {
  .history {
    position: static;
    width: auto;
    max-width: 560px;
    max-height: none;
    margin: 1.5rem auto 0;
  }

  .history-list { max-height: 40vh; }
}
