.player-avatar img, .profile-avatar { image-rendering: pixelated; display: block; }
.player-avatar img { width: 100%; height: 100%; border-radius: inherit; }
.header-user { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.header-user img { border-radius: 6px; image-rendering: pixelated; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
html.is-loading main { opacity: .6; transition: opacity .15s; }
main { min-height: 60vh; }

.page-narrow .container { max-width: 640px; }
.page-title { font-size: 34px; margin: 0 0 20px; }
.panel { padding: 28px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); }
.panel h1 { font-size: 28px; margin: 0 0 16px; }
.panel h2 { font-size: 20px; margin: 0 0 14px; }
.panel-center { text-align: center; }
.panel-center .button { margin-top: 12px; }
.muted { color: var(--text-soft); }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-weight: 700; }
.field span { font-size: 14px; }
.field small { font-weight: 400; color: var(--text-faint); }
.field input, .search input, .table select, .table input[type="number"] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.field input[type="file"] { height: auto; padding: 10px 14px; }
.field input:focus, .search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.check input::after {
  content: "";
  width: 11px;
  height: 6px;
  margin-top: -2px;
  border-left: 3px solid var(--accent-text);
  border-bottom: 3px solid var(--accent-text);
  transform: rotate(-45deg) scale(0);
  transition: transform .12s var(--ease);
}
.check input:hover { border-color: var(--accent); }
.check input:checked { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 14px rgba(255, 225, 77, .35); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input:disabled { opacity: .5; cursor: not-allowed; }
.check span { padding-top: 1px; }
.field-error { margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.form-foot { margin: 18px 0 0; text-align: center; color: var(--text-soft); }

.alert { margin-top: 20px; padding: 14px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-raised); font-weight: 600; }
.alert-success { border-color: var(--online); }
.alert-error { border-color: var(--danger); }

.tabs { display: flex; gap: 6px; margin-bottom: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 700; color: var(--text-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--heading); border-bottom-color: var(--accent); }

.search { margin-bottom: 20px; width: 100%; }
.empty { color: var(--text-soft); }
.load-more { margin-top: 24px; text-align: center; }

.profile { display: flex; gap: 24px; align-items: center; }
.profile-avatar { width: 96px; height: 96px; border-radius: var(--radius); }
.profile h1 { margin-bottom: 8px; }
.profile p { margin: 4px 0; }
.profile-main { flex: 1; min-width: 0; }
.profile-main p { display: flex; align-items: center; min-width: 0; }
.profile-main .badge, .profile-main .status-text { flex-shrink: 0; }
.status-visit { margin-left: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 400; color: var(--text-faint); }
.status-text { display: inline-flex; align-items: center; gap: 8px; }
.profile .badge { margin-right: 10px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.profile-stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.profile-stat span { font-size: 12.5px; color: var(--text-faint); }
.profile-stat strong { font-size: 16px; font-weight: 700; }
.profile-stat strong.is-online { color: var(--online); }
.status-text { font-size: 13px; font-weight: 600; }
.status-text.is-online { color: var(--online); }
.status-text.is-offline { color: var(--danger); }
.status-text.is-offline .status-dot { background: var(--danger); box-shadow: 0 0 0 0 rgba(229, 72, 63, .6); animation: pulse-offline 2s infinite; }
@keyframes pulse-offline {
  70% { box-shadow: 0 0 0 8px rgba(229, 72, 63, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 72, 63, 0); }
}
.skin-layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: stretch; }
.skin-preview { flex: none; display: flex; flex-direction: column; padding: 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); text-align: center; }
.skin-viewer { display: block; flex: 1; width: 240px; min-height: 340px; cursor: grab; touch-action: none; }
.skin-viewer.Dragging { cursor: grabbing; }
.skin-hint { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.skin-forms { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 18px; }
.skin-forms .form { margin: 0; }
.skin-raw { margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.skin-raw img {
  display: block;
  width: 192px;
  height: 192px;
  image-rendering: pixelated;
  background: repeating-conic-gradient(rgba(255, 255, 255, .08) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
}
.skin-raw figcaption { font-size: 12.5px; color: var(--text-faint); }

.table-wrap { overflow-x: auto; margin-bottom: 20px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table select { width: auto; height: 36px; }
.table input[type="number"] { width: 72px; height: 36px; }
.button-small { height: 36px; padding: 0 12px; font-size: 13px; }

@media (max-width: 560px) {
  .panel { padding: 20px; }
  /* Aperçu du skin sur toute la largeur */
  .skin-layout { gap: 20px; }
  .skin-preview { width: 100%; box-sizing: border-box; }
  .skin-viewer { width: 100%; }
  /* Onglets (Compte, Skin, Confidentialité, Sécurité) : deux par ligne au lieu d'une barre qui dépasse */
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 0; overflow: visible; }
  .tab { padding: 11px 8px; text-align: center; white-space: normal; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .tab.is-active { border-color: var(--accent); }
  .skin-raw { display: none; } /* fichier brut du skin : version ordinateur seulement */
  .profile { flex-direction: column; align-items: flex-start; }
  .header-user span { display: none; }
}

.player-name { display: flex; align-items: center; gap: 8px; }
.player-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-name .badge { flex: none; margin-left: 0; }

.avatar-rank {
  position: absolute;
  left: -4px;
  bottom: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-raised);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #111;
  background: var(--rarity-rare);
}
.avatar-rank-admin { background: var(--rarity-legendary); }

.table select, .table input[type="number"] {
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}
.table select option { background: var(--bg-raised); color: var(--text); }

.table select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239a9fb0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.profile-islands { margin-top: 16px; }
.profile-islands-title { margin: 0 0 14px; font-size: 1.1rem; }
.profile-islands-count { font-weight: 400; color: var(--text-faint); }
.island-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.island-card { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, .04); overflow: hidden; }
.island-card img { display: block; width: 100%; height: auto; aspect-ratio: 600 / 380; object-fit: contain; }
.island-card figcaption { padding: 8px 12px; border-top: 1px solid var(--border); font-size: .9rem; color: var(--text-soft); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[hidden] { display: none !important; }

.island-link { display: block; color: inherit; text-decoration: none; }
.island-link .island-card { transition: border-color .15s; }
.island-link:hover .island-card { border-color: var(--text-faint); }
.island-title { margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); font-size: 1.5rem; overflow-wrap: anywhere; }
.island-hero { max-width: 600px; margin: 0 auto; }
.profile-stat strong a { color: inherit; }

/* Page de téléchargement */
.download-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 26px 0 6px; }
.download-item { display: grid; gap: 8px; justify-items: center; }
.download-item small { color: var(--text-faint); font-size: 13px; }
.download-btn { width: 100%; height: auto; flex-direction: column; gap: 12px; padding: 26px 16px 22px; }
.download-btn svg { width: 56px; height: 56px; fill: currentColor; flex: none; }
.download-btn span { font-size: 18px; }
.download-btn.is-soon { opacity: .5; cursor: not-allowed; border-color: var(--border-strong); }
.download-btn.is-soon:hover { border-color: var(--border-strong); }
.download-account { margin: 22px 0 0; }
@media (max-width: 560px) { .download-grid { grid-template-columns: 1fr; } }

/* Page de téléchargement vue depuis un mobile */
.download-mobile svg { width: 64px; height: 64px; margin-bottom: 14px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.download-mobile h1 { font-size: 24px; }
.download-mobile .button { margin-top: 20px; }

/* Page légale */
.legal .container { max-width: 760px; }
.legal h2 { margin-top: 26px; }
.legal h2:first-of-type { margin-top: 0; }
.legal ul { margin: 0 0 14px; padding-left: 20px; }
.legal li { margin: 0 0 8px; line-height: 1.55; }
.legal p { line-height: 1.6; }
.legal code { padding: 1px 6px; border-radius: 6px; background: var(--bg-sunken, rgba(127,127,127,.15)); }
