/* Screen layouts. */

/* ---- top bar & footer ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgb(255 255 255 / 85%); backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 1120px; margin: 0 auto; padding: .6rem 1.25rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.1rem; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 2rem; height: 2rem; }
.avatar {
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; cursor: pointer;
  border: 0; background: linear-gradient(135deg, var(--brand), #8a5cf6); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
}
.avatar[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.site-footer { display: flex; justify-content: center; gap: .5rem; padding: 1.25rem; font-size: .85rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer .lang-switch { display: inline-flex; gap: .75rem; }
.site-footer .lang-switch strong { color: var(--text, inherit); font-weight: 600; }
.site-footer .lang-switch .link { font-size: inherit; font-weight: 400; color: var(--muted); text-decoration: underline; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head p { margin-top: .25rem; }
.actions { display: flex; gap: .5rem; align-items: center; }

.loading { flex: 1; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--muted); }

/* ---- signed-out pages ---- */
.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art {
  position: relative; display: flex; flex-direction: column; gap: 2rem; padding: 2rem 3rem 3rem;
  color: #fff; overflow: hidden;
  background:
    radial-gradient(circle at 85% 10%, rgb(255 193 69 / 35%), transparent 40%),
    radial-gradient(circle at 10% 90%, rgb(46 196 182 / 35%), transparent 45%),
    linear-gradient(150deg, #5046e5, #3a2fb8);
}
.auth-art .brand { color: #fff; }
.auth-art .brand .logo { box-shadow: 0 0 0 2px rgb(255 255 255 / 35%); border-radius: 9px; }
.art-frame {
  align-self: center; width: min(440px, 100%); margin-top: auto; padding: 10px; background: #fff;
  border-radius: 14px; box-shadow: 0 30px 60px rgb(10 5 60 / 35%); transform: rotate(-2.5deg);
}
.page-art { display: block; width: 100%; height: auto; border-radius: 6px; }
.auth-pitch { align-self: center; width: min(440px, 100%); margin-bottom: auto; }
.auth-pitch h2 { font-size: 1.6rem; margin-bottom: .9rem; }
.auth-pitch ul { list-style: none; padding: 0; display: grid; gap: .5rem; opacity: .92; }
.auth-pitch li { display: flex; align-items: center; gap: .6rem; }
.auth-pitch .icon { width: 1.1rem; height: 1.1rem; opacity: .85; }

.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem 1.25rem 0; }
.auth-card { width: min(400px, 100%); display: grid; gap: .9rem; margin: auto 0; }
.auth-card h1 { font-size: 1.65rem; }
.auth-card .form { margin-top: .6rem; }
.switch { text-align: center; color: var(--muted); margin-top: .4rem; }
.auth-brand-mobile { display: none; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-main { justify-content: flex-start; padding-top: 1.5rem; }
  .auth-brand-mobile { display: block; align-self: flex-start; margin-bottom: 2rem; }
  .auth-card { margin: 0 0 auto; }
}

/* ---- albums ---- */
.album-card { color: inherit; transition: transform .15s, box-shadow .15s; }
.album-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.thumb-empty { color: var(--line-strong); }
.thumb-empty .icon { width: 2.5rem; height: 2.5rem; }

/* ---- album: photo cards ---- */
.photo-card .thumb { position: relative; }
.photo-card a.thumb img { transition: transform .3s; }
.photo-card a.thumb:hover img { transform: scale(1.04); }
.thumb.processing { gap: .6rem; align-content: center; justify-items: center; color: var(--muted); font-size: .9rem; }
.thumb.failed { color: var(--danger); }
.thumb.failed .icon { width: 2rem; height: 2rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: -.2rem -.4rem .15rem 0; }
.versions { display: grid; gap: .2rem; }
.version {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .55rem;
  padding: .4rem .5rem; margin: 0 -.5rem; border-radius: var(--r-sm); color: inherit; font-size: .85rem;
}
a.version:hover { background: var(--surface-2); text-decoration: none; }
.version-k { color: var(--muted); white-space: nowrap; }
.version-pct { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 2.6em; text-align: right; }
.version-pct .icon { width: 1rem; height: 1rem; color: var(--ok); margin-left: auto; }
.version.pending, .version.failed { grid-template-columns: auto 1fr auto; }
.version.failed .version-k { color: var(--danger); }

.drop-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none;
  background: rgb(80 70 229 / 12%); border: 3px dashed var(--brand); border-radius: var(--r-lg); margin: .5rem;
}
.drop-overlay > div {
  display: grid; justify-items: center; gap: .5rem; padding: 1.5rem 2rem;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); font-weight: 650;
}
.drop-overlay .icon { width: 2rem; height: 2rem; color: var(--brand); }

