.appwrap{
  max-width: 1100px;
  margin: 24px auto 80px;
  padding: 0 16px;
}

.card{
  background: rgba(10,14,22,.65);
  border: 1px solid rgba(124,77,255,.25);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  padding: 18px;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px){
  .grid2, .grid3{ grid-template-columns: 1fr; }
}

.h1{
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 38px;
  margin: 18px 0 14px;
  letter-spacing: .4px;
}

.muted{ opacity: .75; }

.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
  margin: 10px 0;
}
.field label{
  font-weight: 800;
  opacity: .85;
  font-size: 13px;
}

.input, .textarea, .select{
  width: 100%;
  background: rgba(20,30,50,.55);
  border: 1px solid rgba(124,77,255,.25);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.textarea{ min-height: 110px; resize: vertical; }

.input:focus, .textarea:focus, .select:focus{
  border-color: rgba(0,179,255,.55);
  box-shadow: 0 0 0 3px rgba(0,179,255,.18), 0 14px 34px rgba(0,0,0,.35);
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}

.btn{
  background: rgba(0,179,255,.15);
  border: 1px solid rgba(0,179,255,.35);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 900;
  cursor:pointer;
  transition: transform .06s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, filter .16s ease;
}
.btn:hover{
  border-color: rgba(0,179,255,.70);
  background: rgba(0,179,255,.22);
  box-shadow: 0 0 0 3px rgba(0,179,255,.20), 0 10px 28px rgba(0,0,0,.35);
  filter: brightness(1.05);
}
.btn:active{
  transform: translateY(1px);
  box-shadow: 0 0 0 3px rgba(0,179,255,.16), 0 6px 18px rgba(0,0,0,.32);
}
.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

.btn.ghost{
  background: rgba(124,77,255,.12);
  border-color: rgba(124,77,255,.35);
}
.btn.ghost:hover{
  border-color: rgba(124,77,255,.70);
  background: rgba(124,77,255,.18);
  box-shadow: 0 0 0 3px rgba(124,77,255,.18), 0 10px 28px rgba(0,0,0,.35);
}
.btn.danger{
  background: rgba(255,77,109,.12);
  border-color: rgba(255,77,109,.45);
}
.btn.danger:hover{
  border-color: rgba(255,77,109,.75);
  background: rgba(255,77,109,.18);
  box-shadow: 0 0 0 3px rgba(255,77,109,.18), 0 10px 28px rgba(0,0,0,.35);
}

.btn:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,179,255,.22), 0 14px 34px rgba(0,0,0,.35);
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(124,77,255,.35);
  background: rgba(20,30,50,.6);
  font-weight: 900;
  font-size: 12px;
}
.pill.ok{ border-color: rgba(29,209,161,.55); }
.pill.bad{ border-color: rgba(255,77,109,.65); }
.pill.priv{ border-color: rgba(124,77,255,.45); }

.deckCard{
  display:flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(124,77,255,.20);
  background: rgba(10,14,22,.45);
}
.cover{
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 1px solid rgba(124,77,255,.25);
  background: rgba(20,30,50,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.cover img{ width:100%; height:100%; object-fit: cover; }

.deckMeta{ flex: 1; min-width: 220px; }
.deckTitle{ font-weight: 1000; letter-spacing: .3px; }
.deckActions{ display:flex; gap: 8px; flex-wrap: wrap; justify-content:flex-end; }

.details{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(124,77,255,.15);
  opacity: .92;
  font-size: 13px;
}
.details ul{ margin: 8px 0 0; padding-left: 18px; }
.details li{ margin: 4px 0; }

.avatarBox{ display:flex; gap: 14px; align-items:center; }
.avatarImg{
  width: 82px;
  height: 82px;
  border-radius: 18px;
  border: 1px solid rgba(124,77,255,.25);
  background: rgba(20,30,50,.45);
  overflow:hidden;
}
.avatarImg img{ width:100%; height:100%; object-fit: cover; }

.hr{ height:1px; background: rgba(124,77,255,.15); margin: 14px 0; }

.errorBox{
  border:1px solid rgba(255,77,109,.55);
  background: rgba(255,77,109,.10);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
}

/* =========================================================
   Profile: public link + social links
========================================================= */
.public-link .row { align-items:center; gap:10px; flex-wrap:wrap; }
.public-link a.mono { overflow-wrap:anywhere; }

#links_list { display:flex; flex-direction:column; gap:10px; margin-top:10px; }
.linkRow {
  display:grid;
  grid-template-columns: 160px 220px 1fr 44px;
  gap:10px;
  align-items:center;
}

.btn.icon { width:44px; padding-left:0; padding-right:0; text-align:center; }

@media (max-width: 900px) {
  .linkRow { grid-template-columns: 1fr; }
  .btn.icon { width:100%; }
}

/* Username hint styling */
.username-hint {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 6px;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* =========================
   Role tags (DB-controlled)
========================= */
.roleLine { margin-bottom: 10px; }
.roleTags {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  vertical-align: middle;
}

.roleTag {
  font-size: 12px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.92);
  letter-spacing: .2px;
}

/* subtle styling per role (small, not loud) */
.role-admin { border-color: rgba(255,77,109,.55); background: rgba(255,77,109,.12); }
.role-moderator { border-color: rgba(0,179,255,.55); background: rgba(0,179,255,.12); }
.role-tournament_host { border-color: rgba(124,77,255,.55); background: rgba(124,77,255,.12); }
.role-dueltainer { border-color: rgba(0,255,170,.45); background: rgba(0,255,170,.10); }
.role-member { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06); }
.role-none { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06); }

