:root {
  color-scheme: dark;
  --bg: #171717;
  --stage: #0e0e0e;
  --surface: #1b1b1b;
  --raised: #292929;
  --line: #343434;
  --text: #f5f5f5;
  --muted: #a6a6a6;
  --accent: #ffd34e;
  --danger: #f19e96;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button,
a,
input,
select,
summary {
  outline-offset: 4px;
}
:focus-visible {
  outline: 2px solid var(--accent);
}
svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}
.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--stage);
  display: flex;
  align-items: center;
  justify-content: center;
}
#preview {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.stage-top,
.stage-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.stage-top {
  top: max(12px, env(safe-area-inset-top));
  justify-content: space-between;
}
.stage-bottom {
  bottom: 12px;
}
.stage-top > *,
.stage-bottom > * {
  pointer-events: auto;
}
.photo-actions {
  display: flex;
  gap: 6px;
}
.glass-button,
.glass-icon {
  border: 1px solid #ffffff20;
  color: white;
  background: #151515a8;
  backdrop-filter: blur(12px);
  border-radius: 7px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 500;
}
.glass-icon {
  width: 44px;
  padding: 0;
}
.glass-button:hover,
.glass-icon:hover {
  background: #252525d9;
}
.glass-button svg {
  width: 17px;
  height: 17px;
}
.glass-button[aria-pressed="true"] {
  background: var(--accent);
  color: #171717;
  border-color: var(--accent);
}
.photo-caption {
  min-width: 0;
  flex: 1;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 5px #000;
  pointer-events: none;
}
.photo-caption span {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  letter-spacing: 0.05em;
}
.photo-caption strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.strength-button {
  font-variant-numeric: tabular-nums;
  padding: 0 8px;
}
#detailsBtn {
  width: 44px;
  border: 0;
  background: #15151570;
}
#detailsBtn svg {
  width: 17px;
}
#detailsBtn.needs-profile {
  color: var(--accent);
}
.original-badge {
  position: absolute;
  left: 50%;
  top: 66px;
  transform: translateX(-50%);
  background: #151515cf;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
}
.stage-loading {
  position: absolute;
  padding: 10px 16px;
  color: var(--text);
  background: #171717c9;
  border-radius: 6px;
  font-size: 13px;
}
.tools {
  height: calc(222px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tool-header {
  flex-shrink: 0;
  height: 53px;
  padding: 0 15px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.tool-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  padding: 0;
}
.icon-button:hover,
.icon-button[aria-pressed="true"] {
  color: var(--accent);
  background: #ffffff06;
}
.icon-button svg {
  width: 18px;
  height: 18px;
}
.button {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.accent {
  background: var(--accent);
  color: #171717;
  border-color: var(--accent);
}
.accent:hover {
  background: #ffdf78;
  border-color: #ffdf78;
}
.secondary {
  background: var(--raised);
  color: var(--text);
  border-color: var(--line);
}
.danger {
  background: #432421;
  color: #ffc6c0;
  border-color: #61312d;
}
.compact {
  min-height: 44px;
  margin-left: 9px;
  padding: 0 15px;
  font-size: 12px;
  border-radius: 5px;
}
.filter-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.categories {
  height: 35px;
  display: flex;
  gap: 17px;
  align-items: stretch;
  padding: 0 20px;
  flex-shrink: 0;
}
.category {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.category.active {
  border-color: var(--accent);
  color: var(--accent);
}
.tiny-count:not(:empty) {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.8;
}
.group-label {
  flex: 1;
  margin-left: auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}
.group-label select {
  width: 90px;
  min-height: 28px;
  height: 28px;
  margin: 0;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  text-overflow: ellipsis;
}
.preset-list {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 9px 15px 10px;
  scrollbar-width: thin;
  scrollbar-color: #484848 transparent;
  overscroll-behavior: contain;
}
.preset {
  flex: 0 0 69px;
  position: relative;
  min-width: 0;
}
.preset-select {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
  text-align: left;
  width: 100%;
  display: block;
}
.thumb-frame {
  display: block;
  position: relative;
  width: 100%;
  height: 79px;
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #252525;
}
.thumb-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preset.active .thumb-frame {
  border-color: var(--accent);
}
.preset.active .preset-name {
  color: var(--accent);
}
.preset-name {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}
.preset-group {
  display: block;
  font-size: 10px;
  color: #8b8b8b;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.star {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  background: #11111185;
  border: 0;
  color: #fff;
  border-radius: 0 5px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.star svg {
  width: 14px;
  height: 14px;
}
.preset:hover .star,
.preset:focus-within .star,
.preset.active .star,
.star.on {
  opacity: 1;
}
.star.on {
  color: var(--accent);
}
.star.on svg {
  fill: var(--accent);
}
.empty {
  margin: 14px 5px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.mine-actions {
  display: flex;
  gap: 14px;
  padding: 0 20px 6px;
  align-items: center;
  flex-shrink: 0;
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  min-height: 36px;
  color: var(--accent);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 500;
}
.text-button svg {
  width: 14px;
  height: 14px;
}
.danger-text {
  color: var(--danger);
}
.tools.mine-mode {
  height: calc(260px + env(safe-area-inset-bottom));
}
.search-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 15px 8px;
}
.search-row input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  font-size: 14px;
}
.tools.search-mode {
  height: calc(266px + env(safe-area-inset-bottom));
}
.tools.search-mode.mine-mode {
  height: calc(304px + env(safe-area-inset-bottom));
}
.tools.adjust-mode {
  height: min(370px, 52dvh);
}
.adjust-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 20px 14px;
}
.adjust-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.adjust-heading p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.adjust-controls {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 5px 0 0;
  scrollbar-width: thin;
  scrollbar-color: #484848 transparent;
}
.adjust-control {
  margin: 0 0 8px;
}
.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  margin: 13px 0 0;
}
.range-label output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 30px;
  margin: 3px 0;
  cursor: pointer;
}
.save-adjustments {
  margin-top: 10px;
  flex-shrink: 0;
  min-height: 44px;
  font-size: 13px;
}
.desktop-footer {
  display: none;
}
.toast {
  position: fixed;
  z-index: 10;
  bottom: calc(238px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  background: #f1f0eb;
  color: #1a1a1a;
  box-shadow: 0 4px 24px #0005;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  text-align: center;
}
dialog {
  color: var(--text);
}
.modal {
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
  width: min(440px, 100%);
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  box-shadow: 0 -10px 60px #0005;
  overflow-y: auto;
}
.modal::backdrop {
  background: #0009;
  backdrop-filter: blur(4px);
}
/* Keep the cross-origin sign-in frame out of backdrop-filter compositing. */
body:has(> #loginDialog[open]) > .editor {
  filter: blur(4px);
}
#loginDialog::backdrop {
  backdrop-filter: none;
}
#loginDialog {
  animation: none;
}
.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
}
.modal-heading .icon-button {
  margin-right: -10px;
  flex-shrink: 0;
}
.muted {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 20px;
  line-height: 1.8;
}
.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0;
  line-height: 1.8;
}
.full {
  width: 100%;
  margin-top: 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid label,
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.field-label {
  margin: 18px 0 8px;
}
select,
input[type="text"],
input[type="search"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--raised);
  color: var(--text);
  font-size: 16px;
}
.form-grid select {
  margin-top: 7px;
  font-size: 14px;
}
.google-slot {
  min-height: 44px;
  display: grid;
  align-items: center;
  margin: 24px 0 8px;
}
.google-slot > * {
  grid-area: 1 / 1;
}
#googleLoading {
  margin: 0;
  text-align: center;
  font-size: 13px;
}
.google-button {
  min-height: 44px;
  display: flex;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}