@media (max-width: 640px) {
  a.version .version-k { display: none; }
  a.version { grid-template-columns: auto 1fr auto; }
  .page-head .actions .btn { flex: 1; }
  .page-head .actions { width: 100%; }
}

/* ---- account ---- */
.section { padding: 1.25rem 1.35rem; margin-bottom: 1rem; display: grid; gap: 1rem; }
.section h2 { font-size: 1.05rem; }
.section .form { max-width: 380px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-head p { margin-top: .35rem; }
.usage { display: grid; gap: .4rem; }
.usage-text { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; }
.usage .meter { height: 8px; }
.usage .meter > span { background: var(--brand); }
.danger-zone { box-shadow: var(--shadow-sm); border: 1px solid #f2d0d0; }

/* ---- coloring ---- */
.color-screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.color-bar {
  display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2;
}
.color-bar .progress { flex: 1; display: flex; align-items: center; gap: .6rem; max-width: 280px; margin: 0 auto; }
.color-bar .progress .meter { flex: 1; height: 8px; }
#progress-text { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; font-size: .9rem; }
.tools { display: flex; align-items: center; gap: .3rem; }
.tools .icon-btn:not([aria-pressed="true"]):not(.active) { border-color: transparent; }
.tool-sep { width: 1px; height: 1.5rem; background: var(--line); margin: 0 .2rem; }

.board {
  flex: 1; min-height: 0; position: relative;
  background: #ebe8e2 radial-gradient(rgb(29 27 44 / 9%) 1px, transparent 1px) 0 0 / 18px 18px;
}
.board-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: crosshair; user-select: none; }
.board-stage {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff;
  box-shadow: 0 2px 6px rgb(29 27 44 / 10%), 0 12px 40px rgb(29 27 44 / 14%);
}
.layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.solution { opacity: 0; transition: opacity .15s; }
.solution.visible { opacity: 1; }

.palette {
  display: flex; justify-content: safe center; gap: .55rem; overflow-x: auto; scrollbar-width: thin;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.swatch {
  flex: none; display: grid; place-content: center; justify-items: center; width: 3.3rem; height: 3.3rem;
  border: 0; border-radius: 14px; background: var(--c); color: var(--fg); cursor: pointer; line-height: 1;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.swatch .num { font-weight: 750; font-size: 1.05rem; }
.swatch .left { font-size: .68rem; font-weight: 600; opacity: .85; margin-top: .25rem; }
.swatch .left .icon { width: .85rem; height: .85rem; }
.swatch:hover { transform: translateY(-2px); }
.swatch.selected { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%), 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.swatch.done { opacity: .38; }
.swatch.done.selected { opacity: .7; }

@media (max-width: 640px) {
  .color-bar { gap: .4rem; padding: .4rem .5rem; }
  .tools { gap: .1rem; }
  .palette { gap: .45rem; padding-left: .75rem; padding-right: .75rem; }
  .swatch { width: 2.95rem; height: 2.95rem; border-radius: 12px; }
}

/* "You finished it!" */
.finished-art { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.finished-art img { width: 100%; }
.finished-art .sparkle { position: absolute; top: .6rem; right: .6rem; width: 2rem; height: 2rem; color: var(--sun); filter: drop-shadow(0 1px 2px rgb(0 0 0 / 40%)); }