/* =========================
   USER PROFILE (user.html)
========================= */

.userHero { padding: 18px; }
.userHeroRow {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  align-items: start;
}
.userAvatarWrap {
  width: 110px;
  height: 110px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
#u_avatar {
  width: 110px;
  height: 110px;
  object-fit: cover;
  display: none; /* user.js will show it when present */
}

.userNameRow {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.userUsername {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.userDisplay { margin-top: 4px; }
.userBio { margin-top: 10px; line-height: 1.5; }

.linksGrid .row {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  margin-bottom: 10px;
}
.linksGrid a { word-break: break-word; }

.decksGrid .deckRow {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  margin-bottom: 10px;
}

/* Role tags (small, clean) */
.roleTags { display:flex; gap:6px; flex-wrap:wrap; }
.roleTag {
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  white-space: nowrap;
}

/* Optional: role colors if you want subtle differentiation */
.role-admin { border-color: rgba(255, 60, 120, .35); background: rgba(255, 60, 120, .10); }
.role-moderator { border-color: rgba(0, 200, 255, .35); background: rgba(0, 200, 255, .10); }
.role-tournament_host { border-color: rgba(255, 200, 0, .35); background: rgba(255, 200, 0, .10); }
.role-dueltainer { border-color: rgba(124, 77, 255, .35); background: rgba(124, 77, 255, .10); }
.role-member { border-color: rgba(160, 160, 160, .25); background: rgba(160, 160, 160, .08); }

/* Admin panel layout */
.adminCard { border: 1px solid rgba(255, 60, 120, .18); }
.adminGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .userHeroRow { grid-template-columns: 1fr; }
  .adminGrid { grid-template-columns: 1fr; }
}

/* Role picker checkboxes (used by user.js) */
.rolePick {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  margin-bottom: 10px;
}
.rolePick input { transform: scale(1.15); }

/* =========================================================
   MY DECKS (decks.html) — cleaner + more compact
   Page-scoped: only affects <body class="page-decks">
========================================================= */

.page-decks .appwrap{
  max-width: 1180px;
  margin-top: 18px;
  margin-bottom: 60px;
}

.page-decks .h1{
  font-size: 34px;
  margin: 12px 0 10px;
}

/* tighter grid */
.page-decks .grid2{ gap: 12px; }

/* general card padding smaller */
.page-decks .card{
  padding: 14px;
  border-radius: 16px;
}

/* deck header block */
.page-decks .deckCard{
  padding: 10px;
  gap: 10px;
  border-radius: 14px;
}

/* smaller cover */
.page-decks .cover{
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

/* pills smaller */
.page-decks .pill{
  font-size: 11px;
  padding: 4px 8px;
  gap: 6px;
}

/* inputs smaller */
.page-decks .input,
.page-decks .select{
  padding: 8px 10px;
  border-radius: 10px;
}

/* buttons smaller + more consistent */
.page-decks .btn{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

/* make deck action buttons a clean 2x2 grid */
.page-decks .deckActions{
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
  justify-content: end;
}
.page-decks .deckActions .btn{
  min-width: 86px;
}

/* make legality details smaller */
.page-decks .details{
  margin-top: 8px;
  padding-top: 8px;
  font-size: 12px;
}
.page-decks .details ul{
  margin-top: 6px;
}

/* reduce extra spacing on rows inside deck cards */
.page-decks .deckMeta .row{
  gap: 6px;
}

/* mobile: action buttons full width */
@media (max-width: 520px){
  .page-decks .deckActions{
    grid-template-columns: 1fr 1fr;
    width: 100%;
    justify-content: stretch;
  }
  .page-decks .deckActions .btn{
    width: 100%;
  }
}

/* =========================================================
   MY DECKS – One-line toolbar layout (tight + stable)
========================================================= */

.page-decks .decksToolbar{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 18px 0 20px;
}

/* left side (search) */
.page-decks .toolbarLeft{
  flex: 1 1 auto;
  min-width: 260px;
  max-width: 520px;
}

/* right side controls (keep on one line) */
.page-decks .toolbarRight{
  display:flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;          /* KEY: don’t wrap on desktop */
  white-space: nowrap;
}

/* each group */
.page-decks .toolbarGroup{
  display:flex;
  align-items:center;
  gap: 8px;
}

/* labels */
.page-decks .toolbarLabel{
  font-size: 12px;
  opacity: .7;
  font-weight: 700;
}

/* selects: consistent size but not huge */
.page-decks .toolbarRight .select{
  width: 160px;               /* forces consistent width */
  min-width: 160px;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* deck count */
.page-decks .deckCount{
  font-size: 12px;
  opacity: .7;
  min-width: 40px;
  text-align: right;
  padding-top: 2px;
}

/* Responsive: allow wrap only when screen is genuinely small */
@media (max-width: 860px){
  .page-decks .decksToolbar{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-decks .toolbarLeft{
    max-width: none;
  }

  .page-decks .toolbarRight{
    flex-wrap: wrap;          /* ok to wrap on mobile */
    white-space: normal;
    justify-content: space-between;
  }

  .page-decks .toolbarRight .select{
    width: 100%;
    min-width: 0;
  }

  .page-decks .toolbarGroup{
    flex: 1 1 240px;
  }
}