:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --photo-paper: #000000;
  --photo-paper-text: #ffffff;
  --text: #000000;
  --muted: #666666;
  --line: #e8e8e8;
  --control: #f6f6f6;
  --control-hover: #eeeeee;
  --active: #000000;
  --active-text: #ffffff;
  --overlay-control: rgba(0, 0, 0, 0.36);
  --overlay-control-hover: rgba(0, 0, 0, 0.52);
  --overlay-control-active: rgba(255, 255, 255, 0.88);
  --overlay-control-active-text: #000000;
  --frame-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
  --shell-padding-x: clamp(16px, 4vw, 24px);
  --stage-side-padding: clamp(0px, 5vw, 58px);
  --viewer-vertical-padding: clamp(18px, 5vh, 38px);
  --frame-available-width: calc(100vw - (var(--shell-padding-x) * 2) - (var(--stage-side-padding) * 2));
  --frame-available-height: calc(100dvh - 156px - (var(--viewer-vertical-padding) * 2));
  --frame-landscape-height: min(var(--frame-available-height), calc(var(--frame-available-width) * var(--image-inverse-aspect, 0.75)));
  --frame-landscape-width: min(var(--frame-available-width), calc(var(--frame-available-height) * var(--image-ratio-value, 1.333333)));
  --frame-portrait-height: var(--frame-available-height);
  font-family: "Google Sans", "Product Sans", Arial, Helvetica, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #000000;
    --photo-paper: #ffffff;
    --photo-paper-text: #000000;
    --text: #ffffff;
    --muted: #a6a6a6;
    --line: #202020;
    --control: #111111;
    --control-hover: #1c1c1c;
    --active: #ffffff;
    --active-text: #000000;
    --overlay-control: rgba(0, 0, 0, 0.38);
    --overlay-control-hover: rgba(0, 0, 0, 0.56);
    --overlay-control-active: rgba(255, 255, 255, 0.9);
    --overlay-control-active-text: #000000;
    --frame-shadow: none;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --photo-paper: #000000;
  --photo-paper-text: #ffffff;
  --text: #000000;
  --muted: #666666;
  --line: #e8e8e8;
  --control: #f6f6f6;
  --control-hover: #eeeeee;
  --active: #000000;
  --active-text: #ffffff;
  --overlay-control: rgba(0, 0, 0, 0.36);
  --overlay-control-hover: rgba(0, 0, 0, 0.52);
  --overlay-control-active: rgba(255, 255, 255, 0.88);
  --overlay-control-active-text: #000000;
  --frame-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --photo-paper: #ffffff;
  --photo-paper-text: #000000;
  --text: #ffffff;
  --muted: #a6a6a6;
  --line: #202020;
  --control: #111111;
  --control-hover: #1c1c1c;
  --active: #ffffff;
  --active-text: #000000;
  --overlay-control: rgba(0, 0, 0, 0.38);
  --overlay-control-hover: rgba(0, 0, 0, 0.56);
  --overlay-control-active: rgba(255, 255, 255, 0.9);
  --overlay-control-active-text: #000000;
  --frame-shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.top-actions {
  position: absolute;
  top: 18px;
  left: var(--shell-padding-x);
  right: var(--shell-padding-x);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  pointer-events: none;
}

.top-actions .icon-button {
  pointer-events: auto;
}

.app-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px max(16px, var(--shell-padding-x));
  border-bottom: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.app-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.app-notice i {
  flex: 0 0 auto;
  font-size: 13px;
}

.notice-info {
  border-bottom-color: #b7d8ff;
  background: #eef6ff;
  color: #124b7c;
}

.notice-warning {
  border-bottom-color: #f2d183;
  background: #fff8e8;
  color: #684500;
}

.notice-error {
  border-bottom-color: #f0a7a7;
  background: #fff0f0;
  color: #8c1d1d;
}

:root[data-theme="dark"] .notice-info {
  border-bottom-color: #214d78;
  background: #071927;
  color: #9fd0ff;
}

:root[data-theme="dark"] .notice-warning {
  border-bottom-color: #5f4815;
  background: #201704;
  color: #f3cb6d;
}

:root[data-theme="dark"] .notice-error {
  border-bottom-color: #6f2525;
  background: #260909;
  color: #ffb1b1;
}

.viewer-layout {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: var(--viewer-vertical-padding) var(--shell-padding-x) calc(var(--viewer-vertical-padding) - 4px);
  overflow: visible;
}

.welcome-copy {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  transition: filter 220ms ease, opacity 220ms ease;
}

.welcome-panel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(78vh, 760px);
  display: block;
  padding: clamp(40px, 8vh, 78px) clamp(20px, 4vw, 42px) clamp(34px, 6vh, 56px);
  pointer-events: auto;
}

