/* ══ Profile Dialog Overlay ══ */
.profile-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 520px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  color: var(--text);
  font-family: var(--font-mono);
  margin: auto;
  outline: none;
}

.profile-dialog::backdrop {
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(14, 13, 20, 0.97) 0%,
    rgba(8, 7, 14, 0.95) 60%,
    transparent 100%
  );
}

/* ══ Profile Container ══ */
.profile {
  position: relative;
  padding: 32px 28px;
}

/* ══ Close Button ══ */
.profile .close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font: 400 18px/1 var(--font-mono);
  color: var(--close-btn);
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.profile .close-btn:hover {
  color: var(--text-bright);
}

/* ══ Avatar (large, centered) ══ */
.profile .p-avatar {
  font: 400 22px/24px var(--font-mono);
  white-space: pre;
  text-align: center;
  margin-bottom: 16px;
  color: var(--avatar-common);
}

.profile.r-legendary .p-avatar { color: var(--avatar-legendary); }
.profile.r-epic .p-avatar      { color: var(--avatar-epic); }
.profile.r-rare .p-avatar      { color: var(--avatar-rare); }
.profile.r-uncommon .p-avatar  { color: var(--avatar-uncommon); }

/* ══ Name ══ */
.profile .p-name {
  font: 700 24px/1.3 var(--font-mono);
  color: var(--name-common);
  text-align: center;
  word-break: break-word;
  margin-bottom: 4px;
}

.profile.r-legendary .p-name { color: var(--name-legendary); }
.profile.r-epic .p-name      { color: var(--name-epic); }
.profile.r-rare .p-name      { color: var(--name-rare); }
.profile.r-uncommon .p-name  { color: var(--name-uncommon); }

/* ══ Rarity Line ══ */
.profile .p-rarity {
  font: 400 12px/1.6 var(--font-mono);
  text-align: center;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.profile .p-rarity.common    { color: var(--rarity-common); }
.profile .p-rarity.uncommon  { color: var(--rarity-uncommon); }
.profile .p-rarity.rare      { color: var(--rarity-rare); }
.profile .p-rarity.epic      { color: var(--rarity-epic); }
.profile .p-rarity.legendary { color: var(--rarity-legendary); }

/* ══ Description ══ */
.profile .p-desc {
  font: italic 400 13px/1.6 var(--font-serif);
  color: var(--desc);
  text-align: center;
  word-break: break-word;
  margin-bottom: 2px;
}

/* ══ Separator ══ */
.profile .p-sep {
  color: #2a2418;
  text-align: center;
  font: 400 13px/1 var(--font-mono);
  margin: 12px 0;
}

/* ══ Combat Section (HP/MP/ATK) ══ */
.profile .p-combat {
  margin-bottom: 4px;
}

.profile .p-atk {
  font: 400 13px/1.8 var(--font-mono);
  color: var(--profile-stat-label);
  padding-left: 38px;
}

/* ══ Stat Sections ══ */
.profile .p-stat-section {
  margin-bottom: 4px;
}

/* Companion stat labels */
.profile .p-stat-section.companion .p-rpg-label {
  color: var(--profile-stat-label);
}

/* RPG stat labels */
.profile .p-stat-section.rpg .p-rpg-label {
  color: var(--profile-rpg-label);
}

/* ══ XP Section ══ */
.profile .p-xp-section {
  margin-bottom: 4px;
}

.profile .p-xp-pct {
  font: 400 11px/1.6 var(--font-mono);
  color: var(--bar-label);
  text-align: center;
  margin-top: 2px;
}

/* ══ Footer Stats ══ */
.profile .p-footer-stats {
  font: 400 13px/1.8 var(--font-mono);
  color: var(--text-muted);
  text-align: center;
}

/* ══ Loading Skeleton ══ */
.profile .p-skeleton {
  text-align: center;
  padding: 48px 16px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.profile .p-skeleton-avatar {
  font: 400 22px/24px var(--font-mono);
  white-space: pre;
  color: var(--text-ghost);
  margin-bottom: 16px;
}

.profile .p-skeleton-line {
  color: var(--text-ghost);
  font: 400 14px/2.2 var(--font-mono);
}

/* ══ Error State ══ */
.profile .p-error {
  text-align: center;
  padding: 48px 16px;
}

.profile .p-error-icon {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--error);
}

.profile .p-error-msg {
  font: 400 14px/1.4 var(--font-mono);
  color: var(--text-muted);
}

/* ══ Dialog Animations ══ */
.profile-dialog[open] {
  animation: dialog-in 0.2s ease-out;
}
.profile-dialog[open]::backdrop {
  animation: backdrop-in 0.25s ease-out;
}
@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.profile-dialog.dialog-closing {
  animation: dialog-out 0.15s ease-in forwards;
}
.profile-dialog.dialog-closing::backdrop {
  animation: backdrop-out 0.15s ease-in forwards;
}
@keyframes dialog-out {
  to { opacity: 0; transform: scale(0.97); }
}
@keyframes backdrop-out {
  to { opacity: 0; }
}

/* ══ Auth Error Dialog ══ */
.auth-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 420px;
  width: 85vw;
  margin: auto;
  outline: none;
}

