:root {
  --bg: #0b0b0d;
  --surface: #16161a;
  --surface-2: #1e1e24;
  --line: rgba(255,255,255,0.08);
  --text: #ececf0;
  --muted: #8a8a95;
  --accent: #c9a24b;      /* warm gold — piano brass */
  --accent-soft: rgba(201,162,75,0.15);
  --ok: #6fcf8e;
  --no: #e0736b;

  /* required by wallet-client.js / wallet-key.js UI */
  --surface2: var(--surface-2);
  --border: var(--line);
  --text-muted: var(--muted);
  --danger: var(--no);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; }

.wrap { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }

header { display: flex; flex-direction: column; gap: 18px; margin-bottom: 36px; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.4px; }
h1 span { color: var(--muted); font-weight: 400; }

.who { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.account-btn {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent);
  font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.account-btn:hover { border-color: var(--accent); }

.account-anchor { position: relative; }
.account-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; min-width: 140px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 150;
}
.account-dropdown.hidden { display: none; }
.dropdown-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--muted); font-size: 13px; padding: 8px 10px; border-radius: 7px;
  cursor: pointer; font-family: inherit;
}
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent); }
.dropdown-sep { height: 1px; background: var(--line); margin: 4px 6px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
}
.modal-backdrop.hidden { display: none; }

.account-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 32px 28px; width: 100%; max-width: 320px; text-align: center;
}
.account-title {
  font-size: 15px; color: var(--muted); font-style: italic; margin-bottom: 18px;
}
.account-wallet {
  background: var(--surface-2); border-radius: 8px; padding: 10px;
  font-family: 'SF Mono', Menlo, monospace; color: var(--text); font-size: 13px;
  margin-bottom: 20px;
}
.account-link {
  display: block; width: 100%; background: none; border: none; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px; font-size: 14px;
  padding: 10px 0; cursor: pointer; font-family: inherit;
}
.account-link.danger { color: var(--no); }
.account-link.close-link { color: var(--muted); margin-top: 8px; text-decoration: none; }
.account-warn { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.account-confirm-row { display: flex; gap: 8px; }
.account-confirm-row .account-link { flex: 1; padding: 8px 0; }
.account-error { color: var(--no); font-size: 12px; margin: 4px 0 8px; }

.modes { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; }
.mode-btn { background: transparent; border: none; color: var(--muted); cursor: pointer;
  padding: 7px 16px; border-radius: 7px; font-size: 13px; transition: all .15s; }
.mode-btn.active { background: var(--accent-soft); color: var(--accent); }

.stage { text-align: center; margin-bottom: 28px; }
.play {
  background: var(--accent); color: #1a1509; border: none; cursor: pointer;
  font-size: 18px; font-weight: 600; padding: 16px 34px; border-radius: 14px;
  transition: transform .08s, filter .15s;
}
.play:hover { filter: brightness(1.08); }
.play:active { transform: scale(0.97); }
.prompt { margin-top: 18px; color: var(--muted); font-size: 15px; }
.feedback { margin-top: 10px; font-size: 16px; min-height: 22px; }
.feedback .ok { color: var(--ok); }
.feedback .no { color: var(--no); }

.keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 24px; }
.key {
  background: #f2f2ee; color: #16161a; border: 1px solid rgba(0,0,0,0.2);
  border-radius: 10px; padding: 20px 0; font-size: 17px; font-weight: 600; cursor: pointer;
  transition: transform .06s, filter .12s;
}
.key.black { background: #222228; color: #ececf0; border-color: var(--line); }
.key:hover:not(:disabled) { filter: brightness(1.05); }
.key:active:not(:disabled) { transform: scale(0.96); }
.key:disabled { opacity: 0.4; cursor: default; }

.confidence { display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.conf { background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.conf.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.controls { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; color: var(--muted); font-size: 13px; }
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ghost-btn { background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; margin-top: 18px; }
.panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.hidden { display: none; }

.stat-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; }
.stat-row .n { width: 34px; color: var(--text); font-weight: 600; }
.stat-row .bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.stat-row .bar i { display: block; height: 100%; background: var(--accent); }
.stat-row .v { width: 78px; text-align: right; color: var(--muted); }
.stat-row .v em { font-style: normal; opacity: 0.6; }
.hint { margin-top: 12px; color: var(--muted); font-size: 12px; opacity: 0.7; }

.test-result .big { font-size: 40px; font-weight: 700; color: var(--accent); text-align: center; }
.test-result .sub { text-align: center; color: var(--muted); margin-top: 8px; font-size: 13px; }
