/* =========================================================
   BASE / DESKTOP STYLES
   ========================================================= */

:root {
  color-scheme: light;
  --background: #f6f7f9;
  --foreground: #20242c;
  --muted: #697180;
  --line: #dfe3e8;
  --accent: #f45b25;
  --danger: #d93636;
  --white: #ffffff;
  --ribbon-bg: #ffffff;
  --soft-bg: #eef1f5;
  --soft-bg-hover: #e4e8ee;
  --header-height: 68px;
  --font-sans: Inter, "Aptos", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: Inter, "Aptos Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-display: clamp(1.75rem, 3.5vw, 2.5rem);
  --tracking-tight: -0.035em;
  --shadow-color: rgba(28, 35, 45, 0.14);
  --box-shadow: 0 8px 24px var(--shadow-color);
  --box-shadow-small: 0 3px 10px var(--shadow-color);
  --box-shadow-hover: 0 8px 20px rgba(28, 35, 45, 0.20);
  --box-shadow-pressed: 0 1px 3px rgba(28, 35, 45, 0.12);
  --surface-border: 1px solid var(--line);
  --control-transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

html.dark-mode {
  color-scheme: dark;
  --background: #11151b;
  --foreground: #edf1f6;
  --muted: #a0a9b7;
  --line: #303946;
  --accent: #ff7040;
  --danger: #ff5555;
  --white: #1a2029;
  --ribbon-bg: #1a2029;
  --soft-bg: #222a35;
  --soft-bg-hover: #2a3441;
  --shadow-color: rgba(0, 0, 0, 0.32);
  --box-shadow: 0 8px 26px var(--shadow-color);
  --box-shadow-small: 0 3px 11px var(--shadow-color);
  --box-shadow-hover: 0 10px 24px rgba(0, 0, 0, 0.42);
  --box-shadow-pressed: 0 1px 3px rgba(0, 0, 0, 0.28);
}

/* Typography hierarchy: readable body copy and a clear heading scale. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 750; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); font-weight: 650; }
p { text-wrap: pretty; }

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;

  margin: 0;
  padding: 0;

  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100%;

  margin: 0;
  padding: 0;

  overflow-x: hidden;
  overflow-y: auto;

  background: var(--background);

  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-optical-sizing: auto;
  font-kerning: normal;
  font-synthesis: none;

  color: var(--foreground);

  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;

  background: var(--white);
  color: var(--foreground);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  transition: var(--control-transition);
}

button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);

  box-shadow: var(--box-shadow-hover);
}

button:active {
  transform: translate(2px, 2px);

  box-shadow: var(--box-shadow-pressed);
}

a {
  color: inherit;
  text-decoration: none;
}

.required-field{
  color:Red;
}
/* =========================
   HEADER & DISPLAY CONTROLS
   ========================= */

.site-header {
  position: fixed;

  top: 0;
  left: 0;

  width: 100%;
  height: var(--header-height);

  display: flex;
  align-items: center;

  padding: 0 24px;

  background: var(--background);

  border-bottom: 1px solid var(--foreground);

  z-index: 10000;
}

.canvas-display-controls {
  position: fixed;

  top: calc(var(--header-height) + 12px);
  right: 24px;

  display: flex;
  flex-direction: column;

  gap: 8px;

  padding: 9px 11px;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  z-index: 20000;
}

.display-toggle {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 12px;

  min-width: 105px;

  cursor: pointer;
  user-select: none;
}

.display-toggle-label {
  color: var(--foreground);

  font-size: 10px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.display-toggle input {
  position: absolute;

  opacity: 0;

  width: 0;
  height: 0;
}

.display-switch {
  position: relative;

  display: block;

  flex-shrink: 0;

  width: 30px;
  height: 16px;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow-small);

  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.display-switch-thumb {
  position: absolute;

  top: 2px;
  left: 2px;

  width: 10px;
  height: 10px;

  background: var(--foreground);

  transition:
    transform 150ms ease,
    background 150ms ease;
}

.display-toggle input:checked + .display-switch {
  background: var(--accent);

  border-color: var(--accent);
}

.display-toggle input:checked + .display-switch .display-switch-thumb {
  transform: translateX(14px);

  background: var(--white);
}

.display-toggle:hover .display-switch {
  border-color: var(--accent);
}

.display-toggle:hover .display-toggle-label {
  color: var(--accent);
}

.logo {
  display: inline-flex;

  align-items: center;

  gap: 10px;

  color: var(--foreground);

  white-space: nowrap;

  user-select: none;
}

.logo-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-sans);
  line-height: 0.9;
}

.public {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  margin-left: 2px;
}

.painting {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.055em;
}

.navigation {
  display: flex;

  align-items: center;

  gap: 28px;

  margin-left: auto;
  margin-right: 28px;
}

.navigation a {
  position: relative;

  color: var(--muted);

  font-size: 12px;
  font-weight: 700;

  transition: color 150ms ease;
}

.navigation a::after {
  content: "";

  position: absolute;

  left: 0;
  bottom: -6px;

  width: 100%;
  height: 2px;

  background: var(--accent);

  transform: scaleX(0);

  transform-origin: center;

  transition: transform 150ms ease;
}

.navigation a:hover {
  color: var(--foreground);
}

.navigation a:hover::after {
  transform: scaleX(1);
}

.header-button {
  padding: 9px 15px;

  border: 1px solid var(--foreground);

  background: var(--white);
  color: var(--foreground);

  box-shadow: var(--box-shadow);

  font-size: 11px;
  font-weight: 700;

  transition: var(--control-transition);
}

.header-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-small);
}

.header-button:active {
  transform: scale(0.97);
}

/* =========================
   CANVAS / PAINTING AREA
   ========================= */

.wall-page {
  position: relative;

  width: 100%;
  height: 100dvh;

  margin-top: 0;

  overflow: hidden;

  background: var(--background);

  scroll-margin-top: var(--header-height);
}

.painting-container {
  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  background: var(--background);

  -webkit-tap-highlight-color: transparent;

  cursor: pointer;

  touch-action: none;

  z-index: 1;
}

.painting-container.normal-panning {
  cursor: grabbing;
}

.painting-container.paint-moving {
  cursor: grab;
}

.painting-container.paint-moving:active {
  cursor: grabbing;
}

#painting-wall {
  position: absolute;

  top: 0;
  left: 0;

  display: block;

  width: 100%;
  height: 100%;

  margin: 0;
  padding: 0;

  border: 0;
  outline: 0;

  -webkit-tap-highlight-color: transparent;

  cursor: pointer;

  touch-action: none;
}

#painting-wall.normal-panning {
  cursor: grabbing;
}

#painting-wall.paint-moving {
  cursor: grab;
}

/* =========================
   CANVAS ZOOM & COORDINATE CONTROLS
   ========================= */

.canvas-controls {
  position: fixed;

  left: 18px;
  bottom: 18px;

  width: 58px;
  height: 190px;

  padding: 8px 0;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: space-between;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  z-index: 2000;
}

.zoom-icon {
  width: 100%;
  height: 30px;

  display: flex;

  align-items: center;
  justify-content: center;

  color: var(--foreground);

  font-size: 21px;
  font-weight: 500;

  line-height: 1;

  user-select: none;

  pointer-events: auto;
  cursor: pointer;
}

#zoom-slider {
  width: 125px;
  height: 18px;

  margin: 0;

  appearance: none;
  -webkit-appearance: none;

  background: transparent;

  outline: none;

  cursor: pointer;

  transform: rotate(-90deg);

  flex-shrink: 0;
}

#zoom-slider::-webkit-slider-runnable-track {
  width: 125px;
  height: 4px;

  background: var(--foreground);

  border-radius: 0;
}

#zoom-slider::-webkit-slider-thumb {
  width: 15px;
  height: 15px;

  margin-top: -5.5px;

  appearance: none;
  -webkit-appearance: none;

  border: 1px solid var(--foreground);

  background: var(--white);

  border-radius: 0;

  transition:
    background 150ms ease,
    transform 150ms ease;
}

#zoom-slider:hover::-webkit-slider-thumb {
  background: var(--accent);

  border-color: var(--accent);

  transform: scale(1.08);
}

#zoom-slider::-moz-range-track {
  width: 125px;
  height: 4px;

  background: var(--foreground);

  border-radius: 0;
}

#zoom-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;

  border: 1px solid var(--foreground);

  background: var(--white);

  border-radius: 0;
}

.coordinate-info {
  position: fixed;

  top: 82px;
  left: 50%;

  transform: translateX(-50%);

  padding: 9px 14px;

  display: flex;
  align-items: center;

  background: var(--white);

  border: 1px solid var(--foreground);

  opacity: 0;

  pointer-events: none;

  z-index: 2100;

  box-shadow: var(--box-shadow-small);
}

.coordinate-info.visible {
  opacity: 1;
}

.coordinate-info strong {
  color: var(--foreground);

  font-size: 12px;
  font-weight: 800;

  white-space: nowrap;
}

.selection-info {
  position: fixed;

  left: 92px;
  bottom: 20px;

  padding: 10px 14px;

  display: flex;
  align-items: center;

  gap: 10px;

  background: var(--white);

  border: 1px solid var(--foreground);

  opacity: 0;

  pointer-events: none;

  z-index: 2100;

  box-shadow: var(--box-shadow-small);
}

.selection-info.visible {
  opacity: 1;
}

.selection-info span {
  color: var(--muted);

  font-size: 9px;
  font-weight: 700;

  letter-spacing: 0.1em;
}

.selection-info strong {
  color: var(--foreground);

  font-size: 12px;
  font-weight: 800;
}

/* =========================
   SELECTION RIBBON & PAINT ACTIONS
   ========================= */

.selection-ribbon {
  box-sizing: border-box;

  position: fixed;

  left: 50%;
  bottom: 18px;

  width: min(calc(100vw - 180px), 1000px);

  min-height: 82px;

  padding: 18px 22px;

  display: flex;
  align-items: stretch;

  background: var(--ribbon-bg);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  transform: translate(-50%, 140%);

  opacity: 0;

  pointer-events: none;

  transition:
    transform 220ms ease,
    opacity 180ms ease;

  z-index: 2200;
}

.selection-ribbon.visible {
  transform: translate(-50%, 0);

  opacity: 1;

  pointer-events: auto;
}

.selection-ribbon-content {
  width: 100%;

  display: flex;
  flex-direction: column;

  gap: 16px;

  padding-right: 26px;
}

.selection-ribbon-copy {
  width: 100%;

  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 5px;
}

.selection-ribbon-copy strong {
  color: var(--foreground);

  font-size: 14px;
  font-weight: 800;

  line-height: 1.2;

  letter-spacing: -0.01em;
}

.selection-ribbon-copy span {
  color: var(--muted);

  font-size: 11px;
  font-weight: 500;

  line-height: 1.4;
}

.selection-ribbon-actions {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 9px;

  flex-wrap: wrap;
}

.selection-ribbon .continue-button:not(.buy-paint-button) {
  width: 100%;

  min-height: 44px;

  display: flex;

  align-items: center;
  justify-content: center;
}

.selection-ribbon.owned-square .continue-button:not(.buy-paint-button) {
  display: none;
}

.selection-ribbon.owned-square .selection-ribbon-copy strong {
  font-size: 18px;
}

.selection-ribbon.owned-square .selection-ribbon-copy span {
  font-size: 14px;
}

.selection-ribbon.paint-mode .selection-ribbon-actions {
  display: grid;

  grid-template-columns:
    auto
    auto
    1fr;

  grid-template-rows:
    auto
    auto;

  gap: 9px;
}

.selection-count {
  display: none;

  align-items: center;

  color: var(--muted);

  font-size: 10px;
  font-weight: 700;

  white-space: nowrap;

  padding: 0 3px;
}

.selection-ribbon.paint-mode .selection-count {
  display: inline-flex;
}

.continue-button,
.paint-mode-button {
  min-height: 38px;

  padding: 0 15px;

  border: 1px solid var(--foreground);

  background: var(--accent);

  color: var(--white);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.01em;

  white-space: nowrap;

  box-shadow: var(--box-shadow-small);
  transition: var(--control-transition);
}

.continue-button:hover,
.paint-mode-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-hover);
}

.continue-button:active,
.paint-mode-button:active {
  transform: translate(2px, 2px);

  box-shadow: var(--box-shadow-pressed);
}

.paint-mode-button {
  display: none;

  background: var(--soft-bg);

  border-color: var(--foreground);

  color: var(--foreground);
}

.selection-ribbon.paint-mode .paint-mode-button {
  display: block;
}

.paint-mode-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-small);
}

