:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: #ffffff;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  padding: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.locale-page {
  --locale-foreground: #0b0b0b;
  --locale-muted: rgba(11, 11, 11, 0.5);
  --locale-border: rgba(11, 11, 11, 0.09);
  --locale-surface: rgba(11, 11, 11, 0.08);
  --locale-panel: rgba(11, 11, 11, 0.06);
  --locale-tile: rgba(11, 11, 11, 0.02);
  --locale-hover: rgba(11, 11, 11, 0.035);
  --locale-toolbar: rgba(11, 11, 11, 0.06);
  --locale-shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
  position: relative;
  min-height: 100vh;
  color: var(--locale-foreground);
  background-color: #ffffff;
}

.page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.content {
  position: relative;
  z-index: 10;
  padding-bottom: 10rem;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
}

.topbar-pad {
  width: 100%;
  padding: 1rem;
}

.topbar-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.entry-pill {
  display: flex;
  height: 60px;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  border-radius: 999px;
  padding: 0 0.75rem;
  background: var(--locale-toolbar);
  backdrop-filter: blur(24px);
}

.icon-button,
.round-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--locale-foreground);
  background: var(--locale-toolbar);
  backdrop-filter: blur(24px);
  box-shadow: var(--locale-shadow);
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.icon-button:hover,
.round-button:hover,
.chip-button:hover {
  transform: scale(1.03);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.icon-button .icon-backplate {
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--locale-foreground) 0%, var(--locale-background, #fff));
}

.round-button {
  width: 60px;
  height: 60px;
  border-radius: 999px;
}

.round-button.active {
  background: var(--locale-foreground);
  color: var(--locale-background, #ffffff);
}

.sample-input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--locale-foreground);
  background: transparent;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  line-height: 1;
}

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

.main-stage {
  padding-top: 5.75rem;
}

