:root {
  --font-ui: "Avenir Next", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Roboto Mono", "Menlo", monospace;
  --text-main: rgba(255, 255, 255, 0.96);
  --text-dim: rgba(255, 255, 255, 0.48);
  --panel-fill: rgba(255, 255, 255, 0.06);
  --panel-stroke: rgba(255, 255, 255, 0.12);
  --button-fill: rgba(255, 255, 255, 0.12);
  --button-muted-fill: rgba(255, 255, 255, 0.08);
  --button-stroke: rgba(255, 255, 255, 0.14);
  --button-muted-stroke: rgba(255, 255, 255, 0.1);
  --active-color: rgb(250, 97, 46);
  --inactive-color: rgba(235, 77, 41, 0.12);
  --accent-color: rgb(245, 87, 41);
  --bg-top: rgb(20, 13, 10);
  --bg-bottom: rgb(8, 5, 4);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

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

body {
  /* iOS Safari: 100vh と実表示高さのズレを抑える（アドレスバー展開／収納） */
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 36%),
    linear-gradient(140deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 900px) {
  body {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    padding: 24px;
    box-sizing: border-box;
    background:
      radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.06), transparent 22%),
      radial-gradient(circle at 82% 80%, rgba(255, 255, 255, 0.04), transparent 24%),
      linear-gradient(140deg, rgb(19, 17, 20), rgb(7, 8, 10));
  }
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  container-type: inline-size;
  container-name: shell;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.app-body {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 900px) {
  .app-shell {
    flex: 1 1 auto;
    width: min(100%, min(1440px, calc(100vw - 48px)));
    min-height: calc(100dvh - 48px);
    min-height: calc(100svh - 48px);
    max-height: none;
    border-radius: 32px;
    box-shadow:
      0 28px 60px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }
}

.app-shell[data-shell-mode="portrait"] {
  width: min(430px, calc(100vw - 48px));
  min-height: min(852px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
}

@media (min-width: 1180px) and (min-height: 700px) {
  .app-shell {
    width: min(100%, min(1680px, calc(100vw - 72px)));
    min-height: calc(100dvh - 48px);
    min-height: calc(100svh - 48px);
    max-height: none;
    border-radius: 36px;
  }

  .brand-link {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    opacity: 1;
  }

  .start-chip-top {
    min-width: 196px;
    width: auto;
    max-width: 100%;
  }

  .mode-button-top {
    min-width: 68px;
  }
}

.app-shell[data-shell-mode="landscape"] {
  width: min(100%, min(1680px, calc(100vw - 72px)));
  min-height: max(480px, calc(100dvh - 72px));
  min-height: max(480px, calc(100svh - 72px));
  max-height: none;
  border-radius: 42px;
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  gap: 10px;
}

.app-shell[data-shell-mode="landscape"] .app-body {
  gap: 10px;
}

.app-shell[data-shell-mode="landscape"] .topbar {
  gap: 10px 18px;
}

.app-shell[data-shell-mode="landscape"] .start-chip-top {
  min-width: 196px;
  width: auto;
  max-width: 100%;
  justify-content: space-between;
}

.app-shell[data-shell-mode="landscape"] .mode-button-top {
  min-width: 68px;
  justify-content: center;
}

.app-shell[data-shell-mode="landscape"] .timer-screen {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 10px;
}

.app-shell[data-shell-mode="landscape"] .clock-lane {
  padding: 10px 14px;
  border-radius: 24px;
}

.app-shell[data-shell-mode="landscape"] .control-row {
  justify-content: flex-start;
}

.app-shell[data-shell-mode="landscape"] .toggle-group {
  justify-content: flex-start;
  gap: 18px;
}

.app-shell[data-shell-mode="landscape"] .settings-panel {
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: min(344px, calc(100% - 8px));
  border-radius: 24px;
}

.backdrop-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--accent-color) 22%, transparent), transparent 28%),
    radial-gradient(circle at 82% 78%, color-mix(in srgb, var(--active-color) 16%, transparent), transparent 24%);
  filter: blur(12px);
  pointer-events: none;
}

.topbar,
.app-body,
.timer-screen {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px 18px;
  min-width: 0;
  position: relative;
}

.footer-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}