.selection-ribbon.paint-mode #move-canvas-button {
  grid-column: 1;
  grid-row: 1;
}

.selection-ribbon.paint-mode #erase-paint-button {
  grid-column: 2;
  grid-row: 1;
}

.paint-mode-button.active {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-small);
}

.paint-mode-button.active:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);
}

.buy-paint-button {
  display: none;

  width: 100%;

  min-height: 48px;

  grid-column: 1 / -1;
  grid-row: 2;

  border: 1px solid var(--foreground);

  background: var(--accent);

  color: var(--white);

  font-size: 11px;
  font-weight: 800;

  box-shadow: var(--box-shadow-small);
}

.selection-ribbon.paint-mode .buy-paint-button {
  display: flex;

  align-items: center;
  justify-content: center;
}

.buy-paint-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  box-shadow: var(--box-shadow-small);
}

.buy-paint-button:disabled {
  opacity: 0.45;

  cursor: not-allowed;

  box-shadow: none;
}

.selection-ribbon.paint-mode .continue-button:not(.buy-paint-button) {
  display: none;
}

.color-palette {
  display: none;

  grid-template-columns: repeat(11, 20px);

  grid-template-rows: repeat(2, 20px);

  gap: 5px;

  padding: 2px;

  align-items: center;
}

.selection-ribbon.paint-mode .color-palette {
  display: grid;

  grid-column: 3;
  grid-row: 1;
}

.color-option {
  width: 20px;
  height: 20px;

  padding: 0;

  outline: none;

  box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0.25);

  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.color-option:hover {
  transform: scale(1.18);

  border-color: var(--foreground);

  box-shadow: none;
}

.color-option.selected {
  transform: scale(1.18);
}

.close-selection-button {
  position: absolute;

  top: 12px;
  right: 12px;

  width: 28px;
  height: 28px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;

  background: transparent;

  color: var(--muted);

  font-size: 20px;

  line-height: 1;

  box-shadow: none;
}

.close-selection-button:hover {
  background: var(--soft-bg-hover);

  border: 0;

  color: var(--foreground);

  box-shadow: none;
}

.close-selection-button:active {
  transform: none;

  box-shadow: none;
}

/* =========================
   LEADERBOARD
   ========================= */

.leaderboard-section {
  position: relative;

  width: 100%;
  min-height: 100vh;
  height: 100vh;

  padding: 90px 24px 40px;

  background: var(--background);

  border-top: 1px solid var(--foreground);

  scroll-margin-top: var(--header-height);

  box-sizing: border-box;

  overflow: hidden;

  z-index: 1;
}

.leaderboard-container {
  width: min(100%, 1100px);

  margin: 0 auto;
}

.leaderboard-heading {
  margin-bottom: 35px;
}

.section-eyebrow {
  display: block;

  margin-bottom: 10px;

  color: var(--accent);

  font-size: 9px;

  font-weight: 800;

  letter-spacing: 0.14em;
}

.leaderboard-heading h2 {
  margin: 0 0 10px;

  color: var(--foreground);

  font-size: 32px;

  font-weight: 800;

  letter-spacing: -0.035em;
}

.leaderboard-heading p {
  margin: 0;

  color: var(--muted);

  font-size: 13px;

  line-height: 1.5;
}

.leaderboard-table-wrapper {
  width: 100%;
  max-width: 100%;

  height: auto;
  max-height: calc(100vh - 260px);

  overflow-x: hidden;
  overflow-y: auto;

  box-sizing: border-box;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  -webkit-overflow-scrolling: touch;
}

/* JavaScript measures the available viewport and leaves an exact 2px gap above the fixed bar. */
.leaderboard-table-wrapper.has-current-user-bar {
  margin-bottom: 0;
}

.leaderboard-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  border-collapse: collapse;

  table-layout: fixed;
}

.leaderboard-table th {
  padding: 15px 18px;

  position: sticky;
  top: 0;

  z-index: 2;

  background: var(--foreground);

  border-bottom: 1px solid var(--foreground);

  color: var(--white);

  font-size: 10px;

  font-weight: 800;

  letter-spacing: 0.06em;

  text-align: left;

  text-transform: uppercase;
}

.leaderboard-table td {
  padding: 15px 18px;

  border-bottom: 1px solid var(--line);

  color: var(--foreground);

  font-size: 12px;

  font-weight: 600;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.leaderboard-table tbody tr {
  transition: background 180ms ease, box-shadow 180ms ease;
}

.leaderboard-table tbody tr.leaderboard-clickable-row {
  cursor: pointer;
  outline: none;
}

.leaderboard-table tbody tr.leaderboard-clickable-row:hover {
  background: var(--soft-bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.leaderboard-table tbody tr.leaderboard-clickable-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.leaderboard-rank-badge {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 180ms ease;
}

.leaderboard-clickable-row:hover .leaderboard-rank-badge {
  transform: scale(1.07);
}

.leaderboard-rank-1 {
  color: #6f4b00;
  background: #ffe08a;
  border-color: #d5a72e;
  box-shadow: 0 2px 0 #d5a72e;
}

.leaderboard-rank-2 {
  color: #3e4a56;
  background: #e5ebf0;
  border-color: #aab5c0;
  box-shadow: 0 2px 0 #aab5c0;
}

.leaderboard-rank-3 {
  color: #713f22;
  background: #f0c19f;
  border-color: #c58a61;
  box-shadow: 0 2px 0 #c58a61;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
  width: 90px;

  color: var(--muted);

  font-weight: 800;
}

.leaderboard-table th:nth-child(3),
.leaderboard-table td:nth-child(3) {
  width: 150px;
}

.leaderboard-table th:nth-child(4),
.leaderboard-table td:nth-child(4) {
  width: 180px;
}

.leaderboard-table td:nth-child(4) {
  color: var(--accent);

  font-weight: 800;
}

/* =========================
   PURCHASE CONFIRMATION
   ========================= */

.purchase-confirmation {
  position: fixed;

  inset: 0;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(23, 23, 23, 0.48);

  backdrop-filter: blur(8px);

  opacity: 0;

  pointer-events: none;

  z-index: 4000;

  transition: opacity 180ms ease;
}

.purchase-confirmation.visible {
  opacity: 1;

  pointer-events: auto;
}

.purchase-confirmation-panel {
  position: relative;

  width: min(100%, 390px);

  max-height: calc(100vh - 40px);

  overflow-y: auto;

  padding: 28px;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  z-index: 1;
}

/* =========================
   PURCHASE PAINTING NAME
   ========================= */

.purchase-painting-name {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 22px;
}

.purchase-painting-name label {
  display: block;
  color: var(--foreground);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.purchase-painting-name input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--foreground);
  border-radius: 0;
  outline: none;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.purchase-painting-name input:hover {
  background: var(--white);
}

.purchase-painting-name input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 78%);
  background: var(--white);
}

.purchase-painting-name input.input-error {
  border-color: #b3261e;
  box-shadow: 0 0 0 1px #b3261e;
}

.purchase-painting-name-error {
  display: block;
  min-height: 0;
  color: #b3261e;
  font-size: 11px;
  line-height: 1.4;
}

.purchase-painting-name-error:empty {
  display: none;
}

/* =========================
   AUTHENTICATION MODAL
   ========================= */

.auth-modal {
  position: fixed;

  inset: 0;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 20px;

  background: rgba(23, 23, 23, 0.48);

  backdrop-filter: blur(8px);

  opacity: 0;

  pointer-events: none;

  transition: opacity 180ms ease;

  z-index: 5000;
}

.auth-modal.visible,
.auth-modal.open {
  opacity: 1;

  pointer-events: auto;
}

.auth-modal-backdrop {
  position: absolute;

  inset: 0;
}

.auth-panel,
.purchase-confirmation-panel {
  position: relative;

  width: min(100%, 390px);

  max-height: calc(100vh - 40px);

  overflow-y: auto;

  padding: 28px;

  background: var(--white);

  border: 1px solid var(--foreground);

  box-shadow: var(--box-shadow);

  z-index: 1;
}

.auth-view {
  width: 100%;
}

.auth-heading {
  margin-bottom: 22px;
}

.auth-eyebrow {
  display: block;

  margin-bottom: 8px;

  color: var(--accent);

  font-size: 9px;

  font-weight: 800;

  letter-spacing: 0.12em;
}

.auth-heading h2 {
  margin: 0 0 7px;

  color: var(--foreground);

  font-size: 24px;

  font-weight: 800;

  letter-spacing: -0.03em;
}

.auth-heading p {
  margin: 0;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.5;
}

.auth-close,
.purchase-confirmation-close {
  position: absolute;

  top: 12px;
  right: 12px;

  width: 30px;
  height: 30px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;

  background: transparent;

  color: var(--muted);

  font-size: 21px;

  box-shadow: none;
}

.auth-close:hover,
.purchase-confirmation-close:hover {
  background: var(--soft-bg);

  border: 0;

  color: var(--foreground);

  box-shadow: none;
}

.auth-close:active,
.purchase-confirmation-close:active {
  transform: none;

  box-shadow: none;
}

.auth-view form {
  display: flex;

  flex-direction: column;

  gap: 9px;
}

.auth-view label {
  margin-top: 5px;

  color: var(--foreground);

  font-size: 10px;

  font-weight: 800;
}

.auth-view input {
  width: 100%;

  min-height: 42px;

  padding: 0 12px;

  border: 1px solid var(--foreground);

  outline: none;

  background: var(--background);

  color: var(--foreground);

  font-size: 12px;

  box-shadow: none;

  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.auth-view input:hover {
  background: var(--white);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

/* Explicitly honor hidden on wrappers despite component display rules. */

.password-input-wrap[hidden] {
  display: none !important;
}

.password-input-wrap > input {
  width: 100%;
  min-width: 0;
  padding-right: 46px;
}

.password-visibility-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: calc(100% - 2px);
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  z-index: 2;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  border: 0;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.password-visibility-toggle:active {
  transform: none;
  box-shadow: none;
}

.password-eye-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-eye-slash {
  opacity: 1;
  transition: opacity 120ms ease;
}

.password-visibility-toggle.is-visible .password-eye-slash {
  opacity: 0;
}

/* Avoid the browser's duplicate built-in reveal icon in Edge/IE. */

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

.auth-primary-button,
.auth-secondary-button {
  width: 100%;

  min-height: 43px;

  margin-top: 8px;

  font-size: 11px;

  font-weight: 800;
}

.auth-primary-button {
  border: 1px solid var(--foreground);

  background: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow);
}

.auth-primary-button:hover {
  border-color: var(--accent);

  background: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-small);
}

.auth-primary-button:active {
  transform: translate(3px, 3px);

  box-shadow: none;
}

.auth-secondary-button {
  border: 1px solid var(--foreground);

  background: var(--white);

  color: var(--foreground);

  box-shadow: var(--box-shadow);
}

.auth-secondary-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow-small);
}

.auth-secondary-button:active {
  transform: translate(3px, 3px);

  box-shadow: none;
}

.auth-message {
  min-height: 18px;

  margin-top: 12px;

  color: var(--muted);

  font-size: 11px;

  line-height: 1.45;
}

.auth-message.error {
  color: #c62828;
}

.auth-message.success {
  color: #16833b;
}

.username-availability {
  min-height: 16px;
  margin: 5px 0 12px;
  font-size: 12px;
  line-height: 1.35;
}

