/* ============================================================
   css/ui-polish.css
   Approved polish layer for the whole site. It is linked LAST (after the
   page's own inline CSS and after css/navbar.css / css/account.css), so it
   wins the cascade without needing higher specificity everywhere.
   Each block is numbered to match the review list, so a single change can
   be added or dropped on its own.

   1  focus rings (theme aware, 1.5px) on buttons + links
   2  pressed state on buttons
   4  one shape for compact controls (pill, 44px) + 16px large surfaces
   5  16px icons inside buttons
   7  settings button hierarchy (primary / secondary / destructive)
   9  one input focus treatment (settings-style white glow)
   10 styled dropdowns (own chevron, matching field look)
   11 one placeholder style (the homepage 'Search the web' look)
   12 flame badge moved into the title row
   14 status messages: success green / error red
   15 footer: full opacity + hover feedback
   16 two border tints (10% rest / 22% hover+focus) - changes-borders.css
   17 one radius for small square icons
   18 nav current page: white outline
   ============================================================ */

/* ---------- shared tokens (1 + 9 + 16 + 18) ---------- */

:root {
  --focus-ring: rgba(255, 255, 255, 0.78);
  --focus-width: 1.5px;
  --focus-offset: 2px;
  --border-rest: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
}

html[data-theme="light"] {
  --focus-ring: rgba(26, 16, 20, 0.7);
  --border-rest: rgba(0, 0, 0, 0.14);
  --border-strong: rgba(0, 0, 0, 0.3);
}

/* ---------- 1. focus rings ---------- */

button:focus-visible,
a:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* the favourite filter already draws its own glow - keep one ring only */
.fav-filter:focus-visible {
  box-shadow: none;
}

/* ---------- 2. pressed state ---------- */

.nav-group a:active,
.blocked-links-button:active,
.check-links-button:active,
.worker-link:active,
.quicklink-button:active,
.fav-filter:active,
.tile:active,
button:active,
a.btn:active {
  transform: translateY(1px);
}

/* ---------- 4. one shape for compact controls ---------- */

.nav-group a {
  height: 44px;
  padding: 0 24px;
  border-radius: 999px;
}

.blocked-links-button,
.check-links-button,
.fav-filter {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
}

.worker-link {
  min-height: 42px;
  border-radius: 999px;
}

/* the account pages ship their own small buttons */
.m33-ui .btn-sm {
  border-radius: 999px;
}

/* large surfaces share one radius */
.box,
.panel,
.quicklink-button,
.setting-card,
.tile {
  border-radius: 16px;
}

/* ---------- 5. 16px icons inside buttons ---------- */

.blocked-links-button svg,
.check-links-button svg,
.why-workers-button svg,
.quicklink-button svg,
.nav-group a svg,
.fav-filter svg,
.btn svg,
.tile svg,
.setting-card h2 svg {
  width: 16px;
  height: 16px;
}

/* the account pages draw their field icons from the sprite - they need the
   same size and the gutter the stylesheet already reserves for them */
.m33-ui .input-wrap > svg.ic {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--m33-dim);
  pointer-events: none;
}

.m33-ui .input-action .ic {
  width: 18px;
  height: 18px;
}

.m33-ui .form-note .ic {
  width: 15px;
  height: 15px;
}

/* ---------- 7. settings button hierarchy ---------- */

/* secondary is the default inside settings */
.setting-card button,
.panel button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* the one crimson action per card */
#save-links,
#save-header,
#save-cloak,
#save-background,
#save-font {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}

/* destructive stays outlined, never filled */
#reset-links,
#reset-header,
#reset-cloak,
#reset-background,
#reset-font,
button.danger {
  background: transparent;
  border: 1px solid rgba(255, 139, 151, 0.35);
  color: #ff8b97;
}

/* ---------- 9. one input focus treatment ---------- */

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus {
  border-color: rgba(26, 16, 20, 0.4);
  box-shadow: 0 0 0 3px rgba(26, 16, 20, 0.12);
}

/* the account pages shipped a red focus ring - same glow everywhere */
.m33-ui input:focus,
.m33-ui select:focus,
.m33-ui textarea:focus {
  border-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
}

/* the wrapped inputs need their own selector to outrank the resting rule */
.m33-ui .input-wrap input:focus {
  border-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="light"] .m33-ui input:focus,
html[data-theme="light"] .m33-ui select:focus,
html[data-theme="light"] .m33-ui textarea:focus,
html[data-theme="light"] .m33-ui .input-wrap input:focus {
  border-color: rgba(26, 16, 20, 0.4) !important;
  box-shadow: 0 0 0 3px rgba(26, 16, 20, 0.12) !important;
}

/* ---------- 10. styled dropdowns ---------- */

select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%23ffffff' stroke-opacity='.72' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 12px 8px !important;
  padding-right: 38px !important;
  cursor: pointer;
}

html[data-theme="light"] select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%231a1014' stroke-opacity='.72' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

select:hover {
  border-color: var(--border-strong);
}

/* the small filter dropdowns on the account pages */
.m33-ui .select-mini {
  border-radius: 999px !important;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%23ffffff' stroke-opacity='.72' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-position: right 10px center !important;
  background-size: 10px 7px !important;
  padding-right: 28px !important;
}

html[data-theme="light"] .m33-ui .select-mini {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%231a1014' stroke-opacity='.72' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* the open list is drawn by the OS, but its rows can still match the site */
select option {
  background: #171114;
  color: #fff;
}

html[data-theme="light"] select option {
  background: #fff;
  color: #241419;
}

/* ---------- 11. one placeholder style ---------- */

/* the homepage search hint: rgba(255,245,246,.7) */
input::placeholder,
textarea::placeholder {
  color: rgba(255, 245, 246, 0.7) !important;
  opacity: 1;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #937f85 !important;
}

/* ---------- 12. flame badge in the title row ---------- */

.box-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.box-title-row .box-text {
  margin-top: 0;
}

.box-title-row .fire-icon {
  position: static;
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: #ff4500;
  flex: none;
}

/* ---------- 14. status messages ---------- */

.status {
  color: #f4f4f7;
}

.status.success {
  color: #4cb877;
}

.status.failed {
  color: #ff6b7a;
}

[data-theme="light"] .status.success {
  color: #1d7a45;
}

[data-theme="light"] .status.failed {
  color: #b3261e;
}

/* ---------- 15. footer ---------- */

footer {
  opacity: 1 !important;
  color: var(--text-muted);
}

footer a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}

footer a:hover,
footer a:focus-visible {
  color: var(--text-main);
  text-decoration: underline;
}

/* ---------- 17. one radius for small square icons ---------- */

/* small square images and icons */
.quicklink-button img,
.app-card img,
.link-row img,
.m33-ui .mini-play img,
.m33-ui .more-game img,
.m33-ui .continue-card img {
  border-radius: 8px;
}

/* card thumbnails follow the 16px surface radius */
.m33-ui .game-icon {
  border-radius: 16px;
}

/* ---------- 18. nav current page ---------- */

.nav-group a[aria-current="page"] {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
}
