/* Accounts: login card, the account chip next to the intro, the "Moje hry" profile, friends, the friends' day on the summary */

/* what is shown depends on <html data-auth>: user (signed in), error (signed in, the profile failed), guest (accounts
   available), off (accounts unavailable); until the first auth state arrives none of it is shown */
html:not([data-auth="user"]) .when-user,
html:not([data-auth="error"]) .when-error,
html:not([data-auth="guest"]):not([data-auth="off"]) .when-guest,
html:not([data-auth="guest"]) .when-can-login { display: none !important; }

/* --- login --- */
#login { width: min(var(--card-w-narrow), 100% - 2 * var(--gutter)); }
#login h1 { font-size: var(--text-heading); }
#login .lead { font-size: var(--text-md); margin-top: calc(-1 * var(--space-1)); }
#loginForm { display: flex; flex-direction: column; gap: var(--space-4); }

/* --- account chip (top right, with the intro) --- */
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.account-error { color: var(--danger); white-space: normal; max-width: min(360px, 70vw); }

/* --- "Moje hry": profile, statistics, history --- */
#profile { width: min(var(--card-w-wide), 100% - 2 * var(--gutter)); }
.profile-head { display: flex; align-items: center; gap: var(--space-4); }
.profile-head h1 { font-size: var(--text-heading); overflow-wrap: anywhere; }
.profile-head p:not(.eyebrow) { font-size: var(--text-sm); overflow-wrap: anywhere; }
.nick-form { display: flex; align-items: flex-end; gap: var(--space-3); }
.account-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.nick-form .field { flex: 1; }
.history { list-style: none; margin: 0; padding: 0; }
.history > li { border-top: 1px solid var(--line); }
.history > li:last-child { border-bottom: 1px solid var(--line); }

/* --- friends: the list, the invite, the code from a friend; the invite confirmation --- */
#friends, #friend, #invite { width: min(var(--card-w-wide), 100% - 2 * var(--gutter)); }
#friends h1 { font-size: var(--text-heading); }
/* the tabs stay put when switching: the card keeps the height of the tallest usual panel */
#friends { min-height: min(760px, 100% - 2 * var(--dock-gap)); }
.friend-game { margin: calc(-1 * var(--space-1)) 0 var(--space-2) 52px; }            /* a game under a friend's row, from the name on */
.board-game, .day-game { margin-left: 84px; }      /* under a row with a rank */
.board-game .total-pts { display: none; }               /* the points are in the row already */
.board-note { font-size: var(--text-sm); }
p.friend-game { font-size: var(--text-sm); }            /* today's game of a friend before the player's: points only */
#todayPlay { align-self: flex-start; }                   /* the Dnes tab: to the intro, before the player's own game */
.invite-box { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--line); }
#friendList:not(:empty) ~ .invite-box { padding-top: 0; border-top: 0; }   /* the list's own bottom line divides */
.invite-box .btn-secondary { align-self: flex-start; }
.invite-ready { display: flex; flex-direction: column; gap: var(--space-3); }
.code-form { display: flex; align-items: flex-end; gap: var(--space-3); }
.code-form .field { flex: 1; }
.code-form input { text-transform: uppercase; letter-spacing: .06em; }
.person-actions .btn-secondary { min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-md); }   /* 44 px: the smallest control */

/* --- a friend's profile (#friend): the header, the numbers, the badges to compare, removing the friend --- */
#friend { gap: var(--space-6); }
#friend .profile-head > div { min-width: 0; }
.friend-badges { gap: var(--space-6); }
.friend-badges > .btn-secondary { align-self: flex-start; }
.friend-remove { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.friend-remove .person-confirm { padding: 0; }

/* --- "Přátelé dnes" on the summary: the day's ranking of the player and the friends --- */
.day-box[data-mode=""] { display: none; }
.day-box { display: flex; flex-direction: column; gap: var(--space-3); }

@media (max-width: 640px) {
  #login, #profile, #friends, #friend, #invite { width: auto; }
  #friends { min-height: min(560px, 100% - 2 * var(--gutter)); }
  .friend-game, .board-game, .day-game { margin-left: 0; }
}