.username-availability.success { color: #16833b; }

.username-availability.error { color: #c62828; }

.username-availability.checking,
.username-availability.neutral { color: var(--muted); }

.auth-switch {
  margin: 20px 0 0;

  color: var(--muted);

  font-size: 11px;

  text-align: center;
}

.auth-switch button {
  padding: 0;

  border: 0;

  background: transparent;

  color: var(--accent);

  font-size: inherit;

  font-weight: 800;

  box-shadow: none;
}

.auth-switch button:hover {
  background: transparent;

  border: 0;

  color: var(--foreground);

  text-decoration: underline;

  box-shadow: none;
}

.auth-switch button:active {
  transform: none;

  box-shadow: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus::placeholder {
  color: var(--muted);
}

/* =========================
   CUSTOM SCROLLBARS
   ========================= */

.auth-panel::-webkit-scrollbar,
.purchase-confirmation-panel::-webkit-scrollbar,
.leaderboard-table-wrapper::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.auth-panel::-webkit-scrollbar-track,
.purchase-confirmation-panel::-webkit-scrollbar-track,
.leaderboard-table-wrapper::-webkit-scrollbar-track {
  background: var(--soft-bg);
}

.auth-panel::-webkit-scrollbar-thumb,
.purchase-confirmation-panel::-webkit-scrollbar-thumb,
.leaderboard-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--foreground);

  border: 1px solid var(--soft-bg);
}

.auth-panel::-webkit-scrollbar-thumb:hover,
.purchase-confirmation-panel::-webkit-scrollbar-thumb:hover,
.leaderboard-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.auth-primary-button,
.auth-secondary-button {
  width: 100%;

  min-height: 43px;

  margin-top: 8px;

  font-size: 11px;

  font-weight: 800;
}

.auth-primary-button {
  border: 1px solid var(--foreground);

  background: var(--accent);

  color: var(--white);

  box-shadow: var(--box-shadow);
}

.auth-primary-button:hover {
  border-color: var(--accent);

  background: var(--accent);

  color: var(--white);

  box-shadow: 1px 1px 0 var(--foreground);
}

.auth-primary-button:active {
  transform: translate(3px, 3px);

  box-shadow: none;
}

.auth-secondary-button {
  border: 1px solid var(--foreground);

  background: var(--white);

  color: var(--foreground);

  box-shadow: var(--box-shadow);
}

.auth-secondary-button:hover {
  background: var(--accent);

  border-color: var(--accent);

  color: var(--white);

  box-shadow: 1px 1px 0 var(--foreground);
}

.auth-secondary-button:active {
  transform: translate(3px, 3px);

  box-shadow: none;
}

.auth-message {
  min-height: 18px;

  margin-top: 12px;

  color: var(--muted);

  font-size: 11px;

  line-height: 1.45;
}

.auth-message.error {
  color: #c62828;
}

.auth-message.success {
  color: #16833b;
}

.auth-switch {
  margin: 20px 0 0;

  color: var(--muted);

  font-size: 11px;

  text-align: center;
}

.auth-switch button {
  padding: 0;

  border: 0;

  background: transparent;

  color: var(--accent);

  font-size: inherit;
  font-weight: 800;

  box-shadow: none;
}

.auth-switch button:hover {
  color: var(--foreground);

  text-decoration: underline;

  background: transparent;

  border: 0;

  box-shadow: none;
}

.auth-switch button:active {
  transform: none;

  box-shadow: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus::placeholder {
  color: var(--muted);
}

.auth-panel::-webkit-scrollbar,
.purchase-confirmation-panel::-webkit-scrollbar,
.leaderboard-table-wrapper::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.auth-panel::-webkit-scrollbar-track,
.purchase-confirmation-panel::-webkit-scrollbar-track,
.leaderboard-table-wrapper::-webkit-scrollbar-track {
  background: var(--soft-bg);
}

.auth-panel::-webkit-scrollbar-thumb,
.purchase-confirmation-panel::-webkit-scrollbar-thumb,
.leaderboard-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--foreground);

  border: 1px solid var(--soft-bg);
}

.auth-panel::-webkit-scrollbar-thumb:hover,
.purchase-confirmation-panel::-webkit-scrollbar-thumb:hover,
.leaderboard-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

body:has(#leaderboard:target) .canvas-controls,
body:has(#leaderboard:target) .coordinate-info,
body:has(#leaderboard:target) .selection-info,
body:has(#leaderboard:target) .selection-ribbon {
  display: none !important;
}

body:has(#canvas:target) .canvas-controls {
  display: flex;
}

.wall-page {
  overflow: hidden;
}

.site-header {
  z-index: 10000;
}

.auth-modal,
.auth-modal.open,
.auth-modal.visible {
  z-index: 5000;
}

.purchase-confirmation,
.purchase-confirmation.visible {
  z-index: 4000;
}

.selection-ribbon.owned-square .ribbon-username {
  display: inline-block;

  padding: 2px 7px;

  background: rgba(255, 77, 0, 0.1);

  color: var(--accent);

  font-weight: 800;

  letter-spacing: 0;
}

.header-button.logged-in {
  display: inline-block;

  padding: 2px 7px;

  background: rgba(255, 77, 0, 0.1);

  color: var(--accent);

  font-weight: 800;

  letter-spacing: 0;

  border: 0;

  box-shadow: none;
}

.selection-ribbon.paint-mode.owned-square .selection-ribbon-actions {
  display: none;
}

.profile-header {
  margin-top: 20px;
  margin-bottom: 14px;
}

.profile-account-card {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 14px;

  border: 1px solid var(--foreground);

  background: var(--white);
  box-shadow: var(--box-shadow-small);
}

.profile-account-details {
  flex: 1;
  min-width: 0;
}

.profile-account-field + .profile-account-field {
  margin-top: 8px;
}

.profile-account-label {
  display: block;

  margin-bottom: 2px;

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.12em;

  color: var(--muted);

  text-transform: uppercase;
}

.profile-account-field h2 {
  margin: 0;

  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;

  color: var(--foreground);

  overflow-wrap: anywhere;
}

.profile-account-field p {
  margin: 0;

  font-size: 12px;
  line-height: 1.3;

  color: var(--muted);

  overflow-wrap: anywhere;
}

.profile-rank {
  margin: 12px 0;

  padding: 12px 16px;

  border: 1px solid var(--foreground);

  background: var(--white);

  text-align: center;
  box-shadow: var(--box-shadow-small);
}

.profile-rank-number {
  display: block;

  font-size: 25px;
  line-height: 1;

  font-weight: 800;

  color: var(--foreground);
}

.profile-rank-label {
  display: block;

  margin-top: 5px;

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.12em;

  color: var(--muted);

  text-transform: uppercase;
}

.profile-squares {
  margin-top: 12px;

  padding: 14px;

  border: 1px solid var(--foreground);

  background: var(--white);

  height: 360px;

  box-sizing: border-box;

  overflow: hidden;
  box-shadow: var(--box-shadow-small);
}

.profile-content-tabs {
  display: flex;
  align-items: flex-end;

  gap: 28px;

  margin: -14px -14px 0;
  padding: 0 18px;

  border-bottom: 1px solid var(--line);
}

.profile-content-tab {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  position: relative;

  border: none !important;
  border-radius: 0 !important;

  outline: none;

  background: transparent !important;
  box-shadow: none !important;

  padding: 12px 0 11px;
  margin: 0;

  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;

  color: var(--muted);

  cursor: pointer;
}

.profile-content-tab:hover {
  background: transparent !important;

  color: var(--foreground);
}

.profile-content-tab:focus,
.profile-content-tab:active {
  background: transparent !important;

  box-shadow: none !important;

  outline: none;
}

.profile-content-tab.active {
  background: transparent !important;

  color: var(--foreground);
}

.profile-content-tab.active::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: -1px;

  height: 2px;

  background: var(--foreground);
}

#profile-square-count,
#profile-painting-count {
  margin: 10px 0 10px;

  font-size: 9px;
  line-height: 1.2;

  color: var(--muted);
}

.profile-squares-list {
  display: flex;

  flex-direction: column;

  gap: 7px;

  max-height: 230px;

  overflow-y: auto;

  padding-right: 5px;
}

.profile-square-item {
  display: flex;

  align-items: center;

  gap: 10px;

  padding: 8px 9px;

  border: 1px solid var(--line);

  background: var(--soft-bg);

  transition:
    border-color 150ms ease,
    background 150ms ease;
  box-shadow: var(--box-shadow-small);
}

.profile-square-preview {
  width: 28px;
  height: 28px;

  flex: 0 0 28px;

  border: 1px solid var(--line);

  box-sizing: border-box;

  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.profile-square-coordinate {
  flex: 1;

  min-width: 0;

  font-size: 11px;

  font-weight: 700;

  color: var(--foreground);
}

.profile-square-view {
  flex: 0 0 auto;

  border: 1px solid var(--foreground);

  padding: 6px 10px;

  background: var(--white);

  color: var(--foreground);

  font-size: 10px;

  font-weight: 700;

  cursor: pointer;

  box-shadow: var(--box-shadow-small);

  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.profile-square-view:hover {
  background: var(--accent);

  color: var(--white);

  border-color: var(--accent);

  box-shadow: 1px 1px 0 var(--foreground);
}

.profile-square-view:active {
  transform: translate(1px, 1px);

  box-shadow: none;
}

#view-all-squares-button {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 10px 12px;
  margin-top: 10px;
  box-sizing: border-box;
  border: 1px solid var(--foreground);
  background: var(--white);
  color: var(--foreground);
  box-shadow: var(--box-shadow-small);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

#view-all-squares-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  box-shadow: var(--box-shadow-hover);
}

#view-all-squares-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--box-shadow-pressed);
}

.profile-squares-list::-webkit-scrollbar {
  width: 5px;
}

.profile-squares-list::-webkit-scrollbar-thumb {
  background: var(--foreground);
}

.profile-squares-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.profile-paintings-list {
  display: flex;
  flex-direction: column;
  gap: 7px;

  min-height: 280px;

  max-height: 280px;

  overflow-y: auto;

  padding-right: 5px;
}

.profile-paintings-list::-webkit-scrollbar {
  width: 5px;
}

.profile-paintings-list::-webkit-scrollbar-thumb {
  background: var(--foreground);
}

.profile-paintings-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.profile-painting-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;

  padding: 10px;

  border: 1px solid var(--line);
  background: var(--soft-bg);

  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.profile-painting-preview {
  width: 120px;
  height: 120px;

  align-self: center;

  display: grid;

  overflow: hidden;

  margin: 0;

  background: var(--white);

  border: 1px solid var(--line);

  box-sizing: border-box;
}

.profile-painting-name {
  margin: 0;

  color: var(--foreground);

  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-painting-view {
  flex: 0 0 auto;

  width: auto;
  min-height: 0;

  padding: 6px 10px;

  border: 1px solid var(--foreground);

  background: var(--white);
  color: var(--foreground);

  font-size: 10px;
  font-weight: 700;

  cursor: pointer;

  box-shadow: var(--box-shadow-small);

  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.profile-painting-view:hover {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: 1px 1px 0 var(--foreground);
}

.profile-painting-view:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

#logout-button {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  padding: 0 15px;
  background: var(--danger);
  color: #ffffff;
  border: 1px solid var(--foreground);
  box-shadow: var(--box-shadow-small);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.3;
  transition: var(--control-transition);
}

#logout-button:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
  transform: translate(-1px, -1px);
  box-shadow: var(--box-shadow-hover);
}

#logout-button:active {
  transform: translate(2px, 2px);
  box-shadow: var(--box-shadow-pressed);
}

button {
  border-radius: 0;
}

input {
  border-radius: 0;
}

.continue-button, .paint-mode-button, .buy-paint-button, .profile-square-view, #logout-button, .auth-primary-button, .auth-secondary-button, .header-button{
  border-radius: 0;
}

.continue-button,
.paint-mode-button,
.profile-square-view,
#view-all-squares-button,
#logout-button,
.auth-primary-button,
.auth-secondary-button {
  box-shadow: var(--box-shadow-small);
}

.continue-button:hover,
.paint-mode-button:hover,
.profile-square-view:hover,
#view-all-squares-button:hover,
#logout-button:hover,
.auth-primary-button:hover,
.auth-secondary-button:hover {
  box-shadow: var(--box-shadow-hover);
}

.close-selection-button,
.auth-close,
.purchase-confirmation-close {
  border: 0;

  background: transparent;

  color: var(--muted);

  box-shadow: none;

  border-radius: 0;
}

.close-selection-button:hover,
.auth-close:hover,
.purchase-confirmation-close:hover {
  background: var(--soft-bg-hover);

  color: var(--foreground);

  box-shadow: none;
}

.profile-account-card,
.profile-rank,
.profile-squares {
  border-color: var(--foreground);

  background: var(--white);
}

.leaderboard-table-wrapper {
  border-color: var(--foreground);

  box-shadow: var(--box-shadow);
}

.leaderboard-table th {
  background: var(--foreground);

  color: var(--white);

  border-color: var(--foreground);
}

.leaderboard-table td {
  border-color: var(--line);
}

.leaderboard-table tbody tr:hover {
  background: var(--soft-bg);
}

.auth-view input {
  border-color: var(--foreground);

  background: var(--white);

  box-shadow: none;
}

.auth-view input:hover {
  border-color: var(--accent);
}

html.dark-mode .site-header {
  height: var(--header-height);

  background: var(--background);

  border-bottom-color: var(--line);
}

html.dark-mode .navigation {
  background: var(--background);

  border-bottom-color: var(--line);
}

html.dark-mode .canvas-controls {
  box-shadow: none;
}

.site-header, .navigation, .logo, .logo-mark, .header-button, .canvas-display-controls{
  flex-shrink: 0;
}

.canvas-display-controls {
  top: calc(var(--header-height) + 12px);
}

.payment-result-panel {
  text-align: center;
  max-width: 460px;
}