.auth-dialog::backdrop {
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(14, 13, 20, 0.97) 0%,
    rgba(8, 7, 14, 0.95) 60%,
    transparent 100%
  );
}

.auth-dialog[open] {
  animation: dialog-in 0.2s ease-out;
}

.auth-dialog[open]::backdrop {
  animation: backdrop-in 0.25s ease-out;
}

.auth-modal {
  padding: 32px 28px;
  text-align: center;
}

.auth-icon {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.auth-title {
  font: 700 18px/1.4 var(--font-mono);
  color: var(--text-bright);
  margin-bottom: 8px;
}

.auth-message {
  font: 400 13px/1.6 var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.auth-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.auth-btn {
  font: 400 14px/1 var(--font-mono);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  transition: color 0.2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.auth-btn:hover {
  color: var(--text-bright);
}

.auth-btn-primary {
  color: var(--accent);
}

.auth-btn-primary:hover {
  color: var(--text-bright);
}

/* ══ How To Use Dialog ══ */
.howto-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 480px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  margin: auto;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);

  /* Scoped howto color palette — RPG-Terminal hybrid */
  --howto-title:     #e8c964;  /* bright gold */
  --howto-step:      #c8b890;  /* parchment */
  --howto-cmd:       #5edcb6;  /* enchanted teal */
  --howto-cmd-desc:  #a08a9e;  /* dusty mauve */
  --howto-url:       #6aace0;  /* potion blue */
  --howto-note:      #8898a0;  /* cool slate */
  --howto-category:  #7a8a7a;  /* sage */
}

.howto-dialog::backdrop {
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(14, 13, 20, 0.97) 0%,
    rgba(8, 7, 14, 0.95) 60%,
    transparent 100%
  );
}

.howto-dialog[open] {
  animation: dialog-in 0.2s ease-out;
}
.howto-dialog[open]::backdrop {
  animation: backdrop-in 0.25s ease-out;
}

.howto-modal {
  position: relative;
  padding: 28px 24px;
}

.howto-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font: 400 16px/1 var(--font-mono);
  color: var(--close-btn);
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.howto-close:hover { color: var(--text-bright); }

.howto-title {
  font: 700 20px/1.4 var(--font-mono);
  color: var(--text-bright);
  text-align: center;
  margin-bottom: 20px;
}

.howto-section-title {
  font: 700 14px/1.4 var(--font-mono);
  color: var(--howto-title);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  margin-top: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}

.howto-step {
  font: 400 12px/1.8 var(--font-mono);
  color: var(--howto-step);
}

.howto-code {
  font: 400 12px/1.8 var(--font-mono);
  color: var(--howto-cmd);
  padding-left: 16px;
}

.howto-line {
  font: 400 12px/1.8 var(--font-mono);
  color: var(--howto-cmd);
}

.howto-url {
  display: block;
  color: var(--howto-url);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding-left: 16px;
  font: 400 12px/1.8 var(--font-mono);
  cursor: pointer;
  transition: color 0.2s;
}
.howto-url:hover {
  color: var(--text-bright);
}

.howto-sep {
  color: var(--border-light);
  font: 400 12px/1 var(--font-mono);
  margin: 16px 0;
}

/* Quick Start: two-column command rows */
.howto-cmd-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 12px;
  line-height: 1.8;
}

.howto-cmd {
  font: 400 12px/1.8 var(--font-mono);
  color: var(--howto-cmd);
  min-width: 220px;
}

.howto-cmd-desc {
  font: italic 400 12px/1.8 var(--font-serif);
  color: var(--howto-cmd-desc);
}

.howto-spacer {
  margin: 8px 0;
}

/* Privacy: consent categories */
.howto-category {
  font: 400 12px/1.8 var(--font-mono);
  color: var(--howto-category);
  padding-left: 16px;
}

/* Privacy / informational notes */
.howto-note {
  font: italic 400 12px/1.8 var(--font-serif);
  color: var(--howto-note);
}

/* ══ How To Use Button (header) ══ */
.howto-btn {
  font: 400 14px/1 var(--font-mono);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.25s;
  border-bottom: 1px solid transparent;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.howto-btn:hover {
  color: var(--text-bright);
}
