/* ================= LIST EDITOR (editor.js) + PROFILE (profile.html) =================
   Loaded after styles.css on game.html and profile.html. */

/* ---------- editor: one glass sheet — score + verdict, half-point slider, status pills, details, review ---------- */
.is-locked { overflow: hidden; }
.ed { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.ed__backdrop { position: absolute; inset: 0; background: rgba(5, 5, 6, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s; }
.ed__card {
  position: relative; width: min(640px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 22px; padding: 24px 26px 0; display: grid; gap: 18px;
  background: rgba(16, 16, 18, 0.94); border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 120px rgba(0, 0, 0, 0.6);
  transform: translateY(12px) scale(0.98); opacity: 0; transition: transform 0.25s var(--ease), opacity 0.2s;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.ed__card::-webkit-scrollbar { width: 8px; }
.ed__card::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
.ed__card::-webkit-scrollbar-track { background: transparent; }
.ed.is-open .ed__backdrop { opacity: 1; }
.ed.is-open .ed__card { transform: none; opacity: 1; }
.ed__x { position: absolute; top: 16px; left: 16px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.ed__x:hover { color: var(--paper); background: rgba(255, 255, 255, 0.06); }
.ed__x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.ed__head { display: grid; grid-template-columns: 84px 1fr; gap: 18px; align-items: center; padding-left: 40px; }
.ed__cover { width: 84px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--ink-2); border: 1px solid var(--line); }
.ed__cover img { width: 100%; height: 100%; object-fit: cover; }
.ed__score { display: flex; align-items: baseline; gap: 12px; }
.ed__score strong { font-size: 54px; font-weight: 500; line-height: 1; color: var(--red); letter-spacing: -0.03em; }
.ed__score span { font-family: var(--f-display); font-weight: 700; font-size: 16px; color: var(--paper); }
.ed__score strong.is-empty { color: var(--faint); font-size: 40px; }
.ed__score strong.is-empty + span { color: var(--muted); font-weight: 500; font-size: 14px; }
.ed__headtext { min-width: 0; text-align: right; }
.ed__headtext h2 { unicode-bidi: plaintext; text-align: right; margin: 8px 0 0; font-family: var(--f-display); font-weight: 700; font-size: 20px; line-height: 1.35; }

.ed__block { display: grid; gap: 10px; }
.ed__label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Rating: the same ten boxes as the game page, each split in two halves (left half = .5, LTR like the page's meters). */
.ed__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ed__hint { font-size: 12px; color: var(--faint); }
.ed__clear { font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.ed__clear:hover { color: var(--paper); }
.ed__rate { padding: 14px 14px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.ed__pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; direction: ltr; border-radius: 8px; outline: none; cursor: pointer; }
.ed__pips:focus-visible { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px rgba(243, 241, 238, 0.6); }
.ed__pip { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 30px auto; row-gap: 7px; }
.ed__pip i { background: rgba(255, 255, 255, 0.08); transition: background 0.12s; }
.ed__pip i:first-child { border-radius: 4px 0 0 4px; }
.ed__pip i:nth-child(2) { border-radius: 0 4px 4px 0; }
.ed__pip i.on { background: var(--red); }
.ed__pips.is-preview .ed__pip i.on { background: rgba(229, 20, 29, 0.6); }
.ed__pip b { grid-column: 1 / -1; text-align: center; font-family: var(--f-mono); font-weight: 400; font-size: 11px; color: var(--faint); }
.ed__pip:has(i:nth-child(2).on) b { color: var(--muted); }

/* Status pills (also used on the game page) */
.ed__status { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.st {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding-inline: 10px; border-radius: 12px;
  font-size: 13.5px; color: rgba(243, 241, 238, 0.75); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.st svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.st:hover { border-color: var(--line-2); color: var(--paper); }
.st[aria-checked="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); font-weight: 600; }

.ed__details summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; width: max-content; }
.ed__details summary::-webkit-details-marker { display: none; }
.ed__details summary svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; transition: transform 0.2s; }
.ed__details[open] summary svg { transform: rotate(180deg); }
.ed__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ed__field--wide { margin-top: 12px; }
.ed__plats { display: flex; flex-wrap: wrap; gap: 6px; }
.ed__plats button { height: 36px; padding-inline: 14px; border-radius: 10px; font-size: 13px; color: rgba(243, 241, 238, 0.8); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2); transition: background 0.15s, color 0.15s, border-color 0.15s; }
.ed__plats button:hover { color: var(--paper); border-color: rgba(255, 255, 255, 0.25); }
.ed__plats button[aria-checked="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); font-weight: 600; }
.ed__field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.ed__field select, .ed__field input {
  height: 42px; padding-inline: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2);
  color: var(--paper); font: 400 14px var(--f-body); color-scheme: dark; min-width: 0;
}
.ed__field select:focus, .ed__field input:focus { outline: none; border-color: rgba(255, 255, 255, 0.35); }

.ed__review { border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); transition: border-color 0.2s; }
.ed__review:focus-within { border-color: rgba(255, 255, 255, 0.28); }
.ed__review textarea { display: block; width: 100%; min-height: 120px; resize: vertical; padding: 14px 16px; background: none; border: 0; outline: none; color: var(--paper); font: 400 15px/1.8 var(--f-body); }
.ed__review textarea::placeholder { color: var(--faint); }
.ed__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.ed__spoil { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ed__spoil input { accent-color: var(--red); width: 15px; height: 15px; }
.ed__count { display: inline-flex; align-items: center; gap: 8px; }
.ed__dot { color: var(--faint); }
.ed__count svg { width: 16px; height: 16px; transform: rotate(-90deg); fill: none; stroke-width: 2.4; }
.ed__count circle:first-child { stroke: rgba(255, 255, 255, 0.1); }
.ed__count circle + circle { stroke: var(--red); stroke-dasharray: 50.27; stroke-dashoffset: 50.27; stroke-linecap: round; }

.ed__bar {
  position: sticky; bottom: 0; margin: 0 -26px; padding: 14px 26px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: rgba(16, 16, 18, 0.96); border-top: 1px solid var(--line);
}
.ed__del { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: #ff6b70; padding: 8px 10px; border-radius: 10px; }
.ed__del:hover { background: rgba(229, 20, 29, 0.1); }
.ed__del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed__save { margin-inline-start: auto; min-width: 170px; }
.ed__save:disabled { background: rgba(255, 255, 255, 0.06); color: var(--faint); border-color: transparent; box-shadow: none; cursor: not-allowed; }

/* ---------- game page: "في قائمتك" summary ---------- */
/* "في قائمتك": optional score row, status pills (3 on top, 2 sharing the second row), full-width button.
   #mineBody is its own grid so every part gets the same spacing. */
#mineBody { display: grid; gap: 12px; }
.mine__pills { grid-template-columns: repeat(6, 1fr) !important; gap: 6px; }
.mine__pills .st { grid-column: span 2; height: 40px; font-size: 13px; }
.mine__pills .st:nth-child(n + 4) { grid-column: span 3; }
.mine__edit { width: 100%; margin-top: 2px; }
.mine__entry { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mine__score { font-size: 38px; font-weight: 500; line-height: 1; color: var(--red); text-align: right; }
.mine__score.is-empty { color: var(--faint); }
.mine__sub { display: grid; gap: 3px; min-width: 0; }
.mine__sub b { color: var(--paper); font-weight: 600; font-size: 14px; }
.mine__sub small { color: var(--muted); font-size: 12px; }


/* ---------- reviews on the game page ---------- */
.rev__who { color: var(--paper); font-weight: 600; }
.rev__who:hover { text-decoration: underline; text-underline-offset: 3px; }
.rev__body { margin: 0; white-space: pre-line; }
.rev__spoil { position: relative; }
.rev__spoil .rev__body { filter: blur(7px); user-select: none; }
.rev__reveal { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--paper); }
.rev__reveal span { padding: 8px 14px; border-radius: 10px; background: rgba(10, 10, 11, 0.8); border: 1px solid var(--line-2); }
.rev__spoil.is-open .rev__body { filter: none; user-select: auto; }
.rev__spoil.is-open .rev__reveal { display: none; }
.reviews__empty { padding: 28px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

/* ---------- profile ---------- */
.prof { padding-block: 110px 80px; display: grid; gap: 18px; }
.prof__head { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 28px; display: grid; gap: 22px; }
.prof__banner { position: absolute; inset: 0; z-index: -1; }
.prof__banner img { width: 100%; height: 100%; object-fit: cover; filter: blur(18px) saturate(1.1); transform: scale(1.15); opacity: 0.35; }
.prof__banner::after { content: ""; position: absolute; inset: 0; background: rgba(10, 10, 11, 0.55); }
.prof__id { display: flex; align-items: center; gap: 18px; }
.prof__av { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; flex: none; font-family: var(--f-display); font-weight: 800; font-size: 34px; background: var(--red-ink); border: 1px solid rgba(229, 20, 29, 0.6); }
.prof__id h1 { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(26px, 3vw, 36px); line-height: 1.25; }
.prof__id small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.prof__badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: rgba(229, 20, 29, 0.12); border: 1px solid rgba(229, 20, 29, 0.45); color: var(--paper); }
/* Report a profile picture: quiet until used; red while asking to confirm. */
.prof__report { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 0; font-size: 12px; color: var(--faint); transition: color 0.2s; }
.prof__report:not([hidden]) { display: flex; }
.prof__report:hover:not(:disabled) { color: var(--paper); }
.prof__report.is-armed { color: #ff6b6b; }
.prof__report:disabled { cursor: default; color: var(--muted); }
.prof__report svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.prof__badge svg { width: 14px; height: 14px; fill: none; stroke: #ff5a60; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.prof__stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); padding-top: 18px; }
.prof__stats div { display: grid; gap: 2px; }
.prof__stats div + div { padding-inline-start: 18px; border-inline-start: 1px solid var(--line); }
.prof__stats strong { font-size: 26px; font-weight: 500; line-height: 1.1; text-align: right; }
.prof__stats span { font-size: 12px; color: var(--muted); }

.prof__tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.prof__tabs button { flex: none; display: grid; gap: 2px; justify-items: center; padding: 10px 16px; border-radius: 12px; color: var(--muted); font-size: 13px; border: 1px solid transparent; }
.prof__tabs button b { font-family: var(--f-mono); font-weight: 500; font-size: 17px; color: var(--paper); }
.prof__tabs button:hover { color: var(--paper); }
.prof__tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.06); border-color: var(--line); color: var(--paper); }
.prof__tabs button[aria-selected="true"] b { color: var(--red); }

.prof__tools { display: flex; gap: 10px; align-items: center; }
.prof__search { flex: 1; display: flex; align-items: center; gap: 10px; height: 44px; padding-inline: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.prof__search:focus-within { border-color: rgba(255, 255, 255, 0.28); }
.prof__search svg { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.prof__search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--paper); font: 400 14px var(--f-body); }
/* Dropdown (profile sort): a glass button and a dark listbox, same family as the account menu. */
.dd { position: relative; flex: none; }
.dd__btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding-inline: 14px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); color: var(--paper); font-size: 14px; transition: border-color 0.2s, background 0.2s; }
.dd__btn:hover, .dd__btn[aria-expanded="true"] { border-color: var(--line-2); background: rgba(255, 255, 255, 0.06); }
.dd__btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dd__btn b { font-weight: 600; }
.dd__label { color: var(--muted); }
.dd__chev { transition: transform 0.2s; }
.dd__btn[aria-expanded="true"] .dd__chev { transform: rotate(180deg); }
.dd__menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30; min-width: 200px; margin: 0; padding: 6px; list-style: none;
  border-radius: 14px; background: rgba(16, 16, 18, 0.97); border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: menuIn 0.16s var(--ease);
}
.dd__menu li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 9px; font-size: 14px; color: rgba(243, 241, 238, 0.8); cursor: pointer; outline: none; }
.dd__menu li:hover, .dd__menu li:focus-visible { background: rgba(255, 255, 255, 0.06); color: var(--paper); }
.dd__menu li[aria-selected="true"] { color: var(--paper); font-weight: 600; }
.dd__menu li[aria-selected="true"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prow { position: relative; display: grid; grid-template-columns: 34px 76px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px 12px 18px; border-radius: var(--r-lg); background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); transition: border-color 0.2s, background 0.2s; }
.prow:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }
.prow__rank { font-family: var(--f-mono); font-size: 13px; color: var(--faint); text-align: center; }
.prow__cv { width: 76px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--ink-2); }
.prow__cv img { width: 100%; height: 100%; object-fit: cover; }
.prow__main { min-width: 0; display: grid; gap: 4px; }
.prow__main h3 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 17px; line-height: 1.35; }
.prow__main h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.prow__meta { font-size: 12.5px; color: var(--muted); }
.prow__review { margin: 4px 0 0; font-size: 13.5px; color: rgba(243, 241, 238, 0.78); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prow__review.is-spoiler { color: var(--muted); font-style: italic; }
.prow__side { display: grid; justify-items: center; gap: 6px; min-width: 86px; }
.prow__score { font-family: var(--f-mono); font-size: 32px; font-weight: 500; line-height: 1; color: var(--paper); }
.prow__score.is-top { color: var(--red); }
.prow__score.is-empty { color: var(--faint); font-size: 22px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding-inline: 9px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line-2); color: rgba(243, 241, 238, 0.85); white-space: nowrap; }
.pill svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill--done { background: var(--paper); color: var(--ink); border-color: var(--paper); font-weight: 600; }
.prow__edit { position: relative; z-index: 1; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.prow__edit:hover { color: var(--paper); background: rgba(255, 255, 255, 0.06); }
.prof__empty { padding: 48px 20px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); text-align: center; color: var(--muted); display: grid; gap: 14px; justify-items: center; }

@media (max-width: 760px) {
  .prof__stats { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .prof__stats div:nth-child(3) { padding-inline-start: 0; border-inline-start: 0; }
  .prow { grid-template-columns: 56px 1fr auto; padding: 10px 12px; gap: 12px; }
  .prow__rank { display: none; }
  .prow__cv { width: 56px; }
  .prow__score { font-size: 24px; }
  .prof__tools { flex-direction: column; align-items: stretch; }
  .dd__btn { width: 100%; }
  .dd__menu { inset-inline: 0; }
}
@media (max-width: 620px) {
  .ed { padding: 0; place-items: end stretch; }
  .ed__card { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 22px 18px 0; }
  .ed__bar { margin: 0 -18px; padding-inline: 18px; }
  .ed__head { grid-template-columns: 64px 1fr; }
  .ed__cover { width: 64px; }
  .ed__score strong { font-size: 42px; }
  .ed__status { grid-template-columns: repeat(3, 1fr); }
}
