/* App shell: full-viewport layout that never scrolls the page. */

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  outline: none;
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: clamp(6px, 1.2vmin, 12px) clamp(8px, 2vmin, 20px);
  min-height: calc(var(--touch) + 12px);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(1.15rem, 3.4vmin, 2.1rem);
  color: var(--ink);
}

.title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 16px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.title-pic {
  width: clamp(34px, 6vmin, 52px);
  height: clamp(34px, 6vmin, 52px);
  flex: none;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vmin, 12px);
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 0 clamp(8px, 2vmin, 24px) clamp(8px, 1.6vmin, 18px);
  container-type: size;
  container-name: stage;
}

.screen-fill {
  height: 100%;
  min-height: 0;
}

/* Phones: hide the decorative title text to keep tools reachable. */
@media (max-width: 520px) {
  .title-text {
    font-size: 1.05rem;
    padding: 4px 12px;
  }
}

@media (max-width: 520px) {
  .title-pic + .title-text {
    display: none;
  }
}

/* Short landscape phones: compact top bar. */
@media (max-height: 480px) and (orientation: landscape) {
  :root {
    --touch: 46px;
  }

  .topbar {
    padding-block: 4px;
    min-height: 54px;
  }
}

#overlay-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

#overlay-root > * {
  pointer-events: auto;
}

#fx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}