.google-slot[data-state="ready"] .google-button {
  visibility: visible;
  pointer-events: auto;
}
.google-button iframe {
  /* Match Google's light frame to preserve its transparent outer canvas. */
  color-scheme: light;
}
.notice {
  font-size: 13px;
  line-height: 1.8;
  color: var(--accent);
}
.notice:empty {
  display: none;
}
.account-name {
  font-size: 18px;
  margin-bottom: 0;
}
#userEmail {
  overflow-wrap: anywhere;
  margin-top: 3px;
}
.account-delete {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 24px;
}
summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  min-height: 32px;
}
#profileTools {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}
.export-help {
  margin: 10px 0;
  line-height: 1.7;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (hover: none) {
  .star {
    opacity: 1;
  }
}
@media (min-width: 600px) {
  .preset {
    flex-basis: 78px;
  }
  .thumb-frame {
    height: 79px;
  }
  .categories {
    gap: 22px;
  }
  .modal {
    border-radius: 12px;
    margin: auto;
  }
}
@media (min-width: 1024px) {
  .editor {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr) 360px;
  }
  .stage {
    padding: 42px 40px 60px;
  }
  .stage-top {
    left: 24px;
    right: 24px;
    top: 22px;
  }
  .stage-bottom {
    left: 24px;
    right: 24px;
    bottom: 20px;
  }
  .glass-button {
    min-height: 40px;
    font-size: 13px;
  }
  #preview {
    box-shadow: 0 12px 40px #0003;
  }
  .photo-caption span {
    font-size: 11px;
  }
  .photo-caption strong {
    font-size: 14px;
  }
  .tools,
  .tools.adjust-mode,
  .tools.mine-mode,
  .tools.search-mode,
  .tools.search-mode.mine-mode {
    height: 100%;
    padding-bottom: 0;
    border-left: 1px solid #ffffff0a;
  }
  .tool-header {
    height: 78px;
    padding: 0 22px;
  }
  h1 {
    font-size: 18px;
  }
  .categories {
    padding: 0 22px;
    gap: 18px;
    height: 43px;
  }
  .category {
    font-size: 12px;
    padding-bottom: 10px;
  }
  .group-label select {
    width: 86px;
  }
  .preset-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 20px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 22px 24px;
  }
  .preset {
    width: 100%;
  }
  .thumb-frame {
    height: 111px;
    border-radius: 5px;
  }
  .preset-name {
    font-size: 12px;
    margin-top: 7px;
  }
  .preset-group {
    font-size: 10px;
    margin-top: 2px;
  }
  .star {
    width: 32px;
    height: 32px;
  }
  .mine-actions {
    padding: 14px 22px;
    border-top: 1px solid var(--line);
  }
  .search-row {
    padding: 0 22px 10px;
  }
  .adjust-panel {
    padding: 0 24px 20px;
  }
  .adjust-controls {
    padding-right: 5px;
  }
  .adjust-control {
    margin-bottom: 17px;
  }
  .save-adjustments {
    min-height: 44px;
    margin-top: 20px;
  }
  .desktop-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 22px;
    color: #858585;
    font-size: 10px;
    border-top: 1px solid #ffffff08;
  }
  .desktop-footer a {
    color: #a6a6a6;
    text-decoration: none;
  }
  .toast {
    bottom: 80px;
  }
}
@media (max-width: 359px) {
  .tool-header {
    padding-left: 15px;
  }
  .tool-actions {
    gap: 0;
  }
  .compact {
    margin-left: 3px;
    padding: 0 12px;
  }
  .categories {
    padding: 0 15px;
    gap: 13px;
  }
  .group-label select {
    width: 77px;
  }
  .photo-caption span {
    display: none;
  }
  .photo-actions .glass-icon {
    display: none;
  }
  .glass-button {
    padding: 0 9px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .button,
  .icon-button {
    transition:
      background-color 0.15s ease,
      color 0.15s ease;
  }
  dialog[open] {
    animation: reveal 0.16s ease-out;
  }
  @keyframes reveal {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
.privacy-page {
  overflow: auto;
}
.privacy-content {
  max-width: 720px;
  padding: 48px 24px 80px;
  margin: auto;
}
.privacy-content h1 {
  margin: 36px 0 8px;
  font-size: 28px;
}
.privacy-content h2 {
  margin-top: 30px;
  font-size: 18px;
}
.privacy-content p {
  color: #c5c5c5;
  line-height: 1.9;
}
.glass-button,
.glass-icon,
.compact {
  position: relative;
}
.glass-button::after,
.glass-icon::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}
.compact::after {
  content: "";
  position: absolute;
  inset: -5px 0;
}
.star::after {
  content: "";
  position: absolute;
  inset: -6px;
}
@media (max-width: 1023px) {
  /* Keep compact heights; reduce mobile horizontal insets to two thirds. */
  .glass-button {
    min-height: 32px;
    padding: 6px calc(34px / 3);
  }
  .glass-icon {
    width: calc(134px / 3);
    height: 32px;
    min-height: 32px;
    padding: 0;
  }
  .strength-button {
    padding-inline: calc(28px / 3);
  }
  #detailsBtn {
    width: 43px;
  }
  .button {
    min-height: 32px;
    padding: 5px 16px;
  }
  .compact {
    min-height: 32px;
    padding: 6px 14px;
  }
  .save-adjustments {
    min-height: 32px;
  }
  .icon-button {
    width: calc(130px / 3);
    height: 32px;
    padding: 6px 8px;
  }
  .text-button {
    min-height: 28px;
    padding: 4px 4px;
  }
  .category {
    padding: 0 4px 3px;
  }
  .star {
    width: 34px;
    height: 24px;
  }
  .button,
  .icon-button,
  .text-button,
  .category {
    position: relative;
  }
  .button::after,
  .glass-button::after,
  .glass-icon::after,
  .icon-button::after,
  .text-button::after,
  .category::after {
    content: "";
    position: absolute;
    inset: -6px 0;
    min-width: 44px;
  }
  .text-button::after {
    inset-block: -8px;
  }
  .star::after {
    inset: -10px -5px;
  }
  .stage-bottom {
    gap: 6px;
  }
  .photo-caption strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.35;
  }
}
@media (max-width: 359px) {
  .glass-button {
    padding-inline: 10px;
  }
  .strength-button {
    padding-inline: calc(28px / 3);
  }
  .compact {
    padding-inline: 12px;
  }
}
