/* Nexus Game — store page styles: status bar, featured hero, Steam Guard
   panel, library toolbar, game cards, game dialog. */

.main-area { padding-top: 32px; padding-bottom: 40px; }
.show-mobile { display: none; }
.label-short { display: none; }

/* ===== Status bar ===== */
.statusbar { border-bottom: 1px solid var(--border); }
.statusbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; gap: 28px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2);
}
.statusbar-right { margin-inline-start: auto; }
.statusbar-right b { color: var(--text); font-weight: 600; }
.sys-state { display: inline-flex; align-items: center; gap: 9px; }
.live-dot, .status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block;
  background: var(--success); box-shadow: 0 0 0 3px var(--success-soft);
}
.sys-state[data-state="offline"] .live-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ===== Hero row ===== */
.hero-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px;
  margin-bottom: 64px;
}
.hero-row:has(> .featured[data-hidden="true"]) { grid-template-columns: 1fr; }

.featured {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 500px; border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: radial-gradient(120% 120% at 80% 70%, #3a2f8f 0%, #141a3a 45%, #080b16 100%);
  color: #f4f6fb;
}
.featured-art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  transform: scale(1.02); transition: opacity .5s var(--ease);
}
.featured-shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(6, 8, 16, .94) 0%, rgba(6, 8, 16, .72) 38%, rgba(6, 8, 16, .12) 75%),
    linear-gradient(0deg, rgba(6, 8, 16, .7) 0%, transparent 45%);
}
.corner { position: absolute; width: 26px; height: 26px; border-color: var(--accent); border-style: solid; pointer-events: none; }
.corner-tl { top: 24px; left: 24px; border-width: 2px 0 0 2px; }
.corner-br { right: 24px; bottom: 24px; border-width: 0 2px 2px 0; }
.featured-body {
  position: relative; height: 100%; min-height: inherit;
  display: flex; flex-direction: column; justify-content: center;
  padding: 64px 64px 88px;
}
/* "Featured · game name · 01 / 05", a small glass tag in the bottom corner. */
.featured-tag {
  position: absolute; left: 24px; bottom: 24px; z-index: 1;
  display: inline-flex; align-items: center; gap: 10px; max-width: calc(100% - 96px); margin: 0;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(6, 8, 16, .58); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #c9d6ff; font-size: .8rem; line-height: 1.3;
}
.featured-tag-sep { color: rgba(255, 255, 255, .38); }
.featured-tag-name:empty, .featured-tag-name:empty + .featured-tag-sep { display: none; }
.featured-tag-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: #8fb0ff; white-space: nowrap; }
.featured-tag-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #fff; }
.featured-tag-pos { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; color: #9aa6c4; white-space: nowrap; }
.eyebrow {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .22em; text-transform: uppercase;
  color: #8fb0ff; margin-bottom: 18px;
}
.featured-title {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(2.6rem, 5.4vw, 5.6rem); line-height: .92; letter-spacing: -.01em;
  max-width: 13ch; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .35);
}
.featured-meta {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 26px 0 30px;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: #c9d2e8;
}
.featured-meta .status-dot { margin-right: -10px; }
.featured-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.featured-open { display: none; }
/* An advert slide: words under the title instead of the game's details. */
.featured-text {
  max-width: 46ch; margin: 18px 0 26px; color: #dfe5f3; font-size: 1.05rem; line-height: 1.6;
  text-shadow: 0 1px 18px rgba(0, 0, 0, .45);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-meta[data-hidden="true"] + .featured-text { margin-top: 22px; }
.featured-link-arrow svg { width: 18px; height: 18px; }
[dir="rtl"] .featured-link-arrow svg { transform: scaleX(-1); }

.btn-lg { padding: 14px 26px; font-size: .98rem; border-radius: 11px; }
.btn-glass {
  background: rgba(255, 255, 255, .06); color: #f4f6fb; border-color: rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-gradient { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.btn-gradient:hover:not(:disabled) { filter: brightness(1.08); }

/* ===== Side panels ===== */
.side-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.panel {
  border: 1px solid var(--border); border-radius: 18px; padding: 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.panel-title {
  font-family: var(--display); font-size: 1rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
}
.panel-note { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }

.sg-panel { flex: 1; }
.sg-account {
  width: 100%; padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
  font-family: var(--mono); font-size: .9rem; outline: none;
}
.sg-account:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sg-code {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%;
  margin: 18px 0 16px; padding: 0; border: 0; background: none; color: var(--text); cursor: copy;
}
.sg-char {
  display: grid; place-items: center; height: 72px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--surface-2)), var(--bg-2));
  font-family: var(--display); font-size: 2.1rem; font-weight: 600;
}
.sg-code[data-state="empty"] { cursor: default; }
.sg-code[data-state="empty"] .sg-char { color: var(--muted-2); border-color: var(--border); }
.sg-code[data-state="expired"] .sg-char { color: var(--muted-2); text-decoration: line-through; }
.sg-bar { height: 3px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sg-bar span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.sg-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 18px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2);
}
.sg-copy {
  border: 0; background: none; padding: 0; color: var(--accent);
  font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.sg-copy:disabled { color: var(--muted-2); cursor: default; }
.sg-msg { font-size: .8rem; min-height: 1.2em; margin-top: 10px; color: var(--muted); }
.sg-msg[data-tone="error"] { color: var(--danger); }
.sg-msg[data-tone="success"] { color: var(--success); }

.sub-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.sub-label { color: var(--muted); font-size: .92rem; }
.sub-days { font-family: var(--display); font-size: 1.7rem; font-weight: 700; color: var(--text); }
.sub-unit { color: var(--muted); font-size: .86rem; }
.sub-meter { display: flex; gap: 3px; }
.sub-meter i { flex: 1; height: 14px; border-radius: 2px; background: var(--surface-2); }
.sub-meter i.on { background: var(--success); }
.sub-meter.warn i.on { background: var(--warning); }
.sub-meter.bad i.on { background: var(--danger); }

.guest-panel { display: flex; flex-direction: column; gap: 12px; flex: 1; justify-content: center; }
.guest-panel p { font-size: .9rem; line-height: 1.6; margin-bottom: 6px; }
.guest-panel .btn-block + .btn-block { margin-top: 0; }
.stats-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-cell { display: flex; flex-direction: column; gap: 2px; }
.stat-cell b { font-family: var(--display); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-cell span { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }

/* ===== Library header and tools ===== */
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-head h1 {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1; letter-spacing: -.01em;
}
.count { color: var(--accent); }
.lib-hint { color: var(--muted); font-size: .95rem; margin-inline-start: auto; }
.sort-btn {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; color: var(--muted-2);
  border: 1px solid var(--border); background: transparent; border-radius: 8px; padding: 6px 10px;
}
.sort-btn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
#library-h { scroll-margin-top: 90px; }

.lib-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; margin-bottom: 26px; }
.search-field { position: relative; min-width: 0; }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); display: inline-flex;
}
.search-field input {
  width: 100%; height: 54px; padding: 0 52px 0 48px;
  border-radius: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text); font-size: .95rem;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.search-field input::placeholder { color: var(--muted-2); }
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  min-width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 6px;
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
}