.center-state {
  display: flex;
  min-height: calc(100vh - 5.75rem);
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.load-button {
  min-height: 124px;
  width: min(420px, 100%);
  border-radius: 2rem;
  padding: 2rem;
  color: white;
  background: black;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 500;
  line-height: 1;
  transition: transform 160ms ease;
}

.load-button:hover {
  transform: scale(1.01);
}

.state-text {
  margin: 0;
  color: var(--locale-foreground);
  text-align: center;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.unavailable {
  width: min(900px, 100%);
  border: 1px solid var(--locale-border);
  border-radius: 2rem;
  padding: 2.25rem 2.5rem;
  text-align: center;
  background: var(--locale-panel);
  backdrop-filter: blur(24px);
}

.eyebrow {
  margin: 0;
  color: var(--locale-muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.message {
  margin: 1rem 0 0;
  color: var(--locale-foreground);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.45;
}

.font-grid {
  display: grid;
  width: 100%;
  border-left: 1px solid var(--locale-border);
  grid-template-columns: repeat(auto-fill, minmax(max(260px, 25%), 1fr));
}

.font-list {
  width: 100%;
  border-left: 1px solid var(--locale-border);
}

.font-tile {
  position: relative;
  display: flex;
  min-height: 260px;
  cursor: pointer;
  flex-direction: column;
  border-right: 1px solid var(--locale-border);
  border-bottom: 1px solid var(--locale-border);
  padding: 1.5rem;
  color: var(--locale-foreground);
  background: transparent;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 260px;
  scroll-margin-top: 104px;
}

.font-tile.list {
  display: block;
  min-height: 180px;
  padding: 1.5rem 5rem 1.5rem 1.5rem;
  contain-intrinsic-size: 0 180px;
}

.font-tile:hover {
  background: var(--locale-hover);
}

.font-tile.saved {
  color: var(--saved-foreground);
  background: var(--saved-background);
}

.font-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  color: var(--tile-muted, var(--locale-muted));
}

.font-name {
  min-width: 0;
  margin: 0;
  padding-right: 1rem;
  overflow-wrap: anywhere;
  color: var(--tile-muted, var(--locale-muted));
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  transform: translateY(2px);
}

.chip-button {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  color: var(--tile-muted, var(--locale-muted));
  background: var(--tile-chip, var(--locale-panel));
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 150ms ease, filter 150ms ease;
}

.preview-wrap {
  min-width: 0;
  margin-top: 4rem;
}

.font-tile.list .preview-wrap {
  margin-top: 2rem;
}

.preview-line {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 1rem;
}

.font-tile:not(.list) .preview-line {
  justify-content: center;
}

.sample-preview {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: var(--preview-size);
  font-style: var(--preview-style);
  font-weight: var(--preview-weight);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.focus-action {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--locale-foreground);
  background: var(--locale-toolbar);
  box-shadow: var(--locale-shadow);
  opacity: 0;
  transform: translateY(-50%);
  backdrop-filter: blur(24px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.font-tile:hover .focus-action,
.font-tile:focus-within .focus-action {
  opacity: 1;
}

.empty-saved {
  display: flex;
  min-height: calc(100vh - 5.75rem);
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.bottom-toolbar {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  display: flex;
  max-width: calc(100vw - 1.5rem);
  transform: translateX(-50%);
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.bottom-toolbar .round-button,
.focus-toolbar .round-button {
  width: 48px;
  height: 48px;
}

.tool-pill {
  display: flex;
  min-width: 180px;
  align-items: center;
  gap: 0.75rem;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: var(--locale-foreground);
  background: var(--locale-toolbar);
  box-shadow: var(--locale-shadow);
  backdrop-filter: blur(24px);
}

.tool-icon {
  display: flex;
  min-width: 1.5rem;
  justify-content: center;
}

.range {
  width: 100%;
  height: 6px;
  cursor: pointer;
  appearance: none;
  border-radius: 999px;
  background: var(--locale-border);
  accent-color: var(--locale-foreground);
}

.range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  appearance: none;
  border-radius: 999px;
  background: var(--locale-foreground);
}

.range-value {
  width: 2.5rem;
  color: var(--locale-foreground);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.swatch-group {
  position: relative;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 999px;
  padding: 0.5rem;
  background: var(--locale-toolbar);
  box-shadow: var(--locale-shadow);
  backdrop-filter: blur(24px);
}

.swatch {
  position: relative;
  display: flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: transparent;
  transition: transform 150ms ease;
}

.swatch.active {
  transform: scale(1.1);
}

.swatch-ring {
  position: absolute;
  inset: 2px;
  border-radius: 999px;
}

.swatch.active .swatch-ring {
  box-shadow: 0 0 0 2px var(--locale-foreground);
}

.swatch-dot {
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.swatch-painting {
  background-image: url("./images/locale.jpg");
  background-position: center;
  background-size: cover;
}

.swatch-custom {
  background-color: white;
  background-image:
    radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.98) 0%,
      rgba(255, 255, 255, 0.92) 16%,
      rgba(255, 255, 255, 0.68) 28%,
      rgba(255, 255, 255, 0.24) 44%,
      rgba(255, 255, 255, 0) 62%
    ),
    conic-gradient(
      from 0deg,
      #ff4d4d 0deg,
      #ff9a1f 52deg,
      #f5f749 104deg,
      #54e346 156deg,
      #34d5d0 208deg,
      #3f83ff 260deg,
      #7b5cff 308deg,
      #ff4da6 340deg,
      #ff4d4d 360deg
    );
}

.custom-popover,
.upload-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: 272px;
  border-radius: 1.75rem;
  padding: 0.75rem;
  background: var(--locale-toolbar);
  box-shadow: var(--locale-shadow);
  backdrop-filter: blur(24px);
}

.custom-popover {
  display: grid;
  gap: 0.5rem;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--locale-toolbar);
}

.color-row span {
  width: 92px;
  color: var(--locale-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.color-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--locale-foreground);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.upload-wrap {
  position: relative;
}

.upload-popover {
  width: 300px;
}

.drop-label {
  display: flex;
  min-height: 110px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 1.35rem;
  padding: 1.25rem;
  color: var(--locale-foreground);
  background: var(--locale-toolbar);
  text-align: center;
}

.drop-label span {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.logo-preview {
  flex: 0 0 auto;
  max-width: 35vw;
  max-height: min(18vh, 180px);
  object-fit: contain;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  color: var(--locale-foreground);
  background-color: var(--locale-background, #ffffff);
}

.dialog-overlay.painting {
  background-image: linear-gradient(var(--painting-overlay), var(--painting-overlay)),
    url("./images/locale.jpg");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--locale-border);
  padding: 1.25rem 1.25rem 1rem;
}

.dialog-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 1rem;
}

.dialog-close {
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--locale-foreground);
  background: var(--locale-toolbar);
  box-shadow: var(--locale-shadow);
  backdrop-filter: blur(24px);
}

.dialog-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--locale-foreground);
  font-size: clamp(1.35rem, 2.8vw, 2.8rem);
  font-weight: 500;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-subtitle {
  margin: 0.45rem 0 0;
  color: var(--locale-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.style-count {
  color: var(--locale-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.style-list {
  border-left: 1px solid var(--locale-border);
}

.style-row {
  position: relative;
  min-height: 180px;
  border-right: 1px solid var(--locale-border);
  border-bottom: 1px solid var(--locale-border);
  padding: 1.5rem 5rem 1.5rem 1.5rem;
  background: transparent;
  transition: background-color 150ms ease;
}

.style-row:hover {
  background: var(--locale-hover);
}

.style-label {
  margin: 0;
  color: var(--locale-muted);
  font-size: 14px;
  font-weight: 500;
}

.style-row .sample-preview {
  margin-top: 1.9rem;
}

.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  color: var(--locale-foreground);
  background-color: var(--locale-background, #ffffff);
}

.focus-overlay.painting {
  background-image: linear-gradient(var(--painting-overlay), var(--painting-overlay)),
    url("./images/locale.jpg");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

.focus-body {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 8rem;
}

.focus-preview {
  display: flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.focus-preview .sample-preview {
  max-width: min(100%, 14ch);
  text-align: center;
  font-size: var(--focus-size);
  line-height: 0.9;
}

.focus-toolbar {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  display: flex;
  max-width: calc(100vw - 1.5rem);
  transform: translateX(-50%);
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.glyph-pop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  color: var(--locale-foreground);
  font-size: clamp(12rem, 40vw, 31.25rem);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.08em;
}

.skeleton-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(max(260px, 25%), 1fr));
}

.skeleton {
  min-height: 240px;
  border-right: 1px solid var(--locale-border);
  border-bottom: 1px solid var(--locale-border);
  padding: 1.5rem;
  background: var(--locale-tile);
  animation: pulse 1.6s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.skeleton-line.title {
  width: 6rem;
}

.skeleton-line.preview {
  width: 74%;
  height: 64px;
  margin-top: 3rem;
}

.skeleton-line.footer {
  width: 8rem;
  margin-top: 3rem;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

svg {
  display: block;
}

.icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 760px) {
  .topbar-pad {
    padding: 0.75rem;
  }

  .entry-pill,
  .round-button {
    height: 54px;
  }

  .round-button {
    width: 54px;
  }

  .font-grid {
    grid-template-columns: 1fr;
  }

  .bottom-toolbar,
  .focus-toolbar {
    bottom: 0.75rem;
    gap: 0.45rem;
  }

  .bottom-toolbar .round-button,
  .focus-toolbar .round-button {
    width: 56px;
    height: 56px;
  }

  .tool-pill {
    min-width: 150px;
    padding: 0.75rem 1rem;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .swatches {
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .custom-popover,
  .upload-popover {
    right: 50%;
    transform: translateX(50%);
  }

  .dialog-header {
    padding: 1rem;
  }
}