.start-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--panel-stroke);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(16px);
  gap: 10px;
  color: inherit;
}

.mode-button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 0.28em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.mode-button.is-active {
  color: var(--text-main);
}

.mode-button[aria-expanded="true"] {
  color: var(--text-main);
}

.start-chip-top {
  width: fit-content;
  max-width: 100%;
  flex: 0 0 auto;
}

.mode-button-top {
  flex: 0 0 auto;
}

.start-chip-label,
.start-chip-value {
  font-family: var(--font-mono);
}

.start-chip-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.start-chip-value {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.status-strip {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-stroke);
}

.brand-link {
  position: static;
  color: rgba(255, 255, 255, 0.84);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.text-toggle,
.setting-title,
.setting-value,
.selector-button,
.check-button,
.overlay-clock,
.overlay-display-value,
.overlay-display-ghost,
.keypad-button {
  font-family: var(--font-mono);
}

.setting-title {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.timer-screen {
  min-width: 0;
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
}

.clock-lane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  padding: 12px 16px;
  border: 1px solid var(--panel-stroke);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(5, 5, 6, 0.22);
  backdrop-filter: blur(18px);
}

.clock-lane-top {
  min-height: 0;
}

.clock-lane-bottom {
  min-height: 0;
}

.clock-lane-interactive {
  cursor: pointer;
}

.clock-lane-interactive:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--active-color) 68%, white 12%);
  outline-offset: 3px;
}

.clock-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.clock-frame-small {
  width: 100%;
  flex: 1;
}

.clock-frame-large {
  flex: 1;
  min-height: 0;
  padding-block: 0;
}

.timecode-display {
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--display-gap, max(8px, calc(var(--digit-width, 72px) * 0.24)));
  /* Skewed segments paint past the padding box; shell uses overflow:hidden without this gutter */
  padding-inline: clamp(10px, calc(var(--digit-height, 120px) * 0.12), 48px);
  transform: scaleY(0.9);
  transform-origin: center;
}

.timecode-display-compact {
  max-width: none;
}

.digit-pair {
  display: flex;
  gap: var(--pair-gap, max(6px, calc(var(--digit-width, 72px) * 0.12)));
}

.digit-slot {
  width: var(--digit-width, 72px);
  height: var(--digit-height, 140px);
  position: relative;
  transform: skewX(-5deg);
}

.digit-slot.frame-digit .segment.is-on {
  opacity: 0.92;
}

.segment {
  position: absolute;
  border-radius: 999px;
  background: var(--inactive-color);
  box-shadow: none;
  opacity: 1;
}

.segment.is-on {
  background: var(--active-color);
  box-shadow:
    0 0 10px color-mix(in srgb, var(--active-color) 55%, transparent),
    0 0 26px color-mix(in srgb, var(--active-color) 24%, transparent);
}

.segment-horizontal {
  width: calc(var(--digit-width) - (var(--thickness) * 2.3));
  height: var(--thickness);
  left: calc(var(--thickness) * 1.15);
  clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
}

.segment-vertical {
  width: var(--thickness);
  height: calc((var(--digit-height) - (var(--thickness) * 3)) / 2 - (var(--joint-gap) * 2));
  clip-path: polygon(0 12%, 50% 0, 100% 12%, 100% 88%, 50% 100%, 0 88%);
}

.segment-top {
  top: 0;
}

.segment-middle {
  top: calc(50% - (var(--thickness) / 2));
}

.segment-bottom {
  bottom: 0;
}

.segment-upper-left,
.segment-lower-left {
  left: 0;
}

.segment-upper-right,
.segment-lower-right {
  right: 0;
}

.segment-upper-left,
.segment-upper-right {
  top: calc(var(--thickness) + var(--joint-gap));
}

.segment-lower-left,
.segment-lower-right {
  bottom: calc(var(--thickness) + var(--joint-gap));
}