.welcome-title {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  --welcome-title-size: 300px;
  transform: translate(-50%, -50%);
}

.welcome-frame {
  position: absolute;
  top: calc(var(--welcome-title-size) * -0.6);
  left: 50%;
  z-index: 0;
  width: 890px;
  height: 760px;
  overflow: visible;
  transform: translateX(-50%);
  pointer-events: none;
}

.welcome-frame-line {
  fill: none;
  stroke: url("#welcomeFrameGradient");
  stroke-dasharray: 2608;
  stroke-dashoffset: 2608;
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-width: 8;
  animation: draw-welcome-frame 1500ms cubic-bezier(0.76, 0, 0.24, 1) 180ms forwards;
}

.welcome-copy h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  background: linear-gradient(115deg, #ff4d6d 0%, #ffb703 24%, #2ec4b6 48%, #3a86ff 72%, #8338ec 100%);
  background-clip: text;
  color: transparent;
  font-size: var(--welcome-title-size);
  font-weight: 700;
  line-height: 0.65;
  letter-spacing: -0.66rem;
  white-space: nowrap;
  -webkit-background-clip: text;
}

.welcome-copy h1 span {
  display: block;
}

.welcome-actions {
  position: absolute;
  left: 50%;
  top: calc((var(--welcome-title-size) * -0.6) + 760px - 74px);
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 10px;
  opacity: 0;
  transform: translate(-50%, 10px);
  animation: reveal-welcome-actions 420ms ease 1650ms forwards;
}

.has-loaded-images .welcome-copy {
  opacity: 0.5;
  filter: blur(18px);
  pointer-events: none;
}

.has-loaded-images .welcome-copy h1 {
  animation: title-marquee 16s linear infinite alternate;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--stage-side-padding);
}

.photo-frame {
  position: relative;
  width: var(--frame-landscape-width);
  max-width: 100%;
  max-height: var(--frame-available-height);
  aspect-ratio: 4 / 3;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  box-shadow: var(--frame-shadow);
  overflow: hidden;
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.has-loaded-images .photo-frame {
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.5), 0 8px 28px rgba(0, 0, 0, 0.24);
  transform: translateY(-2px);
}

.photo-frame.is-portrait {
  width: auto;
  height: var(--frame-portrait-height);
  max-width: min(76vw, var(--frame-available-width));
  aspect-ratio: var(--image-ratio, 3 / 4);
}

.photo-frame.is-landscape {
  width: auto;
  height: var(--frame-landscape-height);
  max-width: 100%;
  aspect-ratio: var(--image-ratio, 4 / 3);
}

.close-viewer-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  opacity: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  transition: opacity 140ms ease, transform 140ms ease;
}

.photo-frame:hover .close-viewer-button,
.close-viewer-button:focus-visible {
  opacity: 1;
}

.close-viewer-button:hover {
  transform: scale(1.08);
}

.close-viewer-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.placeholder-image,
.image-viewport {
  width: 100%;
  height: 100%;
}

.placeholder-image {
  display: block;
  border-radius: 1rem;
  object-fit: cover;
}

.image-viewport {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #000000;
  border-radius: 1rem;
  touch-action: none;
  cursor: default;
}

.image-viewport.is-pannable {
  cursor: grab;
}

.image-viewport.is-dragging {
  cursor: grabbing;
}

.image-viewport.is-selecting {
  cursor: crosshair;
}

.image-viewport img,
.image-viewport video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 1rem;
}

.image-viewport img {
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--zoom, 1));
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  width: 103%;
}

.image-viewport video {
  background: #000000;
}

.image-viewport.has-video {
  touch-action: auto;
}

.image-viewport.has-video .controls {
  display: none;
}

