/* The chrome every screen wears — tokens and themes, headings, the sign-in
   modal, the theme switch and the desktop rail. A screen's own sheet keeps
   only what is its own. */
/* The faces the tokens name, served by the app itself (fonts/, SIL OFL,
   @fontsource-variable 5.3.0): the page's CSP admits fonts from 'self' only. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-ba344451eab25b217a165363b1982048a5e5830a0daf36577973955a04cac793-nunito-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-2c8d792869818ecb253a46bc3c63c7013df7aac2f69291c3c85e5cdc94160960-nunito-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: italic; font-weight: 200 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-6cfcc3786d5ba3b5c3a41797f95272e57f4290ccbd283a4bfd0033a3d857e64c-nunito-latin-wght-italic.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Nunito"; font-style: italic; font-weight: 200 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-1bb48a49c837d76a727223515b78eb2a14eaab783563be84b0718f338c56c846-nunito-latin-ext-wght-italic.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-9fea608a947e67020c33cad9a6fe3d60c54119dfb8cff87768a8117a15ed7543-dm-sans-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-a5d38fe99f930275684999b462c7123faa063d9e44e73b4b241723d884aa0f49-dm-sans-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: italic; font-weight: 100 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-f1a235db5bcb8730707844188d35201ecdf63e56c5dcce97bab24a9c7066091d-dm-sans-latin-wght-italic.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "DM Sans"; font-style: italic; font-weight: 100 1000; font-display: swap; src: url("/shell/shared/fonts/_immutable-6e646d2022808fb4532e77d38a9348e4dcf832796be2acc43a79052b60900db2-dm-sans-latin-ext-wght-italic.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* --- Shared Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--size-1);
  font-family: inherit;
  font-size: var(--type-caption);
  font-weight: 700;
  line-height: 20px;
  padding: 10px var(--sp-md);
  border-radius: var(--r-md);
  border: var(--border-size-1) solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  box-sizing: border-box;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

@media screen and (min-width: 860px) {
  body {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body > nav {
    z-index: 100;
    background: var(--snapcards-neutral);
    border-right: 1px solid var(--snapcards-border);
    box-shadow: none;
    padding: 0;
    gap: 0;
    transition: width var(--motion-fast) var(--motion-ease);
  }

  body > nav::before {
    content: "Snapcards";
    display: block;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--snapcards-primary);
    padding: 20px 20px 14px 20px;
    height: 58px;
    margin: 0;
    box-sizing: border-box;
    border-bottom: none;
  }

  body > nav::after {
    display: none;
  }

  body > nav > a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 24px);
    margin: 2px 12px;
    padding: 9px 14px;
    min-height: 42px;
    height: 42px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--snapcards-secondary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
  }

  body > nav > a:hover {
    background: var(--snapcards-surface-muted);
    color: var(--snapcards-primary);
    text-decoration: none;
  }

  body > nav > a[data-route="cards"]::before { content: "🏠"; font-size: 16px; }
  body > nav > a[data-route="generate"]::before { content: "✨"; font-size: 16px; }
  body > nav > a[data-param-shelf="mine"]::before { content: "🗂️"; font-size: 16px; }
  body > nav > a[data-param-shelf="gallery"]::before { content: "🌐"; font-size: 16px; }
  body > nav > a[data-route="print"]::before { content: "🖨️"; font-size: 16px; }
  body > nav > a[data-route="about"]::before { content: "📖"; font-size: 16px; }

  body > nav > a[data-route="about"] {
    margin-top: auto;
  }

  body > nav > a[aria-current="page"] {
    background: #F59E0B;
    color: #181D25;
    font-weight: 700;
    border: none;
    box-shadow: none;
  }

  /* Move User Account Profile & Sair to Bottom of Sidebar */
  body > nav .shell-me {
    margin-top: 0;
    margin-inline-start: 0;
    width: 100%;
    box-sizing: border-box;
    padding: var(--sp-md);
    border-top: 1px solid var(--snapcards-border);
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
  }

  body > nav .shell-who {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    min-width: 0;
    text-decoration: none;
  }

  body > nav .shell-who::before {
    content: "";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-full, 9999px);
    background-color: var(--snapcards-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23525B6C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid var(--snapcards-border);
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  body > nav .shell-who[data-guest]::before {
    border-radius: var(--r-sm, 6px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23525B6C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2' ry='2'/%3E%3Cpath d='M12 18h.01'/%3E%3C/svg%3E");
  }

  body > nav .shell-who .handle {
    font-weight: 600;
    color: var(--snapcards-primary);
    font-size: var(--type-caption);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
  }

  body > nav .shell-who[data-guest] .handle {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
  }

  body > nav .shell-who[data-guest] .handle::after {
    content: "Salvo neste aparelho";
    font-size: 11px;
    font-weight: 400;
    color: var(--snapcards-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :lang(en) body > nav .shell-who[data-guest] .handle::after { content: "Saved on this device"; }

  :lang(es) body > nav .shell-who[data-guest] .handle::after { content: "Guardado en este dispositivo"; }

  :lang(he) body > nav .shell-who[data-guest] .handle::after { content: "שמור במכשיר זה"; }

  :lang(zh) body > nav .shell-who[data-guest] .handle::after { content: "保存在此设备上"; }

  body > nav .shell-who .name {
    font-size: var(--type-label);
    color: var(--snapcards-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body > main#app {
    margin-left: var(--size-13);
    width: calc(100% - var(--size-13));
    max-width: calc(100% - var(--size-13));
    box-sizing: border-box;
    min-width: 0;
    min-height: 100vh;
  }

}

body[data-auth="user"] .btn-top-login,
body:has(> nav .shell-me[data-auth="user"] .shell-signout) .btn-top-login {
  display: none !important;
}

body > nav .shell-me[data-auth="guest"] .shell-signin,
body > nav .shell-register,
body > nav .shell-provider {
  display: none !important;
}

body > nav .shell-me[data-auth="guest"] .shell-who {
  cursor: pointer;
}

body > nav .shell-signin,
body > nav .shell-signout {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--type-caption);
  color: var(--snapcards-secondary);
  background: var(--snapcards-surface);
  border: 1px solid var(--snapcards-border);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  transition: all var(--motion-fast) var(--motion-ease);
}

body > nav .shell-signout:hover {
  background: light-dark(#FEF2F2, rgba(239, 68, 68, 0.15));
  color: var(--danger);
  border-color: light-dark(#FECACA, rgba(239, 68, 68, 0.3));
}

body > nav .shell-signout::before {
  content: "⎋";
  font-size: 14px;
  line-height: 1;
}

.shell-auth-feedback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.shell-auth-error {
  margin: 0;
  font-size: var(--type-caption);
  color: var(--danger);
}

.shell-auth-recover {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--type-caption);
  color: var(--snapcards-primary);
  background: var(--snapcards-surface);
  border: 1px solid var(--snapcards-border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  cursor: pointer;
}

/* Login & Portability Modal */
.login-modal-chk {
  display: none !important;
}

.login-modal-overlay {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 9999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.5rem !important;
  animation: fadeInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.login-modal-chk:checked ~ .login-modal-overlay,
[data-status="login"] .login-modal-overlay,
.login-modal-overlay[data-open="true"] {
  display: flex !important;
}

[data-auth-state="🔑"] .method-passkey,
[data-auth-state="🌐"] .method-google {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.login-modal-card {
  position: relative !important;
  background: #ffffff !important;
  border-radius: 1.25rem !important;
  max-width: 480px !important;
  width: 100% !important;
  padding: 2.25rem 2rem 2rem !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  font-family: inherit !important;
  color: #1e293b !important;
}

.login-modal-close {
  position: absolute !important;
  top: 1.25rem !important;
  right: 1.25rem !important;
  width: 2rem !important;
  height: 2rem !important;
  border-radius: 50% !important;
  border: none !important;
  padding: 0 !important;
  background: #f1f5f9 !important;
  color: #526175 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  transition: all 0.15s ease !important;
  user-select: none !important;
}

.login-modal-close:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

.login-modal-header {
  margin-bottom: 1.5rem !important;
}

.login-modal-brand {
  display: inline-block !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: #0369a1 !important;
  margin-bottom: 0.35rem !important;
}

.login-modal-title {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  letter-spacing: -0.02em !important;
  margin: 0 0 0.5rem !important;
}

.login-modal-desc {
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  color: #475569 !important;
  margin: 0 !important;
}

.login-status-card {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.75rem 1rem !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.75rem !important;
  margin-bottom: 1.25rem !important;
  font-size: 0.8125rem !important;
}

.login-status-card .status-label {
  color: #526175 !important;
}

.login-status-card .status-name {
  color: #0f172a !important;
  font-weight: 600 !important;
}

.login-status-card .status-badge {
  color: #15803d !important;
  font-weight: 500 !important;
}

.login-modal-methods {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

.login-method-btn {
  display: flex !important;
  align-items: center !important;
  gap: 1rem !important;
  width: 100% !important;
  text-align: left !important;
  font-family: inherit !important;
  padding: 0.875rem 1.125rem !important;
  border-radius: 0.875rem !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  user-select: none !important;
  text-decoration: none !important;
  color: inherit !important;
  box-sizing: border-box !important;
}

.login-method-btn:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05) !important;
}

.login-method-icon {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 0.625rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.25rem !important;
  flex-shrink: 0 !important;
}

.method-icon-passkey {
  background: #eff6ff !important;
  color: #2563eb !important;
}

.method-icon-google {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}

.method-icon-guest {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

.login-method-info {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.125rem !important;
}

.login-method-title {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  color: #0f172a !important;
}

.login-method-hint {
  font-size: 0.75rem !important;
  color: #526175 !important;
  line-height: 1.35 !important;
}

/* ==========================================================================
   Snapcards.fun Refined Design System, Sidebar Navigation & Theme Toggles
   ========================================================================== */
:root {
  --font-display: "Nunito", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Nunito", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shell-font: 1rem/1.5 var(--font-body);
  --shell-heading-font: var(--font-display);
  --snapcards-primary: light-dark(#181D25, #F8FAFC);
  --snapcards-secondary: light-dark(#525B6C, #94A3B8);
  --snapcards-accent: light-dark(#B45309, #FBBF24);
  --snapcards-neutral: light-dark(#FAF8F5, #0B0F17);
  --snapcards-surface: light-dark(#FFFFFF, #111827);
  --snapcards-border: light-dark(#E8E4DD, #1E293B);
  --snapcards-surface-muted: light-dark(#F3EFEA, #1A2234);
}

body:has(.shell-screen:not([hidden]) .device-scope[data-theme="light"]) {
  color-scheme: light !important;
}

body:has(.shell-screen:not([hidden]) .device-scope[data-theme="dark"]) {
  color-scheme: dark !important;
}

body, .screen, body > nav, body > nav > a, body > nav button {
  font-family: var(--font-body) !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

h1, h2, h3, .crumb-brand, .hero-title, .section-title, .card-set-title, .desk-deck-title, .card-back-title, .generator-title, .print-main-title {
  font-family: var(--font-display) !important;
}

.theme-radio {
  display: none !important;
}

/* The device region only scopes reads (screens/*.html): it adds no box. */
.device-scope {
  display: contents;
}

.header-utility-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--snapcards-surface-muted);
  border: 1px solid var(--snapcards-border);
  border-radius: 9999px;
  padding: 3px;
  box-sizing: border-box;
}

.theme-btn {
  /* A button, not a label: the agent's button face must not show through. */
  appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  min-width: 28px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--snapcards-secondary);
  cursor: pointer;
  user-select: none;
  line-height: 1;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.theme-btn:hover {
  color: var(--snapcards-primary);
  background: var(--snapcards-surface);
}

.device-scope[data-theme="auto"] .theme-btn[data-theme-val="auto"],
.device-scope[data-theme="light"] .theme-btn[data-theme-val="light"],
.device-scope[data-theme="dark"] .theme-btn[data-theme-val="dark"] {
  background: #F59E0B !important;
  color: #181D25 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

body > nav > a[data-route="explore"],
body > nav > a[data-route="deck"],
body > nav > a[data-route="card"] {
  display: none !important;
}
