/* Account is a reading surface above the ocean, using the existing account flows. */
#topbar #account-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; height: 44px; padding: 0 13px;
  border: 1px solid rgba(160,207,221,.3); border-radius: 7px;
  background: #183140; color: #e0ebed;
  box-shadow: inset 0 1px rgba(219,244,250,.09), 0 2px 4px #0002;
  font: 600 12px var(--ui); letter-spacing: .015em; cursor: pointer;
  transition: background-color .16s, border-color .16s, box-shadow .16s;
}
#account-btn .account-user-icon { width: 20px; height: 20px; }
#account-btn [hidden] { display: none !important; }
#account-button-avatar, #account-button-avatar .board-avatar { display: flex; }
#account-button-avatar .board-avatar svg { width: 24px; height: 24px; }
#topbar #account-btn:hover { border-color: #aedee69c; background-color: #2a4c5c; }
#topbar #account-btn:active { transform: none; box-shadow: inset 0 2px 5px #0005; }
#topbar #account-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

#account-modal {
  position: fixed; inset: 0; z-index: 26;
  display: grid; place-items: center; padding: 24px;
  background: rgba(1,6,12,.9);
}
#account-modal.hidden { display: none; }
#account-modal .account-sheet {
  position: relative; width: min(700px, 100%);
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  padding: 34px; border-radius: 10px;
  border: 1px solid rgba(174,209,224,.24); border-top: 2px solid #9ec7d0;
  background: radial-gradient(ellipse at 100% 0, #38576a1f, transparent 45%), linear-gradient(135deg, #122330, #0b1823 55%);
  box-shadow: 0 30px 100px #0009, inset 0 1px #e4f7ff12;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #9fbecd4d transparent;
}
#account-modal:not(.hidden) { animation: account-scrim-in .18s ease-out both; }
#account-modal:not(.hidden) .account-sheet { animation: account-surface-in .2s ease-out both; }
@keyframes account-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes account-surface-in { from { opacity: .5; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#account-modal .close {
  position: sticky; top: 0; right: auto; z-index: 3;
  float: right; margin: 0 0 -44px 0;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid #badbe52b; border-radius: 7px;
  background: #193340; color: #c4dbe4; font: 400 24px var(--ui);
  box-shadow: 0 2px 8px #0003;
}
#account-modal .close:hover { color: #f2fbff; background: #2a4655; border-color: #badbe552; }
#account-modal .close:active { box-shadow: inset 0 2px 4px #0005; }
#account-modal :is(button, a):focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
#account-modal :is(button, a):active { transform: none; }
#account-modal button { cursor: pointer; }
#account-modal button:disabled { cursor: default; opacity: .5; }
.account-heading { margin: 0 58px 30px 0; }
#account-modal .account-eyebrow {
  margin: 0 0 8px; color: #9db4c2;
  font: 500 9px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .16em;
}
#account-title { margin: 0; color: #f0ede4; font: 600 40px/1.15 var(--ui); letter-spacing: -.035em; }
.account-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.account-avatar { flex: none; display: grid; place-items: center; width: 64px; height: 64px; }
.account-avatar .board-avatar { display: flex; }
.account-avatar svg { width: 60px; height: 60px; border: 1px solid #aacbd64d; padding: 8px; background: #05131c; box-shadow: inset 0 1px 5px #0005; }
.account-identity-copy { min-width: 0; }
#account-modal .account-identity .account-eyebrow { margin-bottom: 5px; }
#account-name { margin: 0; color: #e9edea; font: 500 25px/1.25 var(--ui); letter-spacing: -.025em; text-transform: none; overflow-wrap: anywhere; }
#account-modal .account-status { margin: 6px 0 0; color: #adc6d0; font: 400 12px/1.5 var(--ui); }
.account-balance-card {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 26px; border: 1px solid #a1c9d840; border-radius: 7px;
  background: linear-gradient(115deg, #223f4c, #142c3a 80%);
  box-shadow: inset 0 1px #d7f4fc0d;
}
.account-balance-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-width: 0; margin: 4px 0; }
#account-balance { color: #f0ede4; font: 500 46px/1.15 var(--ui); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#account-asset { color: #bccfd5; font: 500 13px var(--mono); }
#account-modal .account-note { margin: 10px 0 0; color: #acc2cf; font: 400 12px/1.65 var(--ui); overflow-wrap: anywhere; }
#account-network { color: #beced6; }
#account-network:empty { display: none; }
#account-balance-note { color: #e0c79f; }
#account-modal .account-section-title { display: flex; align-items: center; gap: 16px; margin: 30px 0 16px; color: #e0e6e4; font: 500 16px/1.4 var(--ui); letter-spacing: -.015em; text-transform: none; }
.account-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.account-link {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 12px;
  align-items: center; gap: 12px; min-width: 0; min-height: 98px; padding: 17px 16px;
  border: 1px solid #a0c8dc29; border-radius: 6px;
  background: #122735; color: #c0dce8; text-align: left;
  box-shadow: inset 0 1px #e0f4ff05;
  transition: background-color .16s, border-color .16s, box-shadow .16s;
}
.account-link > span:nth-child(2) { min-width: 0; }
.account-link-icon { display: grid; place-items: center; color: #a5c6d1; width: 34px; height: 40px; }
.account-link-icon svg { width: 26px; height: 26px; }
.account-link strong { display: block; color: #e8eae5; font: 500 15px/1.3 var(--ui); }
.account-link small { display: block; margin-top: 6px; color: #a5bac7; font: 400 12px/1.5 var(--ui); }
.account-arrow { color: #9fbecc; font-size: 15px; }
.account-link:hover:not(:disabled) { background-color: #1d3a48; border-color: #a0c8dc66; }
.account-link:active:not(:disabled) { box-shadow: inset 0 2px 5px #0004; }
.account-settings { display: grid; border: 1px solid #a0c8dc29; border-radius: 6px; overflow: hidden; background: #08192566; }
.account-settings button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 54px; padding: 14px 18px; border: 0; border-radius: 0;
  background: none; color: #c5dbe5; text-align: left; font: 500 13px/1.45 var(--ui);
}
.account-settings button + button { border-top: 1px solid #a0c8dc1f; }
.account-settings button:hover { background: #8fb9cd0d; }
.account-settings button:focus-visible { outline-offset: -3px; }
#account-sound-state { color: #d6e9f0; font: 600 11px var(--ui); min-width: 36px; text-align: center; padding: 4px 7px; border: 1px solid #9bcbd63d; border-radius: 6px; }
#account-sound[aria-pressed="true"] #account-sound-state { color: #b0c4cf; border-color: #9bcbd621; }
#account-signout-section { margin-top: 22px; padding-top: 16px; border-top: 1px solid #a0c8dc24; }
#account-signout { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid #b9cfdb2b; border-radius: 6px; color: #c5d9e3; font: 600 13px var(--ui); text-decoration: none; background: #1a303d52; }
#account-signout:hover { color: #edf8fc; border-color: #b9cfdb66; }
#account-session-note { max-width: 58ch; }
#account-guest { text-align: center; padding: 10px 22px 18px; }
.account-guest-mark {
  display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 18px;
  border: 1px solid #a9d2df42; border-radius: 9px;
  color: #bddce5; background: #1d3948;
  box-shadow: inset 0 1px #e0f3ff12;
}
.account-guest-mark svg { width: 36px; height: 36px; }
#account-guest-title { margin: 0 0 12px; color: #f0ede4; font: 500 30px/1.2 var(--ui); letter-spacing: -.03em; text-transform: none; }
#account-guest-copy { max-width: 38ch; margin: 0 auto 22px; color: #bcd1dc; font: 400 14px/1.65 var(--ui); }
.account-primary { display: flex; align-items: center; justify-content: center; min-height: 50px; max-width: 320px; margin: 0 auto; padding: 12px 20px; border: 1px solid #d9f2fa42; border-radius: 6px; background: #b8dbe1; color: #0a2330; font: 700 14px var(--ui); text-decoration: none; box-shadow: inset 0 1px #f6ffff40, 0 4px 12px #0003; }
.account-primary:hover { background: #d0e9ed; }
.account-primary:active { box-shadow: inset 0 2px 4px #12384740; }

/* Static sonar rings give the balance plate an identity without suggesting
   movement or inventing a financial status. All figures remain above the motif. */
.account-balance-card::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  width: 220px; height: 220px; border: 1px solid #b7dce914; border-radius: 50%;
  top: -110px; right: -90px;
  box-shadow: 0 0 0 25px #b7dce905, 0 0 0 26px #b7dce90d,
    0 0 0 59px #b7dce903, 0 0 0 60px #b7dce908;
}
.account-section-title::after { content: ''; flex: 1; height: 1px; background: #a0c8dc21; }
#account-modal .account-status { display: flex; align-items: center; gap: 7px; }
.account-status::before {
  content: ''; flex: none; width: 5px; height: 5px; border-radius: 50%; background: #9baeba;
}
.account-status[data-connection="connected"]::before { background: #b4d1bd; }
.account-status[data-connection="reconnecting"]::before { background: #dbc394; }
#account-modal .account-link:hover:not(:disabled) .account-arrow { color: #e0f3f7; }
#account-modal #account-network { max-width: 58ch; color: #b8cbd3; }
#account-modal #account-balance-note { color: #e4c89e; }
#account-modal #account-signin-unavailable { color: #e4c89e; }
#account-guest { padding-block: 20px 28px; }
#account-guest .account-note { max-width: 40ch; margin-inline: auto; }

@media (max-width: 600px) {
  #account-modal { padding: 12px; }
  #account-modal .account-sheet { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 24px; border-radius: 9px; }
  #account-title { font-size: 34px; }
  .account-identity { gap: 12px; }
  #account-name { font-size: 23px; }
  .account-avatar { width: 50px; height: 50px; }
  .account-avatar svg { width: 48px; height: 48px; }
  .account-balance-card { padding: 22px; }
  #account-balance { font-size: 40px; }
  .account-links { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .account-link { min-height: 80px; padding: 16px; }
  .account-link small { font-size: 12px; }
  #account-guest { padding-inline: 0; }
}
@media (max-width: 360px) {
  #account-modal { padding: 8px; }
  #account-modal .account-sheet { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 19px; border-radius: 8px; }
  #account-title { font-size: 30px; }
  .account-avatar { width: 42px; height: 42px; }
  .account-avatar svg { width: 42px; height: 42px; padding: 6px; }
  #account-name { font-size: 20px; }
  #account-balance { font-size: 34px; }
  .account-balance-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  #account-modal, #account-modal *, #topbar #account-btn { animation: none !important; transition: none !important; }
}

/* Quiet preference rows: the soundtrack lives here, not over the game. */
#account-modal .account-heading > .account-eyebrow,
#account-modal .account-identity .account-eyebrow { display: none; }
#account-modal .account-balance-card::before { display: none; }
#account-modal .account-links { gap: 0; border-top: 1px solid #aacbd629; }
#account-modal .account-link { min-height: 76px; padding: 12px 8px; border: 0; border-bottom: 1px solid #aacbd629; border-radius: 0; background: transparent; box-shadow: none; }
#account-modal .account-link:hover { background: #aacbd60a; }
#account-modal .account-link small { margin-top: 3px; }
#account-modal .account-audio { padding: 16px 18px; border-top: 1px solid #aacbd629; }
#account-modal .account-audio + button { border-top: 1px solid #aacbd629; }
.account-music-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-music-row > span { min-width: 0; }
.account-music-row strong { display: block; color: #e8eae5; font: 500 14px/1.5 var(--ui); }
.account-music-row small { display: block; color: #a5bac7; font: 400 12px/1.6 var(--ui); }
#account-modal #account-music { flex: none; min-height: 44px; min-width: 66px; padding: 8px 14px; justify-content: center; border: 1px solid #a8ced344; border-radius: 6px; background: #a8ced310; color: #deeeea; }
#account-modal .account-volume { display: grid; grid-template-columns: 50px minmax(0, 1fr) 38px; gap: 12px; align-items: center; min-height: 44px; color: #bbced7; font: 400 12px var(--ui); }
#account-modal .account-volume input { width: 100%; min-width: 0; height: 32px; margin: 0; accent-color: #a3d0c3; cursor: pointer; }
#account-modal .account-volume input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
#account-modal .account-volume output { text-align: right; font-variant-numeric: tabular-nums; }
.account-music-credits { margin-top: 4px; color: #9fb7c3; font: 400 11px/1.7 var(--ui); }
.account-music-credits summary { cursor: pointer; padding: 8px 0; }
.account-music-credits summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.account-music-credits p { margin: 0 0 8px; }
.account-music-credits a { color: #c2dadc; text-decoration: underline; text-underline-offset: 3px; }