.seg {
  display: flex; align-items: center; gap: 4px; padding: 5px; height: 54px;
  border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.seg-btn, .seg-icon {
  height: 100%; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font-size: .92rem; font-weight: 600; white-space: nowrap; transition: background .12s, color .12s;
}
.seg-btn { padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg-n { font-family: var(--mono); font-size: .8rem; font-weight: 500; opacity: .75; }
.seg-ok { color: var(--success); opacity: 1; }
.seg-btn[aria-pressed="true"] .seg-ok { color: #16a34a; }
.seg-icon { width: 44px; display: grid; place-items: center; }
.seg-icon[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ===== Game cards ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.gcard {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  padding: 0; text-align: left; color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 14px;
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s;
}
button.gcard { cursor: pointer; }
.gcard:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
}
.gcard-art { position: relative; aspect-ratio: 460 / 215; background: linear-gradient(135deg, #1a1f3d, #0b0e18); overflow: hidden; }
.gcard-art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.gcard:hover:not(:disabled) .gcard-art img { transform: scale(1.04); }
.gcard-art .no-art { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); }
.gcard-art .no-art .icon { width: 34px; height: 34px; }
.gcard-art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(6, 8, 16, .82));
}
.gcard-tag {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  font-family: var(--mono); font-size: .72rem; color: #e6eaf5;
  padding: 3px 8px; border-radius: 6px; background: rgba(6, 8, 16, .72); border: 1px solid rgba(255, 255, 255, .1);
}
.gcard-status {
  position: absolute; left: 14px; bottom: 12px; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--success);
}
.gcard-body { display: flex; align-items: center; gap: 12px; padding: 16px 18px 18px; }
.gcard-text { flex: 1; min-width: 0; }
.gcard-name {
  font-family: var(--display); font-weight: 600; font-size: 1.02rem; letter-spacing: .02em; text-transform: uppercase;
  line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gcard-count { font-family: var(--mono); font-size: .76rem; color: var(--muted-2); margin-top: 5px; }
.gcard-go {
  flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); color: var(--muted); transition: color .15s, border-color .15s;
}
.gcard:hover:not(:disabled) .gcard-go { color: var(--accent); border-color: var(--accent); }
.gcard:disabled { cursor: not-allowed; opacity: .5; }
.gcard:disabled .gcard-art img { filter: grayscale(1); }
.gcard:disabled .gcard-status { color: var(--muted-2); }
.gcard:disabled .status-dot { background: var(--muted-2); box-shadow: none; }

/* List layout */
.grid.is-list { grid-template-columns: 1fr; gap: 10px; }
.grid.is-list .gcard { flex-direction: row; align-items: center; }
.grid.is-list .gcard-art { width: 180px; flex: none; }
.grid.is-list .gcard-tag { top: 8px; left: 8px; font-size: .66rem; }
.grid.is-list .gcard-status { display: none; }
.grid.is-list .gcard-body { flex: 1; padding: 12px 18px; }
.grid.is-list .gcard-name { -webkit-line-clamp: 1; }

/* ===== Pager ===== */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 34px auto 0; }
.pager-btn {
  min-width: 42px; height: 42px; padding: 0 12px; border-radius: 10px;
  font-family: var(--mono); font-size: .86rem; font-weight: 500;
  background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.pager-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.pager-btn:disabled { cursor: default; opacity: .35; }
.pager-btn[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); opacity: 1; }
.pager-gap { min-width: 20px; text-align: center; color: var(--muted-2); font-family: var(--mono); }