.payment-result-panel h2 {
  margin: 0 0 16px;
}

.payment-result-panel p {
  margin: 0 0 24px;
  line-height: 1.6;
}

.available-squares-box {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  left: 10px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 4px;

  min-width: 105px;
  padding: 9px 11px;

  background: var(--white);
  color: var(--foreground);

  border: 1px solid var(--foreground);
  border-radius: 0;

  box-shadow: var(--box-shadow);

  box-sizing: border-box;
  white-space: nowrap;

  z-index: 1000;
}

.available-squares-label {
  color: var(--foreground);

  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;

  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#available-squares-count {
  color: red;

  font-size: 10px;
  font-weight: 700;

  line-height: 1.2;
}

.canvas-display-controls {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: 18px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 12px;

  width: auto;
  max-width: none;
  min-width: 0;

  box-sizing: border-box;
  z-index: 1000;
}

html.dark-mode .available-squares-box {
  box-shadow: var(--box-shadow);
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 2147483647;

  display: grid;
  place-items: center;

  width: 100vw;
  height: 100vh;
  overflow: hidden;

  background: #000;
  isolation: isolate;

  animation: splashExit 0.5s ease 8s forwards;
}

.splash.is-hidden {
  animation: splashExit 0.35s ease forwards;
}

.splash-logo {
  display: flex;
  align-items: center;
  gap: 13px;

  color: #fff;
  white-space: nowrap;
  user-select: none;
}

.splash-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.splash-icon rect:not(:first-child) {
  opacity: 0;

  transform-box: fill-box;
  transform-origin: center;
}

.splash-icon .block-1 {
  animation: blockIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s forwards;
}

.splash-icon .block-2 {
  animation: blockIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s forwards;
}

.splash-icon .block-3 {
  animation: centerIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s forwards;
}

.splash-icon .block-4 {
  animation: blockIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s forwards;
}

.splash-icon .block-5 {
  animation: blockIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s forwards;
}

.splash .logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  font-family: var(--font-sans);
  line-height: 0.82;

  opacity: 0;
  transform: translateX(-8px);

  animation: textIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.55s forwards;
}

.splash .public {
  font-size: 11px;
  font-weight: 800;

  letter-spacing: 0.22em;

  margin-left: 3px;
}

.splash .painting {
  font-size: 29px;
  font-weight: 900;

  letter-spacing: -0.055em;
}

@keyframes blockIn {
  from {
    opacity: 0;
    transform: scale(0);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes centerIn {
  from {
    opacity: 0;
    transform: scale(0);
  }

  70% {
    opacity: 1;
    transform: scale(1.12);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes textIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes splashExit {
  from {
    opacity: 1;
    visibility: visible;
  }

  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Responsive overrides: tablet and mobile styles are kept at the bottom. */

/* Tablet / compact desktop */

/* Mobile layout */

/* Mobile layout */

/* Small phones */

/* Mobile layout */

/* Small phones */

/* Mobile header */

/* Mobile layout */

/* Mobile layout */

/* Accessibility: respect reduced-motion preferences */

/* =========================================================
   ASYNC LOADING FEEDBACK
   ========================================================= */

.auth-message.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-message.loading::before,
.auth-primary-button.is-loading::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: appLoadingSpin 0.7s linear infinite;
}

.auth-primary-button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: progress;
}

@keyframes appLoadingSpin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   NETWORK STATUS, REQUEST PROGRESS, AND SKELETON STATES
   ========================================================= */

.connection-banner {
  position: fixed;
  z-index: 100100;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 48px;
  padding: 9px 16px;
  color: #171717;
  background: #fff3b0;
  border-bottom: 2px solid #171717;
  font-size: 13px;
  font-weight: 700;
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.connection-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.connection-banner.is-offline { background: #ffe0d9; }

.connection-banner.is-online { background: #e1f8d8; }

.connection-banner__icon {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #b3261e;
  box-shadow: 0 0 0 4px rgba(179, 38, 30, .12);
}

.connection-banner.is-online .connection-banner__icon {
  background: #218739;
  box-shadow: 0 0 0 4px rgba(33, 135, 57, .12);
}

.connection-banner__message { line-height: 1.4; }

.request-progress {
  position: fixed;
  z-index: 100099;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.request-progress.is-visible { opacity: 1; }

.request-progress span {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent), transparent 25%);
  animation: requestProgressSweep 1.15s ease-in-out infinite;
}

@keyframes requestProgressSweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(370%); }
}

.network-toast {
  position: fixed;
  z-index: 100101;
  left: 50%;
  bottom: 24px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 13px 16px;
  border: 1px solid var(--foreground);
  background: var(--white);
  color: var(--foreground);
  box-shadow: var(--box-shadow);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.network-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.profile-skeleton-row,
.painting-skeleton-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: var(--soft-bg);
  overflow: hidden;
}

.profile-skeleton-row i,
.profile-skeleton-row span,
.profile-skeleton-row b,
.painting-skeleton-card i,
.painting-skeleton-card span,
.painting-skeleton-card b,
.leaderboard-skeleton-row span {
  display: block;
  border-radius: 3px;
  background: linear-gradient(100deg, var(--soft-bg-hover) 20%, var(--white) 40%, var(--soft-bg-hover) 60%);
  background-size: 220% 100%;
  animation: skeletonShimmer 1.25s ease-in-out infinite;
}

.profile-skeleton-row i { width: 28px; height: 28px; flex: 0 0 28px; }

.profile-skeleton-row span { height: 10px; flex: 1; }

.profile-skeleton-row b { width: 39px; height: 25px; }

.painting-skeleton-card { min-height: 76px; }

.painting-skeleton-card i { width: 54px; height: 54px; flex: 0 0 54px; }

.painting-skeleton-card span { height: 11px; flex: 1; }

.painting-skeleton-card b { width: 38px; height: 25px; }

@keyframes skeletonShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -120% 0; }
}

.leaderboard-skeleton-row span { height: 12px; min-width: 35px; }

.leaderboard-skeleton-row td:nth-child(2) span { width: 75%; }

.leaderboard-load-error,
.profile-load-error { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* =========================================================
   SMOOTH PAINTING OPEN TRANSITION
   ========================================================= */

.painting-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100050;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--background) 72%, transparent);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.painting-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.painting-loading-card {
  width: min(300px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 27px 25px 23px;
  border: 2px solid var(--foreground);
  background: var(--background);
  color: var(--foreground);
  box-shadow: none;
  text-align: center;
  transform: translateY(8px) scale(.98);
  transition: transform 180ms ease;
}

.painting-loading-overlay.is-visible .painting-loading-card { transform: translateY(0) scale(1); }

.painting-loading-mosaic {
  display: grid;
  grid-template-columns: repeat(3, 13px);
  gap: 4px;
  padding: 4px;
  margin-bottom: 3px;
  background: #000000;
}

.painting-loading-mosaic i {
  display: block;
  width: 13px;
  height: 13px;
  background: transparent;
  opacity: 0;
  animation: paintingTilePulse 1.05s ease-in-out infinite;
}

/* The logo is a black square containing four white tiles and a yellow centre. */

.painting-loading-mosaic i:nth-child(2),
.painting-loading-mosaic i:nth-child(4),
.painting-loading-mosaic i:nth-child(6),
.painting-loading-mosaic i:nth-child(8) {
  background: #ffffff;
  opacity: 1;
}

.painting-loading-mosaic i:nth-child(5) {
  background: #ffff00;
  opacity: 1;
}

.painting-loading-mosaic i:nth-child(1),
.painting-loading-mosaic i:nth-child(3),
.painting-loading-mosaic i:nth-child(7),
.painting-loading-mosaic i:nth-child(9) {
  background: #000000;
  opacity: 1;
}

.painting-loading-mosaic i:nth-child(2) { animation-delay: .1s; }

.painting-loading-mosaic i:nth-child(3) { animation-delay: .2s; }

.painting-loading-mosaic i:nth-child(4) { animation-delay: .15s; }

.painting-loading-mosaic i:nth-child(5) { animation-delay: .25s; }

.painting-loading-mosaic i:nth-child(6) { animation-delay: .35s; }

.painting-loading-mosaic i:nth-child(7) { animation-delay: .3s; }

.painting-loading-mosaic i:nth-child(8) { animation-delay: .4s; }

.painting-loading-mosaic i:nth-child(9) { animation-delay: .5s; }

@keyframes paintingTilePulse {
  0%, 100% { opacity: .45; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1); }
}

.painting-loading-title { font-size: 15px; font-weight: 850; letter-spacing: -.02em; }

.painting-loading-caption { color: var(--muted); font-size: 12px; }

.painting-loading-track {
  width: 100%;
  height: 4px;
  margin-top: 2px;
  overflow: hidden;
  background: var(--soft-bg-hover);
}

.painting-loading-track span {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  animation: paintingLoadingSweep 1.1s ease-in-out infinite;
}

@keyframes paintingLoadingSweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(280%); }
}

.ribbon-painting-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  line-height: 1.45;
}

.ribbon-painting-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(100%, 280px);
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--foreground);
  background: var(--accent);
  color: #111;
  font: inherit;
  font-weight: 800;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: 2px 2px 0 var(--foreground);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.ribbon-painting-button:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--foreground); }

.ribbon-painting-button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--foreground); }

.ribbon-painting-button:disabled { cursor: wait; opacity: .75; }

.ribbon-painting-button.is-opening::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  margin-left: 7px;
  border: 2px solid rgba(17, 17, 17, .28);
  border-top-color: #111;
  border-radius: 50%;
  animation: ribbonButtonSpin .7s linear infinite;
}

@keyframes ribbonButtonSpin { to { transform: rotate(360deg); } }

/* =========================================================
   BRAND-ALIGNED SHARING
   ========================================================= */

#share-link-button {
  position: absolute;
  right: 10px;
  bottom: 9px;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 27px;
  min-width: 64px;
  padding: 0 8px;
  border: 1px solid var(--foreground);
  background: #ffcc00;
  color: #171717;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--box-shadow-small);
  cursor: pointer;
  transition: var(--control-transition);
}

.selection-ribbon.is-shareable #share-link-button { display: inline-flex; }

.selection-ribbon.is-shareable .selection-ribbon-copy { padding-right: 76px; }

#share-link-button:hover { background: #f5c400; border-color: var(--foreground); transform: translate(-1px, -1px); box-shadow: var(--box-shadow-hover); }

#share-link-button:active { transform: translate(2px, 2px); box-shadow: var(--box-shadow-pressed); }

#share-link-button:focus-visible { outline: 2px solid #ffcc00; outline-offset: 3px; }

.profile-painting-actions { display: flex; gap: 7px; align-items: center; }

.profile-painting-actions > button { flex: 1 1 0; }

/* Signed-in user's leaderboard position when outside the visible Top 100. */

#leaderboard-current-user-bar[hidden] { display: none !important; }

.leaderboard-current-user-bar {
  position: fixed;
  left: 50%;
  bottom: max(32px, calc(env(safe-area-inset-bottom) + 22px));
  z-index: 1200;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 180px;
  align-items: center;
  box-sizing: border-box;
  width: min(1100px, calc(100vw - 30px));
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--foreground);
  background: var(--white);
  color: var(--foreground);
  box-shadow: none;
  transform: translateX(-50%);
}

/* Mirror the current user's highlighted leaderboard row when they own squares. */
.leaderboard-current-user-bar.leaderboard-current-user-bar-highlighted {
  background: color-mix(in srgb, var(--accent) 24%, var(--white));
  box-shadow: inset 4px 0 0 var(--accent);
}
.leaderboard-current-user-bar.leaderboard-current-user-bar-highlighted > span {
  font-weight: 850;
}

.leaderboard-current-user-rank,
.leaderboard-current-user-name,
.leaderboard-current-user-squares {
  min-width: 0;
  padding: 0 18px;
  box-sizing: border-box;
}

.leaderboard-current-user-rank { display: flex; align-items: center; }
.leaderboard-current-user-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-current-user-squares { font-size: 12px; font-weight: 800; text-align: left; }
.leaderboard-unranked-message { grid-column: 1 / -1; font-size: 13px; font-weight: 800; text-align: center; white-space: nowrap; }

.leaderboard-table tbody tr.leaderboard-current-user-row {
  background: color-mix(in srgb, var(--accent) 24%, var(--white));
  box-shadow: inset 4px 0 0 var(--accent);
}

.leaderboard-table tbody tr.leaderboard-current-user-row td { font-weight: 850; }

@keyframes leaderboardBarIn { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }

/* Match the View Painting button's interaction and animation to Continue,
   while keeping its owned-square-specific sizing and visibility. */