.colon-pair {
  width: var(--colon-width, 22px);
  height: var(--digit-height, 140px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: calc(var(--digit-height, 140px) * 0.16);
  transform: skewX(-5deg) scaleY(1.02);
}

.colon-dot {
  width: calc(var(--colon-width, 22px) * 0.82);
  height: calc(var(--colon-width, 22px) * 0.82);
  border-radius: 5px;
  background: var(--active-color);
  box-shadow: 0 0 16px color-mix(in srgb, var(--active-color) 35%, transparent);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  min-width: 0;
  flex-wrap: wrap;
}

.toggle-group {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.text-toggle {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  min-height: 44px;
  padding: 0;
}

.text-toggle.is-active {
  color: var(--text-main);
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.settings-panel {
  position: absolute;
  z-index: 5;
  top: calc(6px + env(safe-area-inset-top, 0px));
  right: calc(6px + env(safe-area-inset-right, 0px));
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  width: min(320px, calc(100% - 12px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--panel-stroke);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(5, 5, 6, 0.24);
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.app-shell.settings-open .settings-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.app-shell.settings-open .settings-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.settings-block + .settings-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-block-color {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-help-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  line-height: 1.55;
}

.settings-help-steps {
  display: grid;
  gap: 10px;
}

.setting-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.setting-value {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.segmented-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-options-fps .selector-button {
  min-width: 0;
  flex: 1 1 56px;
}

.selector-button,
.palette-button,
.check-button,
.keypad-button {
  border: 1px solid var(--button-stroke);
  border-radius: 10px;
  background: var(--button-fill);
  color: var(--text-main);
}

.selector-button {
  min-width: 58px;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.check-button {
  min-width: 58px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.76);
}

.selector-button.is-active {
  border-color: color-mix(in srgb, var(--active-color) 42%, white 22%);
  box-shadow: inset 0 -2px 0 0 var(--active-color);
}

.check-button.is-active {
  border-color: color-mix(in srgb, var(--active-color) 42%, white 22%);
  background: color-mix(in srgb, var(--active-color) 18%, rgba(255, 255, 255, 0.08));
  color: var(--text-main);
}

.size-slider {
  width: 100%;
  accent-color: rgba(255, 255, 255, 0.68);
}

.palette-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.palette-button {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  position: relative;
}

.palette-button[data-palette="vermilion"] { background: rgb(250, 97, 46); }
.palette-button[data-palette="amber"] { background: rgb(255, 158, 51); }
.palette-button[data-palette="cyan"] { background: rgb(64, 217, 235); }
.palette-button[data-palette="neon"] { background: rgb(115, 255, 133); }
.palette-button[data-palette="ice"] { background: rgb(219, 235, 255); }

.palette-button.is-active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.78);
}

.overlay[hidden] {
  display: none;
}

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

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}

.keypad-card {
  position: relative;
  z-index: 1;
  width: min(298px, calc(100vw - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  margin: max(40px, 9vh) auto 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--panel-stroke);
  background: rgb(36, 36, 37);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4);
}

@supports (height: 100dvh) {
  .keypad-card {
    margin-top: max(40px, 9dvh);
  }
}

.overlay-clock {
  display: block;
  text-align: center;
  margin-bottom: 16px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.overlay-display {
  position: relative;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.overlay-display-ghost,
.overlay-display-value {
  font-size: 1.48rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.overlay-display-ghost {
  color: transparent;
}

.overlay-display-value {
  position: absolute;
  inset: 10px 12px;
  color: var(--text-main);
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.overlay-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.keypad-button {
  min-height: 44px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.keypad-button-muted {
  background: var(--button-muted-fill);
  border-color: var(--button-muted-stroke);
}

/* Base on .app-shell width (not viewport) so preview frames match real phones without duplicating rules. */
@container shell (max-width: 720px) {
  /* Top layout matches global grid: START top-left, SET top-right, brand bottom-right. */

  .brand-link {
    font-size: 0.74rem;
    letter-spacing: 0.2em;
    opacity: 0.82;
  }

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

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

  .clock-lane {
    padding: 10px 12px;
  }

  .clock-frame-small {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
    gap: 10px;
  }

  .app-body {
    gap: 10px;
  }
}

@media (max-width: 460px) {
  .app-shell {
    gap: 8px;
  }

  .app-body {
    gap: 8px;
  }

  .timer-screen {
    grid-template-rows: minmax(0, 0.72fr) minmax(0, 1.28fr);
    gap: 8px;
  }

  .clock-lane {
    border-radius: 24px;
  }

  .settings-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: min(70dvh, 560px);
    border-radius: 24px;
    transform: translateY(calc(100% + 20px));
  }

  .app-shell.settings-open .settings-panel {
    transform: translateY(0);
  }

  .keypad-card {
    width: min(320px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    margin-top: max(24px, 5dvh);
    padding: 14px;
  }

  .overlay-display-ghost,
  .overlay-display-value {
    font-size: 1.3rem;
  }
}

@media (orientation: landscape) and (max-height: 520px), (min-width: 1180px) and (min-height: 700px) {
  .clock-lane-top,
  .clock-lane-bottom {
    min-height: 0;
  }
}

body[data-device-profile="phone"] {
  display: block;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 36%),
    linear-gradient(140deg, var(--bg-top), var(--bg-bottom));
}

body[data-device-profile="tablet"] {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.06), transparent 22%),
    radial-gradient(circle at 82% 80%, rgba(255, 255, 255, 0.04), transparent 24%),
    linear-gradient(145deg, rgb(14, 15, 18), rgb(6, 7, 10));
}

body[data-device-profile="browser"] {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.06), transparent 22%),
    radial-gradient(circle at 82% 80%, rgba(255, 255, 255, 0.04), transparent 24%),
    linear-gradient(140deg, rgb(19, 17, 20), rgb(7, 8, 10));
}

.app-shell[data-device-profile="phone"] {
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  max-height: none;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.app-shell[data-device-profile="phone"] .app-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-shell[data-device-profile="phone"] .timer-screen {
  width: 100%;
  align-content: center;
}

.app-shell[data-device-profile="phone"] .clock-lane {
  width: 100%;
}

.app-shell[data-device-profile="phone"] .clock-frame-large {
  width: 100%;
  justify-content: center;
}

.app-shell[data-device-profile="phone"] .clock-frame-large .timecode-display {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.app-shell[data-device-profile="phone"][data-shell-mode="portrait"] {
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  max-height: none;
}

.app-shell[data-device-profile="phone"][data-shell-mode="landscape"] {
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  max-height: none;
  border-radius: 0;
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    calc(12px + env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px))
    calc(12px + env(safe-area-inset-left, 0px));
}

.app-shell[data-device-profile="tablet"] {
  flex: 1 1 auto;
  width: min(100%, 900px);
  min-height: calc(100dvh - 32px);
  min-height: calc(100svh - 32px);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-shell[data-device-profile="tablet"][data-shell-mode="portrait"] {
  width: min(820px, calc(100vw - 32px));
  min-height: min(1180px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
}

.app-shell[data-device-profile="tablet"][data-shell-mode="landscape"] {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100dvh - 32px);
  min-height: calc(100svh - 32px);
  max-height: none;
  border-radius: 34px;
}

.app-shell[data-device-profile="browser"] {
  flex: 1 1 auto;
  width: min(100%, min(1440px, calc(100vw - 48px)));
  min-height: calc(100dvh - 48px);
  min-height: calc(100svh - 48px);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-shell[data-device-profile="browser"][data-shell-mode="portrait"] {
  width: min(100%, 1120px);
  min-height: calc(100dvh - 48px);
  min-height: calc(100svh - 48px);
  max-height: none;
}

.app-shell[data-device-profile="browser"][data-shell-mode="landscape"] {
  width: min(100%, min(1680px, calc(100vw - 72px)));
  min-height: max(560px, calc(100dvh - 72px));
  min-height: max(560px, calc(100svh - 72px));
  max-height: none;
  border-radius: 42px;
}

.app-shell[data-device-profile="browser"] .control-row,
.app-shell[data-device-profile="tablet"][data-shell-mode="landscape"] .control-row {
  justify-content: flex-start;
}

.app-shell[data-device-profile="browser"] .toggle-group,
.app-shell[data-device-profile="tablet"][data-shell-mode="landscape"] .toggle-group {
  justify-content: flex-start;
}

.app-shell[data-device-profile="phone"] .brand-link {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  opacity: 0.76;
}

.app-shell[data-device-profile="tablet"] .brand-link,
.app-shell[data-device-profile="browser"] .brand-link {
  opacity: 1;
}

.app-shell[data-device-profile="browser"] .settings-panel {
  width: min(360px, calc(100% - 24px));
}