/* ===== Notifications ===== */
.notif-wrap { position: relative; }
.notif-dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--bg);
}
.notif-drop {
  position: absolute; right: 0; top: 46px; width: 320px; max-height: 360px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100; padding: 6px 0;
}
/* On a phone the bell sits mid-header, so a dropdown anchored to it would
   run off the left edge: pin it under the header, full width instead. */
@media (max-width: 600px) {
  .notif-drop { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; }
}
.notif-item { padding: 11px 15px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .msg { font-size: .87rem; }
.notif-item .when { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.notif-empty { padding: 18px; text-align: center; color: var(--muted); font-size: .86rem; }

/* ===== Game dialog ===== */
dialog.game-dialog { width: min(920px, calc(100vw - 32px)); max-height: min(92vh, 640px); padding: 0; }
dialog.game-dialog[open] { display: grid; grid-template-columns: 42% 58%; }
.gd-art { position: relative; min-height: 420px; overflow: hidden; background: radial-gradient(120% 120% at 70% 60%, #3a2f8f, #0c1030 60%, #070a14); color: #f4f6fb; }
.gd-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gd-art-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(6, 8, 16, .92) 0%, rgba(6, 8, 16, .25) 55%, rgba(6, 8, 16, .1) 100%); }
.gd-art-text { position: absolute; left: 30px; right: 30px; bottom: 30px; }
.gd-status {
  display: flex; align-items: center; gap: 9px; margin-bottom: 10px;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--success);
}
.gd-status[data-state="empty"] { color: #9aa3b8; }
.gd-status[data-state="empty"] .status-dot { background: #9aa3b8; box-shadow: none; }
.gd-title {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: .98; overflow-wrap: anywhere;
}
.gd-panel { padding: 30px 32px 28px; overflow-y: auto; min-width: 0; }
.gd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.gd-label { font-family: var(--mono); font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.game-sub { font-size: .84rem; color: var(--muted-2); margin-bottom: 18px; }

.acc-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px;
  padding: 10px 12px 10px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--field);
}
.acc-switch-label { font-size: .9rem; color: var(--muted); }
.acc-switch-ctrl { display: inline-flex; align-items: center; gap: 10px; }
.acc-switch-ctrl .icon-btn { width: 34px; height: 34px; background: transparent; }
.acc-idx { font-family: var(--mono); font-size: .9rem; min-width: 4ch; text-align: center; }

.cred { margin-bottom: 18px; }
.cred-key {
  display: block; margin-bottom: 8px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2);
}
.cred-box {
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding-block: 6px; padding-inline: 18px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2);
}
.cred-text { flex: 1; min-width: 0; font-family: var(--mono); font-size: 1.02rem; overflow-wrap: anywhere; }
.cred-text.masked { letter-spacing: .3em; }
.cred-box .icon-btn { width: 42px; height: 42px; flex: none; background: transparent; }
.cred-box .btn-sm { height: 42px; padding: 0 16px; font-size: .88rem; flex: none; }
.gd-hint { font-size: .86rem; color: var(--muted); line-height: 1.6; margin: 14px 0 16px; }
#use-code { margin-top: 6px; padding: 16px; }
.link-danger {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none;
  color: var(--danger); font-size: .92rem; font-weight: 600;
}
.link-danger:hover { text-decoration: underline; }