.image-viewport .is-hidden {
  display: none;
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), transparent 35%);
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.zoom-selection {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.image-viewport:hover .image-overlay {
  opacity: 1;
}

.overlay-text {
  position: absolute;
  top: 20px;
  max-width: calc(50% - 18px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.overlay-right {
  left: 20px;
  text-align: right;
}

.is-hidden {
  display: none;
}

.nav-button {
  display: none;
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transform: translateY(-50%);
}

.nav-button:hover:not(:disabled) {
  background: var(--control);
}

.nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.24;
}

.stage:not(.has-images) .nav-button {
  display: none;
}

.previous {
  left: 0;
}

.next {
  right: 0;
}

.folder-nav {
  position: absolute;
  top: 50%;
  left: clamp(8px, 2vw, 18px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(58vh, 420px);
  padding: 10px 72px 10px 6px;
  overflow: visible;
  transform: translateY(-50%);
}

.folder-button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--photo-paper);
  background-position: center;
  background-size: cover;
  cursor: pointer;
  box-shadow: none;
  transform-origin: center center;
  transition: width 220ms ease, height 220ms ease, border-radius 220ms ease, opacity 140ms ease, transform 220ms ease;
}

.folder-button:hover {
  width: 65px;
  height: 65px;
  border-radius: 3rem;
  transform: translateX(-23.5px);
}

.folder-button.is-active {
  opacity: 0.58;
}

.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px var(--shell-padding-x) calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.image-viewport:hover .controls,
.controls:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.control-group-primary {
  justify-content: flex-start;
}

.control-group-tools {
  justify-content: flex-end;
}

.button,
.icon-button,
.text-link {
  min-height: 44px;
  border-radius: 4px;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  white-space: nowrap;
  max-width: 100%;
}

.button.primary {
  border-color: var(--active);
  background: var(--active);
  color: var(--active-text);
  font-weight: 500;
}

.button.primary.welcome-button {
  min-height: 58px;
  padding: 0 30px;
  border: none;
  border-radius: 1rem;
  background: linear-gradient(115deg, #9900ff 0%, #0058ff 45%, #9900ff 100%);
  background-size: 220% 220%;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 14px 34px rgba(153, 0, 255, 0.28), 0 8px 24px rgba(0, 88, 255, 0.24);
  animation: welcome-button-gradient 3200ms ease-in-out infinite alternate;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.theme-toggle {
  border-radius: 6px;
}

.menu-button {
  border-radius: 6px;
}

.top-actions .icon-button,
.sidebar-header .icon-button {
  border-color: transparent;
  background: transparent;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 180ms ease;
}

.recent-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9;
  width: min(86vw, 340px);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.12);
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.has-open-sidebar .sidebar-scrim {
  opacity: 1;
}

.has-open-sidebar .recent-sidebar {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2,
.recent-section h3 {
  margin: 0;
  font-weight: 700;
}

.sidebar-header h2 {
  background: linear-gradient(115deg, #ff4d6d 0%, #ffb703 24%, #2ec4b6 48%, #3a86ff 72%, #8338ec 100%);
  background-clip: text;
  color: transparent;
  font-size: 20px;
  -webkit-background-clip: text;
}

.sort-section {
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line);
}

.sort-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sort-control label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper select {
  width: 100%;
  appearance: none;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 32px 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select-wrapper select:focus,
.select-wrapper select:hover {
  border-color: var(--text);
  outline: none;
}

.select-wrapper i {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.recent-section {
  min-height: 0;
  padding-top: 22px;
}

.recent-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--muted);
}

.recent-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.clear-recent-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.clear-recent-button:hover {
  background: var(--control-hover);
  color: var(--text);
}

.clear-recent-button i {
  font-size: 12px;
  line-height: 1;
}

.recent-list {
  display: grid;
  gap: 2px;
  max-height: calc(100dvh - 150px);
  margin: 12px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.recent-folder-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: center;
  border-radius: 6px;
}

.recent-folder-item:hover {
  background: var(--control-hover);
}

.recent-folder-button {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-areas: "icon name";
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px 0 0 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.recent-folder-button:hover {
  background: transparent;
}

.recent-folder-button i {
  grid-area: icon;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.recent-folder-name,
.recent-folder-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-folder-name {
  grid-area: name;
  font-size: 13px;
  font-weight: 500;
}

.recent-folder-meta {
  grid-area: meta;
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.refresh-recent-button,
.remove-recent-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}

.recent-folder-item:hover .refresh-recent-button,
.recent-folder-item:hover .remove-recent-button,
.refresh-recent-button:focus-visible,
.remove-recent-button:focus-visible {
  opacity: 1;
}

.refresh-recent-button:hover,
.remove-recent-button:hover {
  color: var(--text);
}

.refresh-recent-button i,
.remove-recent-button i {
  font-size: 12px;
  line-height: 1;
}

.empty-recent {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.theme-icon {
  display: none;
}

:root[data-theme="light"] [data-theme-icon="light"],
:root[data-theme="auto"] [data-theme-icon="auto"],
:root[data-theme="dark"] [data-theme-icon="dark"] {
  display: block;
}

.icon-button.is-active,
.icon-button[aria-pressed="true"] {
  background: var(--active);
  color: var(--active-text);
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--control-hover);
}

.button.primary:hover:not(:disabled),
.icon-button.is-active:hover:not(:disabled),
.icon-button[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--active);
}

.button.primary.welcome-button:hover:not(:disabled) {
  background: linear-gradient(115deg, #9900ff 0%, #0058ff 45%, #9900ff 100%);
  background-size: 220% 220%;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.text-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

.text-link:hover {
  color: var(--muted);
}

input[type="file"] {
  display: none;
}

.zoom-value {
  min-width: 64px;
  padding: 0 12px;
}

.controls .button,
.controls .icon-button {
  border: 0;
  border-radius: 0.7rem;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.controls .button:hover:not(:disabled),
.controls .icon-button:hover:not(:disabled) {
  background: var(--overlay-control-hover);
}

.controls .icon-button.is-active,
.controls .icon-button[aria-pressed="true"] {
  background: var(--overlay-control-active);
  color: var(--overlay-control-active-text);
  text-shadow: none;
}

.controls .icon-button i {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

@keyframes title-marquee {
  from {
    transform: translateX(-18vw);
  }

  to {
    transform: translateX(18vw);
  }
}

@keyframes draw-welcome-frame {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes reveal-welcome-actions {
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes welcome-button-gradient {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 100% 50%;
  }
}

@media (max-width: 760px) {
  :root {
    --shell-padding-x: 14px;
    --stage-side-padding: 0px;
    --viewer-vertical-padding: 16px;
    --frame-available-height: calc(100dvh - 168px - (var(--viewer-vertical-padding) * 2));
  }

  .top-actions {
    top: 12px;
  }

  .welcome-copy {
    padding: 18px;
  }

  .welcome-panel {
    width: 100%;
    min-height: min(68vh, 560px);
    padding: 56px 18px 34px;
  }

  .welcome-frame {
    width: calc(var(--welcome-title-size) * 2.6);
    height: calc(var(--welcome-title-size) * 1.84);
  }

  .welcome-actions {
    top: calc((var(--welcome-title-size) * -0.6) + (var(--welcome-title-size) * 1.84) - 50px);
  }

  .welcome-frame-line {
    stroke-width: 7;
  }

  .welcome-title {
    --welcome-title-size: clamp(36px, 12vw, 88px);
  }

  .welcome-copy h1 {
    line-height: 0.72;
    letter-spacing: -0.12rem;
  }

  .stage {
    width: 100%;
  }

  .folder-nav {
    left: 6px;
    max-height: min(48vh, 320px);
  }

  .photo-frame {
    padding: clamp(10px, 3vw, 16px);
  }

  .photo-frame.is-portrait {
    max-width: var(--frame-available-width);
  }

  .close-viewer-button {
    top: -8px;
    right: -8px;
  }

  .bottom-actions {
    gap: 10px 16px;
  }

  .button.primary {
    width: min(100%, 320px);
  }

  .controls {
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
  }

  .control-group {
    gap: 6px;
  }

  .controls .icon-button,
  .controls .button,
  .icon-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .zoom-value {
    min-width: 56px;
    padding: 0 8px;
    font-size: 13px;
  }

  .overlay-text {
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
  }
}

@media (max-width: 480px) {
  :root {
    --frame-available-height: calc(100dvh - 182px - (var(--viewer-vertical-padding) * 2));
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    justify-content: center;
  }

  .control-group-primary,
  .control-group-tools {
    justify-content: center;
  }

  .text-link {
    min-height: 32px;
  }
}

@media (max-height: 560px) {
  :root {
    --viewer-vertical-padding: 10px;
    --frame-available-height: calc(100dvh - 118px - (var(--viewer-vertical-padding) * 2));
  }

  .top-actions {
    padding-top: 8px;
  }

  .bottom-bar {
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .button,
  .icon-button,
  .text-link {
    min-height: 38px;
  }
}

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

:fullscreen .top-actions,
:fullscreen .bottom-bar,
:fullscreen .welcome-copy,
:fullscreen .nav-button,
:fullscreen .close-viewer-button,
:fullscreen .folder-nav {
  display: none;
}

:fullscreen .viewer-layout,
:fullscreen .stage,
:fullscreen .image-viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  padding: 0;
  border: 0;
  box-shadow: none;
}

:fullscreen .photo-frame {
  width: 100vw;
  height: 101vh;
  height: 101dvh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

:fullscreen .image-overlay {
  display: none;
}

:fullscreen .overlay-text {
  display: none;
}

:fullscreen .controls {
  display: none;
}

:fullscreen .image-viewport img,
:fullscreen .image-viewport video {
  width: 100vw;
  height: 100vh;
  height: 101dvh;
  object-fit: contain;
}

:fullscreen .image-viewport {
  cursor: crosshair;
  height: 101dvh;
  border-radius: 0;
}

:fullscreen .image-viewport.is-fullscreen-zoomed {
  cursor: grab;
}

:fullscreen .image-viewport.is-fullscreen-zoomed.is-dragging {
  cursor: grabbing;
}