.selection-ribbon .ribbon-painting-button {
  display: inline-flex;
  width: auto;
  min-height: 38px;
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--foreground);
  background: var(--accent);
  color: var(--white);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: none;
  transition: var(--control-transition);
}

.selection-ribbon .ribbon-painting-button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  box-shadow: none;
}

.selection-ribbon .ribbon-painting-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.selection-ribbon .ribbon-painting-button:disabled {
  cursor: wait;
}

/* Keep the Public Painting wordmark typography identical on mobile and desktop. */

.site-header .logo-text,
.site-header .logo-text .public,
.site-header .logo-text .painting {
  font-family: var(--font-display);
  font-style: normal;
  font-variant: normal;
  text-transform: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  font-synthesis: none;
}

.site-header .logo-text {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 0.9;
}

.site-header .logo-text .public {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-left: 2px;
}

.site-header .logo-text .painting {
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.045em;
}

/* Keep the splash-screen wordmark typography stable on mobile too. */

.splash .logo-text,
.splash .logo-text .public,
.splash .logo-text .painting {
  font-family: var(--font-display);
  font-style: normal;
  font-variant: normal;
  text-transform: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  font-synthesis: none;
}

.splash .logo-text {
  line-height: 0.82;
}

.splash .logo-text .public {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-left: 3px;
}