.guest-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; padding: 30px 18px;
  border: 1px dashed var(--border-strong); border-radius: 14px; background: var(--field);
}
.guest-box p, .guest-panel p { color: var(--muted); }
.guest-box p { font-size: .9rem; max-width: 34ch; }
.guest-icon {
  width: 48px; height: 48px; border-radius: 13px;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
}
.guest-icon .icon { width: 22px; height: 22px; }

.dialog-actions.no-border { border-top: 0; padding: 4px 0 0; }
.logout-btn { margin-right: auto; color: var(--danger); }

/* ===== Partner referral banner (visits.js) ===== */
.partner-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin: 0 0 20px;
  border-radius: var(--radius); font-size: .92rem;
  background: var(--success-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}
.partner-banner-icon { color: var(--success); display: inline-flex; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .hero-row { grid-template-columns: minmax(0, 1fr) 340px; }
  .featured-body { padding: 52px 44px 80px; }
  .lib-tools { grid-template-columns: 1fr auto; }
  .lib-tools .search-field { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .hero-row { grid-template-columns: 1fr; }
  .side-col { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .featured { min-height: 400px; }
}

@media (max-width: 760px) {
  .statusbar { display: none; }
  .show-mobile { display: inline-flex; }
  .hide-mobile { display: none !important; }
  .label-long { display: none; }
  .label-short { display: inline; }
  .main-area { padding-top: 18px; }

  /* Compact featured card with a single Open button. */
  .hero-row { margin-bottom: 22px; gap: 0; }
  .side-col { display: none; }
  .featured { min-height: 220px; border-radius: 16px; }
  .featured-shade { background: linear-gradient(0deg, rgba(6, 8, 16, .9) 0%, rgba(6, 8, 16, .35) 60%, rgba(6, 8, 16, .15) 100%); }
  .featured-text { font-size: .9rem; -webkit-line-clamp: 2; margin: 8px 0 0; max-width: 62%; }
  .corner { display: none; }
  .featured-tag { top: 14px; bottom: auto; left: 14px; max-width: calc(100% - 28px); padding: 6px 12px; font-size: .74rem; }
  .featured-body { justify-content: flex-end; padding: 22px 20px; padding-right: 110px; }
  .eyebrow { font-size: .66rem; margin-bottom: 6px; }
  .featured-title { font-size: 1.85rem; line-height: .95; -webkit-line-clamp: 2; }
  .featured-meta, .featured-actions { display: none; }
  .featured-open { display: inline-flex; position: absolute; right: 18px; bottom: 22px; padding: 11px 20px; border-radius: 12px; }

  /* Library: search, pill filters, heading with A–Z. */
  .lib-head { order: 2; margin: 18px 0 14px; align-items: center; }
  .lib-head h1 { font-size: 1.6rem; }
  .lib-hint { display: none; }
  .library { display: flex; flex-direction: column; }
  .lib-tools { order: 1; display: flex; flex-direction: column; gap: 14px; margin-bottom: 0; }
  .lib-tools .grid, .grid, .empty-state, .pager { order: 3; }
  .search-field input { height: 50px; }
  .kbd { display: none; }
  .seg.filter-seg { height: auto; padding: 0; border: 0; background: none; gap: 8px; flex-wrap: wrap; }
  .filter-seg .seg-btn { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); }
  .view-seg { display: none; }

  /* Two compact cards per row. */
  .grid, .grid.is-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid.is-list .gcard { flex-direction: column; align-items: stretch; }
  .grid.is-list .gcard-art { width: auto; }
  .gcard { border-radius: 12px; }
  .gcard-art { aspect-ratio: 16 / 10; }
  .gcard-tag, .gcard-go { display: none; }
  .gcard-status { top: 10px; left: 10px; bottom: auto; font-size: 0; gap: 0; }
  .gcard-body { padding: 10px 12px 12px; }
  .gcard-name { font-size: .86rem; letter-spacing: .01em; }
  .gcard-count { font-size: .7rem; margin-top: 3px; }
  .grid.is-list .gcard-body { padding: 10px 12px 12px; }

  .pager { gap: 4px; }
  .pager-btn { min-width: 36px; height: 38px; padding: 0 8px; }

  /* The bell sits mid-header: pin the dropdown under the header instead. */
  .notif-drop { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; }

  dialog.game-dialog { max-height: 92vh; }
  dialog.game-dialog[open] { display: block; }
  .gd-art { min-height: 170px; height: 170px; }
  .gd-art-text { left: 20px; right: 20px; bottom: 18px; }
  .gd-panel { padding: 20px; }
}
@media (max-width: 380px) {
  .featured-body { padding-right: 96px; }
  .featured-title { font-size: 1.55rem; }
}

/* ===== Daily allowance, take-an-account ===== */
.quota-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.quota-value b { font-family: var(--display); font-size: 1.25rem; font-weight: 700; }
.take-box { gap: 12px; }
.take-title { font-family: var(--display); font-size: 1.15rem; font-weight: 700; }
.take-box .btn { margin-top: 4px; }
.take-box .form-error:empty { display: none; }
.gd-links { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.link-muted {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none;
  color: var(--muted); font-size: .88rem; font-weight: 600;
}
.link-muted:hover { color: var(--text); }
.gcard-status.is-mine { color: var(--accent); }
.gcard-status.is-mine .status-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gcard.is-mine { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.gcard-status.is-locked { color: var(--muted-2); }
.gcard-status.is-locked .status-dot { background: var(--muted-2); box-shadow: none; }
.gcard.is-locked .gcard-art img { filter: grayscale(.85); opacity: .7; }

/* ===== Right-to-left (Arabic) ===== */
[dir="rtl"] .search-icon { left: auto; right: 18px; }
[dir="rtl"] .search-field input { padding: 0 48px 0 52px; }
[dir="rtl"] .kbd { right: auto; left: 14px; }
[dir="rtl"] .gcard-tag { left: auto; right: 12px; }
[dir="rtl"] .gcard-status { left: auto; right: 14px; }
[dir="rtl"] .featured-shade {
  background:
    linear-gradient(270deg, rgba(6, 8, 16, .94) 0%, rgba(6, 8, 16, .72) 38%, rgba(6, 8, 16, .12) 75%),
    linear-gradient(0deg, rgba(6, 8, 16, .7) 0%, transparent 45%);
}
[dir="rtl"] .featured-meta .status-dot { margin-right: 0; margin-left: -10px; }
[dir="rtl"] .notif-drop { right: auto; left: 0; }
[dir="rtl"] .logout-btn { margin-right: 0; margin-left: auto; }
[dir="rtl"] .sub-row, [dir="rtl"] .quota-row { direction: rtl; }
@media (max-width: 760px) {
  [dir="rtl"] .featured-body { padding-right: 20px; padding-left: 110px; }
  [dir="rtl"] .featured-open { right: auto; left: 18px; }
  [dir="rtl"] .gcard-status { right: 10px; }
  [dir="rtl"] .notif-drop { left: 12px; right: 12px; }
}
@media (max-width: 380px) {
  [dir="rtl"] .featured-body { padding-left: 96px; padding-right: 20px; }
}
/* Arabic words set in the monospace label style would take its wide spaces. */
:root[lang="ar"] :is(.cred-key, .gd-label, .panel-note, .sg-foot, .eyebrow, .featured-tag-label, .featured-meta, .gcard-status, .gd-status, .statusbar-inner, .stat-cell span, .sort-btn) { font-family: var(--font); }
/* Spinner on the Get-code button while the request runs (pages.css has the same for /code). */
.sg-panel .spin { animation: sg-spin 1s linear infinite; }
@keyframes sg-spin { to { transform: rotate(360deg); } }