.splash .logo-text .painting {
  font-size: clamp(1.7rem, 4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

/* Approved ribbon refresh: presentation only; existing card geometry and
   action-button styling remain controlled by the original ribbon rules. */

.selection-ribbon.owned-square .selection-ribbon-copy > #selection-ribbon-title {
  display: block;
  line-height: 1.2;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-title,
.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy > #selection-ribbon-title {
  font-size: 16px;
  font-weight: 800;
}

.ribbon-owner-layout,
.ribbon-painting-heading {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

.ribbon-design-icon {
  box-sizing: border-box;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 20px;
  line-height: 1;
}

.ribbon-design-icon-user {
  color: #222;
  background: #f0f0f0;
}

.ribbon-design-icon-palette {
  color: #ff4d0a;
  background: #fff0e8;
  font-size: 20px;
}

.ribbon-design-icon-grid {
  color: #222;
  background: #f2f2f2;
  font-size: 20px;
}

.ribbon-owner-text,
.ribbon-painting-heading-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.ribbon-owner-name {
  color: var(--foreground);
  font-size: clamp(17px, 1.5vw, 19px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.ribbon-owner-coordinates {
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 1.4;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-description {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ribbon-belongs-label,
.ribbon-painting-row-label,
.ribbon-painting-size-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .045em;
  line-height: 1.3;
}

.ribbon-painting-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-top: 3px;
}

.ribbon-painting-row-label {
  flex: 0 0 auto;
}

.selection-ribbon .ribbon-painting-button.ribbon-painting-name-link {
  display: inline-flex;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--foreground);
  box-shadow: none;
  font: inherit;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
  justify-content: flex-start;
}

.selection-ribbon .ribbon-painting-button.ribbon-painting-name-link:hover:not(:disabled) {
  color: var(--accent);
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.ribbon-painting-chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
}

.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy > #selection-ribbon-description {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ribbon-stat-line,
.ribbon-painting-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ribbon-stat-line .ribbon-design-icon,
.ribbon-painting-stats .ribbon-design-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 20px;
}

.ribbon-stat-number,
.ribbon-painting-size b {
  color: var(--foreground);
  font-size: clamp(24px, 2vw, 28px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.ribbon-stat-caption,
.ribbon-painting-size {
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.35;
}

.ribbon-stat-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-title {
  font-size: 16px;
}


.ribbon-painting-creator {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 1.4;
}

.ribbon-painting-creator .ribbon-painting-by {
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
}

.ribbon-painting-creator .ribbon-owner-name {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-description {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ribbon-painting-stats-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ribbon-painting-size {
  display: flex;
  align-items: baseline;
  gap: 7px;
}


/* View Painting uses the shared action-button system, with no decorative pulse animation. */
.selection-ribbon .ribbon-view-painting-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  margin-left: auto;
  padding: 0 15px;
  border: 1px solid var(--foreground);
  border-radius: var(--control-radius, 0);
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--box-shadow-small);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  animation: none;
  transition: var(--control-transition);
}

.selection-ribbon .ribbon-view-painting-button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  box-shadow: var(--box-shadow-hover);
  text-decoration: none;
}

.selection-ribbon .ribbon-view-painting-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: var(--box-shadow-pressed);
}

.selection-ribbon .ribbon-view-painting-button:disabled,
.selection-ribbon .ribbon-view-painting-button.is-opening {
  animation: none;
}

.selection-ribbon .ribbon-view-painting-button span {
  font-size: 18px;
  line-height: 1;
}

/* Final approved ribbon refinements */

.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-text { gap: 0; }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-line { gap: 12px; }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-caption { text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description { padding-left: 12px; border-left: 1px solid var(--line); }

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-description { align-items: stretch; }

.ribbon-painting-line { display:flex; align-items:center; gap:12px; width:100%; }

.ribbon-painting-link-copy { display:flex; flex-direction:column; align-items:flex-start; gap:3px; min-width:0; flex:1; }

.selection-ribbon .ribbon-painting-button.ribbon-painting-name-link { display:block; max-width:100%; overflow-wrap:anywhere; }

.selection-ribbon.ribbon-design-painting .ribbon-painting-heading { gap:0; }

.selection-ribbon.ribbon-design-painting .ribbon-painting-heading-copy { gap:5px; }

.selection-ribbon.ribbon-design-painting .ribbon-painting-stats { gap:12px; }

.selection-ribbon.ribbon-design-painting .ribbon-painting-size-label { text-transform:uppercase; }

.ribbon-stat-copy { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-line { align-items:center; padding-right:14px; border-right:1px solid var(--line); }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-caption { color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.04em; }

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-number { font-size:27px; }

/* Ribbon polish: stronger contrast, consistent alignment, and clear section dividers.
   These overrides intentionally leave the outer ribbon geometry and action buttons untouched. */

.selection-ribbon.ribbon-design-square .selection-ribbon-content,
.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-content,
.selection-ribbon.ribbon-design-painting .selection-ribbon-content {
  gap: 12px;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy,
.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy,
.selection-ribbon.ribbon-design-painting .selection-ribbon-copy {
  gap: 12px;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-title,
.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy > #selection-ribbon-title,
.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-title {
  display: block;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--foreground);
  font-weight: 800;
}

.selection-ribbon .ribbon-owner-name,
.selection-ribbon,
.selection-ribbon .ribbon-stat-number,
.selection-ribbon .ribbon-painting-size b {
  color: var(--foreground);
  font-weight: 900;
}

.selection-ribbon .ribbon-owner-coordinates {
  color: var(--foreground);
  font-weight: 650;
}

.selection-ribbon .ribbon-belongs-label,
.selection-ribbon .ribbon-stat-caption,
.selection-ribbon .ribbon-painting-size-label {
  color: var(--muted);
  font-weight: 850;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-description,
.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy > #selection-ribbon-description,
.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-description {
  width: 100%;
  color: var(--foreground);
  align-items: stretch;
}

.selection-ribbon .ribbon-painting-line {
  box-sizing: border-box;
  width: 100%;
  padding-top: 10px;
  align-items: center;
}

.selection-ribbon .ribbon-painting-link-copy {
  flex: 1 1 auto;
}

.selection-ribbon .ribbon-painting-button.ribbon-painting-name-link {
  color: var(--foreground);
  font-weight: 900;
  line-height: 1.25;
}

.selection-ribbon .ribbon-stat-line {
  align-items: center;
}

.selection-ribbon .ribbon-stat-copy,
.selection-ribbon .ribbon-painting-stats-copy {
  gap: 5px;
}

.selection-ribbon .ribbon-stat-number,
.selection-ribbon .ribbon-painting-size b {
  color: var(--foreground);
  font-weight: 900;
}

.selection-ribbon .ribbon-stat-description {
  color: var(--foreground);
  font-weight: 600;
  line-height: 1.45;
}

.selection-ribbon .ribbon-painting-creator {
  color: var(--foreground);
  font-weight: 600;
}

.selection-ribbon .ribbon-painting-creator b {
  font-weight: 900;
}

/* Final agreed ribbon corrections */

.ribbon-design-icon-grid {
  position: relative;
  display: inline-grid !important;
  grid-template-columns: repeat(2, 9px);
  grid-template-rows: repeat(2, 9px);
  gap: 3px;
  align-content: center;
  justify-content: center;
  color: #ffcc00 !important;
  background: transparent !important;
  font-size: 0 !important;
  border-radius: 0 !important;
}

.ribbon-design-icon-grid i {
  display: block;
  width: 9px;
  height: 9px;
  background: #ffcc00;
  border-radius: 2px;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 12px;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description {
  flex: 1 1 auto;
  min-width: 180px;
  color: var(--muted);
  font-weight: 500;
}

.selection-ribbon.ribbon-design-square .ribbon-owner-coordinates {
  color: var(--muted);
  font-weight: 500;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line {
  padding-top: 0;
  border-top: 0;
}

.selection-ribbon.ribbon-design-square .ribbon-belongs-label {
  display: none !important;
}

.selection-ribbon .ribbon-painting-creator {
  color: var(--muted);
  font-weight: 500;
}

.selection-ribbon .ribbon-painting-creator b {
  font-weight: 500;
}

/* Final reference-image alignment for the three ribbons */

:root {
  --ribbon-soft-line: #d9d9d9;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-name {
  color: #ff4d0a;
  font-weight: 900;
}

.selection-ribbon.ribbon-design-leaderboard .selection-ribbon-copy > #selection-ribbon-title,
.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-title,
.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-title {
  border-bottom-color: var(--ribbon-soft-line);
}

.selection-ribbon .ribbon-stat-line {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.selection-ribbon .ribbon-stat-line .ribbon-design-icon,
.selection-ribbon .ribbon-painting-stats .ribbon-design-icon,
.selection-ribbon .ribbon-painting-line .ribbon-design-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
}

.selection-ribbon .ribbon-stat-divider,
.selection-ribbon .ribbon-stat-description-divider,
.selection-ribbon .ribbon-painting-divider {
  align-self: stretch;
  flex: 0 0 1px;
  width: 1px;
  min-height: 34px;
  background: var(--ribbon-soft-line);
}

.selection-ribbon .ribbon-stat-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
}

.selection-ribbon .ribbon-stat-caption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.selection-ribbon .ribbon-stat-number {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.selection-ribbon .ribbon-stat-description-divider {
  margin-left: 3px;
}

.selection-ribbon .ribbon-stat-description {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.selection-ribbon.ribbon-design-square .ribbon-owner-coordinates {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 0;
  padding-top: 0;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-divider {
  min-height: 38px;
  background: var(--ribbon-soft-line);
}

.selection-ribbon .ribbon-painting-link-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.selection-ribbon .ribbon-painting-square-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-stats {
  gap: 14px;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-divider {
  min-height: 42px;
  background: var(--ribbon-soft-line);
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-size-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-size b {
  font-size: 28px;
}

/* Final approved three-ribbon mockup refinements */

.selection-ribbon .ribbon-design-icon-user {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 0;
  background: transparent;
  color: #ff4d0a;
  font-size: 0;
}

.selection-ribbon .ribbon-design-icon-user::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff4d0a;
}

.selection-ribbon .ribbon-design-icon-user::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 6px;
  width: 26px;
  height: 16px;
  border-radius: 13px 13px 3px 3px;
  background: #ff4d0a;
}

.selection-ribbon .ribbon-owner-name {
  color: #ff4d0a;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-name { font-size: 14px; }

.selection-ribbon.ribbon-design-square .ribbon-owner-coordinates {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.selection-ribbon .ribbon-stat-caption,
.selection-ribbon .ribbon-stat-description,
.selection-ribbon .ribbon-painting-creator,
.selection-ribbon .ribbon-painting-size-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.selection-ribbon .ribbon-stat-number,
.selection-ribbon.ribbon-design-painting .ribbon-painting-size b {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.1;
}

.selection-ribbon .ribbon-stat-description-divider { display: none; }

.selection-ribbon .ribbon-painting-name-link {
  display: block;
  max-width: 100%;
  color: var(--foreground);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line {
  padding-top: 10px;
  border-top: 1px solid var(--ribbon-soft-line);
}

.selection-ribbon.ribbon-design-square .ribbon-painting-divider {
  background: var(--ribbon-soft-line);
}

.selection-ribbon.ribbon-design-square .ribbon-painting-square-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.selection-ribbon.ribbon-design-painting .selection-ribbon-copy > #selection-ribbon-title {
  display: block;
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--ribbon-soft-line);
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-heading {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-heading-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.selection-ribbon.ribbon-design-painting {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-creator {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-stats {
  display: flex;
  align-items: center;
  gap: 14px;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-size-label { font-size: 14px; }



/* Small ribbon corrections: keep one soft separator before the canvas note,
   and only one horizontal divider between allocated-square sections. */

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-divider,
.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description-divider {
  display: none !important;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description {
  border-left: 1px solid var(--ribbon-soft-line, #d9d9d9);
  padding-left: 14px;
  margin-left: 0;
}

.selection-ribbon.ribbon-design-square .selection-ribbon-copy > #selection-ribbon-title {
  border-bottom: 1px solid var(--ribbon-soft-line, #d9d9d9);
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line {
  border-top: 0 !important;
  padding-top: 0 !important;
}

/* Latest ribbon refinements: remove the dark right separator from the
   leaderboard note, ensure square count is readable, and add a painting icon. */

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description {
  border-right: 0 !important;
  box-shadow: none !important;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-link-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-name-link {
  display: block;
  color: var(--foreground);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-square-count {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-title-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selection-ribbon.ribbon-design-painting .ribbon-painting-title-line .ribbon-design-icon-palette {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ff4d0a;
  font-size: 26px;
}

/* Latest user-requested corrections */

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description,
.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description::before,
.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description::after {
  border-right: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-square-count {
  display: none !important;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line > .ribbon-design-icon-palette {
  color: #ff4d0a;
}

/* Final ribbon polish: remove the unwanted right-hand leaderboard divider
   and keep the painting icon identical in both ribbon types. */

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-line,
.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-copy,
.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description {
  border-right: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.selection-ribbon.ribbon-design-leaderboard .ribbon-stat-description-divider {
  display: none !important;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line > .ribbon-design-icon-palette,
.selection-ribbon.ribbon-design-painting .ribbon-painting-heading > .ribbon-design-icon-palette {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ff4d0a;
  font-size: 26px;
}

/* User-requested typography consistency: keep ribbon text at one size. */

/* Light label above the painting name in the allocated-square ribbon. */

.selection-ribbon.ribbon-design-square .ribbon-belongs-label {
  display: block !important;
  color: var(--muted, #888);
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-link-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Painting icon replacement only: ornate gold frame instead of the palette emoji. */

.selection-ribbon .ribbon-design-icon-palette {
  color: #D4A72C !important;
  font-size: 20px;
  line-height: 1;
}

.selection-ribbon .ribbon-design-icon-palette .painting-frame-svg {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  overflow: visible;
}

/* Keep the painting icon the same gold in every theme and location. */

/* Keep the Share button compact like its earlier version. */

.selection-ribbon #share-link-button { font-size: 10px !important; min-height: 27px; min-width: 64px; padding: 0 8px; }

/* Google OAuth button */

.auth-secondary-button {
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.auth-secondary-button:hover {
  background: rgba(127, 127, 127, 0.08);
}

.auth-secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* Familiar, neutral Google sign-in button styling. */

.google-signin-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 16px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #3c4043;
  box-shadow: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .1px;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.google-signin-button:hover {
  background: #f8faff;
  border-color: #d2e3fc;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .18);
  color: #3c4043;
}

.google-signin-button:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

.google-signin-button:disabled {
  cursor: wait;
  opacity: .72;
}

.google-signin-logo {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

/* Login provider first, then a compact OR divider before email/password. */

.auth-or-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.auth-or-separator::before,
.auth-or-separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border-color, #d1d5db);
}

.google-signin-button { margin-top: 0; }

/* Full-screen feedback while returning from the Google OAuth redirect. */

.oauth-return-loader {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: var(--background, #fff);
  color: var(--foreground, #222);
  font-size: 14px;
  font-weight: 600;
  opacity: 1;
  transition: opacity 180ms ease;
}

.oauth-return-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.oauth-return-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: oauthReturnSpin 0.75s linear infinite;
}

@keyframes oauthReturnSpin {
  to { transform: rotate(360deg); }
}

/* Profile page layout polish: preserve the site's sharp edges, colors and shadows. */

.profile-page-content .profile-header { margin-top: 0; }

.profile-page-content .profile-account-card {
  display: grid;
  grid-template-columns: 50px minmax(180px, 1fr) minmax(260px, 1.15fr);
  align-items: center;
  gap: 14px;
}

.profile-page-content .profile-account-card > svg { width: 50px; height: 50px; }

.profile-page-content .profile-account-details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }

.profile-page-content .profile-account-field + .profile-account-field { margin-top: 0; }

.profile-page-content .profile-rank {
  display: flex; align-items: center; justify-content: flex-start; gap: 9px;
  width: fit-content; min-width: 0; margin: 7px 0 0; padding: 4px 9px;
  text-align: left; background: var(--soft-bg, #f7f5f0);
}

.profile-page-content .profile-rank-number { display: inline; font-size: 15px; }

.profile-page-content .profile-rank-label { display: inline; margin: 0; }

.profile-account-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.profile-account-stat { min-width: 0; padding: 12px 10px; border: 1px solid var(--line, #d2d0ca); background: var(--background, #fff); }

.profile-account-stat span { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; }

.profile-account-stat strong { display: block; margin-top: 5px; color: var(--foreground); font-size: 21px; line-height: 1; }

.profile-page-content .profile-squares-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 8px; }

.profile-page-content .profile-square-item { min-width: 0; }

.profile-page-content .profile-paintings-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 8px; }

/* Fix only the painting icon shown in the allocated-square ribbon. Leave the painting ribbon unchanged. */

.selection-ribbon.ribbon-design-leaderboard .ribbon-painting-line > .ribbon-design-icon-palette,
.selection-ribbon.ribbon-design-square .ribbon-painting-line > .ribbon-design-icon-palette {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  flex: 0 0 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #D4A72C !important;
  font-size: 26px !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.selection-ribbon.ribbon-design-square .ribbon-painting-line > .ribbon-design-icon-palette .painting-frame-svg {
  display: block !important;
  width: 26px !important;
  height: 26px !important;
  flex: 0 0 26px !important;
  overflow: visible;
}









@media (prefers-reduced-motion: reduce) {
.splash {
    animation: none;
  }
.splash-icon rect:not(:first-child) {
    opacity: 1;
    transform: none;
  }
.splash .logo-text {
    opacity: 1;
    transform: none;
    animation: none;
  }
.auth-message.loading::before,
  .auth-primary-button.is-loading::before {
    animation-duration: 1.8s;
  }
.connection-banner, .network-toast, .painting-loading-overlay { transition: none; }
.request-progress span, .profile-skeleton-row *, .painting-skeleton-card *, .leaderboard-skeleton-row span, .painting-loading-mosaic i, .painting-loading-track span { animation: none; }
.painting-loading-overlay, .painting-loading-card, .ribbon-painting-button { transition: none; }
.painting-loading-mosaic i, .painting-loading-track span, .ribbon-painting-button.is-opening::after { animation: none; }
#share-link-button { transition: none; }
.leaderboard-current-user-bar { animation: none; }
.oauth-return-spinner { animation-duration: 1.8s; }
}







@media (prefers-color-scheme: dark) {
.selection-ribbon .ribbon-design-icon-palette { color: #D4A72C !important; }
}



/* =========================================================
   CONSOLIDATED PAGE-SPECIFIC STYLES
   ========================================================= */

/* Consolidated page styles: id="profile-route-styles" */
.profile-route-page{position:fixed;top:var(--header-height,68px);right:0;bottom:0;left:0;z-index:2;box-sizing:border-box;overflow:hidden;min-height:0;height:calc(100dvh - var(--header-height,68px));padding:12px 18px;background:var(--background,var(--soft-bg,#f7f5f0));color:var(--foreground,#171717)}
.profile-route-page[hidden]{display:none!important}
.profile-route-inner{width:min(760px,100%);height:100%;min-height:0;margin:0 auto;display:flex;flex-direction:column}
.profile-route-heading{flex:0 0 auto;display:flex;align-items:center;justify-content:flex-start;gap:18px;padding:0 0 8px;border-bottom:1px solid var(--line,#171717);margin:0 0 8px}
.profile-route-heading h1{margin:2px 0 0;font-size:clamp(24px,3vw,32px);line-height:1.05;letter-spacing:-.04em}
.profile-route-eyebrow{margin:0;color:var(--accent,#ff4d00);font-size:9px;font-weight:800;letter-spacing:.13em}
.profile-page-content{display:flex;flex:1 1 auto;flex-direction:column;width:100%;max-width:none;min-height:0;overflow:hidden}
.profile-page-content .profile-header{flex:0 0 auto;margin:0 0 8px}
.profile-page-content .profile-account-card{padding:8px;gap:10px}
.profile-page-content .profile-account-card svg{width:38px;height:38px;flex:0 0 38px}
.profile-page-content .profile-account-field + .profile-account-field{margin-top:5px}
.profile-page-content .profile-rank{flex:0 0 auto;margin:0 0 8px;padding:7px 12px}
.profile-page-content .profile-rank-number{font-size:21px}
.profile-page-content .profile-rank-label{margin-top:3px}
.profile-page-content .profile-squares{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;height:auto;margin:0;padding:10px;overflow:hidden}
.profile-page-content .profile-content-tabs{flex:0 0 auto;margin:-10px -10px 0;padding:0 12px;gap:22px}
.profile-page-content #profile-squares-content,.profile-page-content #profile-paintings-content{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;overflow:hidden}
.profile-page-content #profile-squares-content[hidden],.profile-page-content #profile-paintings-content[hidden]{display:none!important}
.profile-page-content #profile-square-count,.profile-page-content #profile-painting-count{flex:0 0 auto;margin:8px 0;font-size:11px}
.profile-page-content .profile-squares-list,.profile-page-content .profile-paintings-list{flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto}
.profile-page-content #view-all-squares-button{flex:0 0 auto;margin-top:6px;min-height:32px;padding:7px 10px}
.profile-page-content #logout-button{flex:0 0 auto;margin-top:8px;margin-bottom:24px;padding-top:0;padding-bottom:0}



/* Consolidated page styles: site */
.pp-legal-footer{position:fixed;right:12px;left:auto;bottom:10px;z-index:11000;max-width:calc(100vw - 24px);padding:0;background:transparent;border:0;box-shadow:none;font:10px/1.3 var(--font-sans);text-align:right}.pp-legal-footer nav{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 9px}.pp-legal-footer a{color:var(--accent,#ff4d00);text-decoration:underline;text-underline-offset:2px;font-weight:700;white-space:nowrap}

/* Consolidated page styles: id="legal-route-styles" */
.legal-route-container{color-scheme:light dark;--bg:var(--background);--fg:var(--foreground);--muted: #697180;--accent: #f45b25;--panel:var(--white);--line: #dfe3e8;--shadow:var(--box-shadow);font-family:var(--font-sans)}
.legal-route-container, .legal-route-container *{box-sizing:border-box}.legal-route-container, .legal-route-container{margin:0;min-height:100%;background:var(--bg);color:var(--fg)}.legal-route-container{line-height:1.65}.legal-route-container a{color:var(--accent);text-underline-offset:3px}.legal-route-container a:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.legal-route-container main{width:min(900px,calc(100% - 36px));margin:calc(var(--header-height,68px) + 28px) auto 64px;min-width:0;overflow-wrap:anywhere}.legal-route-container .eyebrow{font-size:11px;letter-spacing:.12em;font-weight:800;color:var(--accent);text-transform:uppercase}.legal-route-container h1{font-size:clamp(32px,5vw,48px);line-height:1.08;letter-spacing:-.045em;margin:8px 0 14px}.legal-route-container h2{font-size:21px;line-height:1.25;margin:30px 0 8px;letter-spacing:-.02em}.legal-route-container p, .legal-route-container li{max-width:78ch}.legal-route-container p{margin:10px 0}.legal-route-container ul{padding-left:22px}.legal-route-container .intro{font-size:18px;color:var(--muted);max-width:68ch}.legal-route-container .panel{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);padding:clamp(18px,4vw,30px);margin:24px 0}.legal-route-container .links{display:flex;flex-wrap:wrap;gap:10px 18px;margin-top:20px}.legal-route-container .button-link{display:inline-block;padding:10px 14px;border:1px solid var(--line);box-shadow:2px 2px 0 var(--line);color:var(--fg);font-weight:700;text-decoration:none}.legal-route-container .button-link.primary{background:var(--accent);color:white;border-color:var(--accent)}.legal-route-container .bottom{border-top:1px solid var(--line);padding:18px clamp(18px,5vw,64px);display:flex;flex-wrap:wrap;gap:8px 18px;font-size:12px;color:var(--muted)}.legal-route-container .bottom a{color:var(--accent)}.legal-route-container .notice{border-left:3px solid var(--accent);padding:10px 14px;background:#fff7f2}.legal-route-container .muted{color:var(--muted);font-size:13px}
.legal-route-container .pp-legal-footer{position:fixed;right:12px;left:auto;bottom:10px;z-index:11000;max-width:calc(100vw - 24px);padding:0;background:transparent;border:0;box-shadow:none;font:10px/1.3 var(--font-sans);text-align:right}.legal-route-container .pp-legal-footer nav{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 9px}.legal-route-container .pp-legal-footer a{color:var(--accent,#ff4d00);text-decoration:underline;text-underline-offset:2px;font-weight:700;white-space:nowrap}
/* Shared homepage header and responsive legal-page layout */
.legal-route-container .site-header{position:fixed;top:0;left:0;right:0;width:100%;z-index:10000}
.legal-route-container main{min-width:0;overflow-wrap:anywhere}
.legal-route-container main img, .legal-route-container main svg, .legal-route-container main video, .legal-route-container main iframe{max-width:100%;height:auto}
.legal-route-container main pre, .legal-route-container main code{white-space:pre-wrap;overflow-wrap:anywhere}
.legal-route-container main .panel{max-width:100%}
.legal-route-container .pp-legal-footer{z-index:10001}


.legal-route-container{position:fixed;inset:0;z-index:1;height:100vh;min-height:100vh;overflow-y:auto;overflow-x:hidden;padding-top:1px;padding-bottom:100px;background:var(--bg,#f7f5f0);color:var(--fg,#171717);font-family:var(--font-sans);line-height:1.65}.legal-route-container[hidden]{display:none!important}.legal-route-container .legal-route-main{display:block;width:min(900px,calc(100% - 36px));margin:96px auto 64px;min-width:0;overflow-wrap:anywhere;text-align:left}.legal-route-container .legal-route-main h1{font-size:clamp(32px,5vw,48px)}.legal-route-container .legal-route-main h2{font-size:21px}.legal-route-container .legal-route-main p,.legal-route-container .legal-route-main li{max-width:78ch}.legal-route-container .legal-route-main a{color:var(--accent,#ff4d00)}

html.dark-mode .legal-route-container{--muted:#a0a9b7;--accent:#ff7040;--line:#303946;--shadow:var(--box-shadow);}

/* Consolidated page styles: id="profile-final-adjustments" */
.profile-route-inner{width:min(950px,100%)}
.profile-route-page{padding-top:12px}
.profile-route-heading{display:none!important}
.profile-page-content .profile-account-card{grid-template-columns:50px minmax(180px,1fr) minmax(300px,1.2fr);gap:14px;align-items:center}
.profile-page-content .profile-account-card>.profile-avatar-icon{display:inline-flex;position:relative;width:42px;height:42px;flex:0 0 42px;border:0!important;outline:0!important;background:transparent!important;box-shadow:none!important;border-radius:0!important}
.profile-page-content .profile-account-card>.profile-avatar-icon::before{content:"";position:absolute;top:7px;left:15px;width:12px;height:12px;border-radius:50%;background:#ff4d0a}
.profile-page-content .profile-account-card>.profile-avatar-icon::after{content:"";position:absolute;left:8px;bottom:6px;width:26px;height:16px;border-radius:13px 13px 3px 3px;background:#ff4d0a}
.profile-account-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;align-self:center}
.profile-account-stat{padding:4px 0;border:0!important;background:transparent!important;box-shadow:none!important}
.profile-account-stat>span{font-size:12px;display:flex;align-items:center;justify-content:center;gap:7px;color:var(--muted);text-align:center}
.profile-account-stat strong{display:block;font-size:22px;margin-top:5px;text-align:center}
.profile-account-stat{text-align:center}
/* Profile icons reuse the exact ribbon icon artwork, colors, and visual scale. */
.profile-account-stat .profile-stat-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 20px;width:20px;height:20px;font-size:0;background:transparent!important;border-radius:0!important;color:inherit}
.profile-account-stat .profile-stat-icon.ribbon-design-icon-grid{display:inline-grid!important;grid-template-columns:repeat(2,6px);grid-template-rows:repeat(2,6px);gap:2px;align-content:center;justify-content:center;color:#ffcc00!important}
.profile-account-stat .profile-stat-icon.ribbon-design-icon-grid i{display:block;width:6px;height:6px;background:#ffcc00;border-radius:1.5px}
.profile-account-stat .profile-stat-icon.ribbon-design-icon-palette{width:20px;height:20px;flex-basis:20px;color:#D4A72C!important}
.profile-account-stat .painting-frame-svg{display:block;width:20px!important;height:20px!important;flex:0 0 20px;overflow:visible}
.profile-page-content .profile-rank{grid-column:1/-1;width:100%;min-height:38px;margin:2px 0 0;padding:5px 14px;background:color-mix(in srgb, #ffe36a 42%, var(--white));border:1px solid var(--line);box-shadow:none;display:flex;align-items:center;justify-content:center;gap:10px;text-align:center}
.profile-page-content .profile-rank-number{font-size:17px;order:2}
.profile-page-content .profile-rank-label{font-size:11px;letter-spacing:.1em;order:1}
.profile-page-content .profile-content-tabs{display:flex;align-items:stretch;gap:24px;border-bottom:1px solid var(--line);padding:0 10px}
.profile-page-content .profile-content-tab{position:relative;display:inline-flex;align-items:center;gap:8px;padding:13px 2px 12px;border:0!important;border-radius:0!important;margin:0;background:transparent!important;color:var(--muted)!important;box-shadow:none!important;font-weight:700;cursor:pointer}
.profile-page-content .profile-content-tab:hover{color:var(--foreground)!important;background:transparent!important;box-shadow:none!important}
.profile-page-content .profile-content-tab.active{background:transparent!important;color:var(--foreground)!important}
.profile-page-content .profile-content-tab.active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;display:block;background:#ff4d0a}
.profile-tab-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 20px;width:20px;height:20px;font-size:0;background:transparent!important;border-radius:0!important;color:inherit}
.profile-tab-icon.ribbon-design-icon-grid{display:inline-grid!important;grid-template-columns:repeat(2,6px);grid-template-rows:repeat(2,6px);gap:2px;align-content:center;justify-content:center;color:#ffcc00!important}
.profile-tab-icon.ribbon-design-icon-grid i{display:block;width:6px;height:6px;background:#ffcc00;border-radius:1.5px}
.profile-tab-icon.ribbon-design-icon-palette{width:20px;height:20px;flex:0 0 20px;color:#D4A72C!important}
.profile-tab-icon .painting-frame-svg{display:block;width:20px!important;height:20px!important;flex:0 0 20px;overflow:visible}



/* Keep the profile painting icon identical to the orange ribbon artwork. */
.profile-account-stat .profile-stat-icon.ribbon-design-icon-palette,
.profile-tab-icon.ribbon-design-icon-palette { color: #D4A72C !important; }
.profile-account-stat .painting-frame-svg,
.profile-tab-icon .painting-frame-svg { width: 20px !important; height: 20px !important; display: block; flex: 0 0 20px; overflow: visible; }



/* Legal pages use their own slim scrollbar; prevent the browser/window scrollbar. */
html:has(.legal-route-container:not([hidden])),
html:has(.legal-route-container:not([hidden])) body {
  overflow: hidden;
}
.legal-route-container {
  scrollbar-width: thin;
  scrollbar-color: var(--foreground) transparent;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.legal-route-container::-webkit-scrollbar { width: 5px; height: 0; }
.legal-route-container::-webkit-scrollbar-track { background: transparent; }
.legal-route-container::-webkit-scrollbar-thumb { background: var(--foreground); border-radius: 0; }
.legal-route-container::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.legal-route-container::-webkit-scrollbar-button,
.legal-route-container::-webkit-scrollbar-button:single-button,
.legal-route-container::-webkit-scrollbar-button:vertical:decrement,
.legal-route-container::-webkit-scrollbar-button:vertical:increment { display: none; width: 0; height: 0; }
@media (prefers-reduced-motion: reduce) {
  .legal-route-container { scroll-behavior: auto; }
}


/* =========================================================
   MOBILE-ONLY RESPONSIVE LAYOUT
   Desktop styling above remains the source of truth.
   ========================================================= */
@media (max-width: 700px) {
  :root { --header-height: 58px; }

  .site-header {
    height: var(--header-height);
    padding: 0 12px;
    gap: 12px;
  }
  .site-header .logo { gap: 0; flex: 0 0 auto; }
  .site-header .logo svg { width: 32px; height: 32px; flex: 0 0 32px; }
  .site-header .logo-text { display: none !important; }
  .site-header .navigation {
    min-width: 0;
    gap: clamp(10px, 3vw, 20px);
    margin: 0 0 0 auto;
    flex: 0 1 auto;
    flex-shrink: 1;
  }
  .site-header .navigation a {
    font-size: clamp(10px, 2.7vw, 12px);
    white-space: nowrap;
  }
  .site-header .header-button {
    flex: 0 0 auto;
    max-width: 34vw;
    padding: 7px 8px;
    font-size: 10px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    letter-spacing: 0 !important;
  }

  .wall-page { height: 100dvh; min-height: 420px; }
  .canvas-display-controls {
    top: calc(var(--header-height) + 8px);
    right: 8px;
    width: 112px;
    box-sizing: border-box;
    gap: 7px;
    padding: 7px 8px;
    max-width: calc(100vw - 16px);
  }
  .display-toggle {
    width: 100%;
    min-width: 0;
    gap: 8px;
    justify-content: space-between;
  }
  .display-toggle-label { flex: 1 1 auto; min-width: 0; line-height: 16px; }
  .display-switch { flex: 0 0 30px; }
  .available-squares-box {
    top: calc(var(--header-height) + 8px);
    left: 8px;
    min-width: 0;
    max-width: 38vw;
    padding: 7px 8px;
    gap: 2px;
    font-size: 10px;
  }
  .available-squares-box * { max-width: 100%; overflow-wrap: anywhere; }
  .auth-modal, .purchase-confirmation { padding: 10px; align-items: center; }
  .auth-panel, .purchase-confirmation-panel {
    width: 100%;
    max-width: 430px;
    max-height: calc(100dvh - 20px);
    padding: 20px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .auth-heading h2 { font-size: 22px; }
  .auth-view form { gap: 12px; }
  .legal-route-container .legal-route-main {
    width: calc(100% - 24px);
    margin: calc(var(--header-height) + 18px) auto 36px;
  }
  .legal-route-container .legal-route-main h1 { font-size: clamp(27px, 8vw, 38px); }
  .legal-route-container .legal-route-main h2 { font-size: 19px; }
  .legal-route-container .intro { font-size: 15px; }
  .legal-route-container .panel { padding: 16px; margin: 18px 0; }

  /* Mobile ribbons keep the desktop composition and are scaled as a whole below. */

  /* Profile route scrolls as a page; content and logout are never clipped. */
  .profile-route-page {
    top: var(--header-height);
    height: calc(100dvh - var(--header-height));
    min-height: 0;
    padding: 8px 12px 10px;
    overflow: hidden;
  }
  .profile-route-inner { width: 100%; height: 100%; min-height: 0; }
  .profile-page-content { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .profile-page-content .profile-account-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .profile-page-content .profile-account-card > .profile-account-stats,
  .profile-page-content .profile-account-card > .profile-rank {
    grid-column: 1 / -1;
    width: 100%;
  }
  .profile-page-content .profile-account-details { min-width: 0; overflow-wrap: anywhere; }
  .profile-page-content .profile-account-field h2 { font-size: 18px; overflow-wrap: anywhere; }
  .profile-page-content .profile-account-field p { overflow-wrap: anywhere; }
  .profile-account-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-account-stat { min-width: 0; padding: 10px 8px; }
  .profile-account-stat strong { font-size: 19px; }
  .profile-squares {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
  }
  .profile-page-content #profile-squares-content,
  .profile-page-content #profile-paintings-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .profile-page-content #profile-squares-content[hidden],
  .profile-page-content #profile-paintings-content[hidden] { display: none !important; }
  .profile-page-content #profile-square-count,
  .profile-page-content #profile-painting-count { flex: 0 0 auto; margin: 6px 0; }
  .profile-page-content .profile-squares-list,
  .profile-page-content .profile-paintings-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .profile-page-content #view-all-squares-button { flex: 0 0 auto; margin-top: 5px; min-height: 30px; }

  .profile-content-tabs { gap: clamp(12px, 5vw, 28px); margin: -10px -10px 0; padding: 0 10px; }
  .profile-content-tab { min-width: 0; gap: 5px; font-size: 10px; white-space: nowrap; }
  .profile-squares-list { max-height: none; overflow: visible; }
  .profile-page-content .profile-squares-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-page-content .profile-paintings-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-square-item, .profile-painting-card { min-width: 0; }
  .profile-square-coordinate, .profile-painting-name { overflow-wrap: anywhere; }
  #logout-button { flex: 0 0 auto; width: 100%; min-height: 38px; margin: 8px 0 40px; }


}

/* Mobile zoom control: dock it on the right and let any open ribbon sit above it. */
@media (max-width: 600px) {
  .canvas-controls {
    left: auto;
    right: 8px;
    bottom: 18px;
    z-index: 2100;
  }
}

@media (max-width: 390px) {
  .site-header { padding: 0 8px; gap: 7px; }
  .site-header .logo svg { width: 28px; height: 28px; flex-basis: 28px; }
  .site-header .navigation { gap: 8px; }
  .site-header .navigation a { font-size: 10px; }
  .site-header .header-button { max-width: 31vw; padding: 6px; font-size: 9px; }
  .profile-route-page { padding-left: 8px; padding-right: 8px; }
  .profile-content-tab { font-size: 9px; }
}


/* Mobile ribbon treatment: preserve the exact desktop structure and square-corner styling.
   Scale the whole desktop ribbon as one unit so its columns, controls and text never collide. */
@media (max-width: 600px) {
  .selection-ribbon {
    left: 50%;
    right: auto;
    bottom: 52px;
    width: 520px;
    max-width: none;
    min-width: 520px;
    min-height: 82px;
    max-height: calc((100dvh - var(--header-height) - 90px) / 0.70);
    padding: 18px 22px;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: var(--box-shadow);
    overflow-x: hidden;
    overflow-y: auto;
    zoom: 0.70;
    transform: translate(-50%, 140%);
    transform-origin: bottom center;
  }
  .selection-ribbon.visible { transform: translate(-50%, 0); }

  /* In paint mode, keep the two controls together and give the full palette
     its own row underneath them so every colour remains visible on phones. */
  .selection-ribbon.paint-mode .selection-ribbon-actions {
    grid-template-columns: auto auto;
    grid-template-rows: auto auto auto auto;
    align-items: center;
  }
  .selection-ribbon.paint-mode #move-canvas-button {
    grid-column: 1;
    grid-row: 1;
  }
  .selection-ribbon.paint-mode #erase-paint-button {
    grid-column: 2;
    grid-row: 1;
  }
  .selection-ribbon.paint-mode .color-palette {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    grid-template-rows: repeat(2, auto);
    gap: 5px;
    justify-content: stretch;
    align-items: center;
    padding: 5px;
    margin: 2px 0 0;
  }
  .selection-ribbon.paint-mode .color-option {
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 1 / 1;
    justify-self: stretch;
    box-sizing: border-box;
  }
  .selection-ribbon.paint-mode .selection-count {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: start;
  }
  .selection-ribbon.paint-mode .buy-paint-button {
    grid-column: 1 / -1;
    grid-row: 4;
  }
}
@media (max-width: 380px) {
  .selection-ribbon { zoom: 0.64; max-height: calc((100dvh - var(--header-height) - 90px) / 0.64); }
}
@media (min-width: 431px) and (max-width: 600px) {
  .selection-ribbon { zoom: 0.78; max-height: calc((100dvh - var(--header-height) - 90px) / 0.78); }
}

/* Center the transparent legal-link row on mobile instead of pinning it to the right. */
@media (max-width: 600px) {
  .pp-legal-footer,
  .legal-route-container .pp-legal-footer {
    left: 50%;
    right: auto;
    width: max-content;
    max-width: calc(100vw - 20px);
    transform: translateX(-50%);
    text-align: center;
  }
  .pp-legal-footer nav,
  .legal-route-container .pp-legal-footer nav {
    justify-content: center;
  }
}

/* Mobile zoom dock: horizontal, centered, and clear of the fixed legal links. */
@media (max-width: 600px) {
  .canvas-controls {
    left: 50%;
    right: auto;
    bottom: 42px;
    width: min(220px, calc(100vw - 32px));
    height: 42px;
    padding: 4px 9px;
    box-sizing: border-box;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transform: translateX(-50%);
    z-index: 2100;
  }

  .canvas-controls .zoom-icon {
    flex: 0 0 16px;
    width: 16px;
    height: 100%;
  }

  #zoom-out-button { order: 0; }
  #zoom-slider { order: 1; }
  #zoom-in-button { order: 2; }

  #zoom-slider {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    transform: none;
  }
}


/* Touch screens can keep :hover latched after a tap. Keep toggle colours tied
   to their real ON state, and limit decorative hover feedback on touch. */
@media (hover: none), (pointer: coarse) {
  .selection-ribbon.paint-mode .paint-mode-button:not(.active):hover {
    background: var(--soft-bg);
    border-color: var(--foreground);
    color: var(--foreground);
    box-shadow: var(--box-shadow-small);
  }

  .selection-ribbon.paint-mode .paint-mode-button.active:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white);
    box-shadow: var(--box-shadow-small);
  }

  .display-toggle:hover .display-switch {
    border-color: var(--foreground);
  }

  .display-toggle:hover .display-toggle-label {
    color: var(--foreground);
  }
}


/* Keep the homepage purpose statement on the legal-links row on desktop, and below the zoom dock on mobile. */
.pp-homepage-description{position:fixed;left:50%;right:auto;bottom:10px;z-index:10999;width:max-content;max-width:calc(100vw - 24px);margin:0;transform:translateX(-50%);color:var(--muted,#888);font:9px/1.2 var(--font-sans);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
@media (max-width:900px){.pp-homepage-description{left:50%;right:auto;width:max-content;max-width:calc(100vw - 16px);font-size:8px}}
@media (max-width:600px){.pp-homepage-description{left:8px;right:8px;bottom:27px;width:auto;max-width:none;transform:none;font-size:8px;line-height:1.1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}
/* The global homepage tagline is not part of the legal-page layout. */
body:has(.legal-route-container:not([hidden])) .pp-homepage-description { display: none !important; }

@media (max-width: 600px) {
  .leaderboard-current-user-bar { bottom: max(58px, calc(env(safe-area-inset-bottom) + 48px)); grid-template-columns: 58px minmax(0, 1fr) 88px; width: calc(100vw - 20px); height: 44px; min-height: 44px; }
  .leaderboard-current-user-rank, .leaderboard-current-user-name, .leaderboard-current-user-squares { padding-left: 10px; padding-right: 10px; }
  .leaderboard-table-wrapper.has-current-user-bar { margin-bottom: 0; }
}

/* Keep the fixed global tagline away from the mobile profile/logout controls. */
body:has(#profile-page:not([hidden])) .pp-homepage-description { display: none !important; }


/* Painting names stay in their featured gold style in both ribbons, without underline/hover-only styling. */
.selection-ribbon .ribbon-painting-name-link,
.selection-ribbon .ribbon-viewing-painting-name {
  color: #d4a72c !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  font-style: italic;
  letter-spacing: -0.015em;
  line-height: 1.25 !important;
  text-decoration: none !important;
  border: 0 !important;
  padding-bottom: 0 !important;
  overflow-wrap: anywhere;
}
.selection-ribbon .ribbon-painting-button.ribbon-painting-name-link:hover:not(:disabled),
.selection-ribbon .ribbon-painting-name-link:hover,
.selection-ribbon .ribbon-viewing-painting-name:hover {
  color: #d4a72c !important;
  text-decoration: none !important;
}
.selection-ribbon.ribbon-design-square .ribbon-belongs-label {
  color: var(--muted, #888);
  font-size: 11px !important;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Keep the password-recovery OTP form hidden until a code request succeeds.
   The general .auth-view form rule sets display:flex and otherwise overrides
   the browser's default [hidden] styling. */
#forgot-password-code-form[hidden] {
  display: none !important;
}

/* Auth screens must respect the hidden attribute despite flex form styles. */
.auth-view[hidden] { display: none !important; }


/* Fixed vector wordmark: no platform font substitution on desktop or mobile. */
.brand-wordmark{display:block;width:112px;height:36px;flex:0 0 auto;overflow:visible;color:currentColor}
.site-header .brand-wordmark{width:112px;height:36px}
.splash .brand-wordmark{width:145px;height:47px;opacity:0;transform:translateX(-8px);animation:textIn .5s cubic-bezier(.2,.8,.2,1) .55s forwards}
@media(max-width:640px){.site-header .brand-wordmark{width:108px;height:35px}}

/* Six-cell OTP presentation with a single accessible/autofill-compatible input. */
.otp-entry{position:relative;width:min(100%,360px);margin:8px auto 18px}
.otp-digits{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px}
.otp-digit{height:52px;display:flex;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:8px;background:var(--soft-bg);color:var(--foreground);font-size:23px;font-weight:750;line-height:1;transition:border-color .15s,background .15s,box-shadow .15s}
.otp-entry:focus-within .otp-digit{border-color:var(--accent);background:var(--soft-bg-hover)}
.otp-digit.is-filled{background:var(--background);border-color:var(--muted);}
.otp-digit.is-active{border:2px solid var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 15%,transparent)}
.otp-native-input{position:absolute!important;inset:0;width:100%!important;height:100%!important;margin:0!important;padding:0!important;border:0!important;opacity:0!important;cursor:text!important;z-index:2;font-size:16px!important}
.otp-native-input:focus{outline:none!important;box-shadow:none!important}
@media(max-width:420px){.otp-digits{gap:6px}.otp-digit{height:48px;font-size:21px;border-radius:7px}}


/* FINAL MOBILE BRAND RULE:
   The mobile header must show only the square icon, never the wordmark text. */
@media screen and (max-width: 700px) {
  header.site-header .logo .brand-wordmark,
  header.site-header .logo .logo-text,
  header.site-header .logo .public,
  header.site-header .logo .painting {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}


/* View Painting creator typography and rank badge. Keep the username aligned
   with the Selected Square owner name while making rank easy to scan. */
.ribbon-painting-creator {
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ribbon-painting-creator .ribbon-owner-name {
  font-size: clamp(17px, 1.5vw, 19px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.ribbon-owner-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 23px;
  box-sizing: border-box;
  padding: 0 7px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ribbon-owner-rank-badge.leaderboard-rank-1,
.ribbon-owner-rank-badge.leaderboard-rank-2,
.ribbon-owner-rank-badge.leaderboard-rank-3 {
  border-color: currentColor;
}
.ribbon-owner-rank-badge.leaderboard-rank-1 { background: #ffe08a; color: #6f4b00; }
.ribbon-owner-rank-badge.leaderboard-rank-2 { background: #e5e7eb; color: #4b5563; }
.ribbon-owner-rank-badge.leaderboard-rank-3 { background: #edc09a; color: #75421e; }

/* Shared rank badge: crisp rectangular label, with no drop or inset shadow. */
.ribbon-owner-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 21px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 0;
  box-shadow: none !important;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ribbon-owner-rank-badge.leaderboard-rank-1 { background: #ffe08a; color: #6f4b00; border-color: #b8860b; }
.ribbon-owner-rank-badge.leaderboard-rank-2 { background: #e5e7eb; color: #4b5563; border-color: #9ca3af; }
.ribbon-owner-rank-badge.leaderboard-rank-3 { background: #edc09a; color: #75421e; border-color: #b77945; }

/* Keep each ribbon username and its rank badge on one shared line. */
.selection-ribbon.ribbon-design-square .ribbon-owner-text,
.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-text {
  display: block;
  min-width: 0;
}
.selection-ribbon.ribbon-design-square .ribbon-owner-name,
.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-name {
  display: inline;
  vertical-align: middle;
}
.selection-ribbon.ribbon-design-square .ribbon-owner-rank-badge,
.selection-ribbon.ribbon-design-leaderboard .ribbon-owner-rank-badge,
.selection-ribbon.ribbon-design-painting .ribbon-owner-rank-badge {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
  border-radius: 0;
  box-shadow: none !important;
  white-space: nowrap;
}
.selection-ribbon.ribbon-design-painting .ribbon-painting-creator {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}
.selection-ribbon.ribbon-design-painting .ribbon-painting-creator .ribbon-owner-rank-badge {
  /* The creator row already supplies the shared 6px flex gap. */
  margin-left: 0;
}
.selection-ribbon .ribbon-owner-coordinates {
  display: block;
}
