/* Contour moderne : la page occupe tout l'ecran et les commandes flottent sans barre opaque. */
.app-shell {
  position: relative;
  display: block;
  background: var(--paper);
}

.workspace {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
}

.board-wrap {
  --module-panel-offset-x: 120px;
  --module-panel-offset-y: 62px;
  --module-panel-bottom-space: 64px;
  --graph-safe-top: 54px;
  --graph-safe-right: 22px;
  --graph-safe-bottom: 50px;
  --graph-safe-left: 22px;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background-color: var(--paper);
  background-image: url("../img/chameleon_fond.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: none;
}

.module-panel-has-close,
.module-positioned-panel,
.module-tab-close {
  transform: translate(var(--module-panel-offset-x), var(--module-panel-offset-y));
}
.module-positioned-panel {
  bottom: auto !important;
  max-height: calc(100dvh - var(--module-panel-offset-y) - var(--module-panel-bottom-space) - 78px) !important;
}

.topbar,
.pagebar {
  position: fixed;
  z-index: 6;
  left: 0;
  right: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.topbar { top: 0; }
.pagebar { bottom: 0; }
.topbar > *, .pagebar > * { pointer-events: auto; }

.brand > span:last-child,
.connection-pill #connection-label { display: none; }

.connection-pill {
  justify-self: start;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  justify-content: center;
  border: 1px solid rgb(23 34 59 / 18%);
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 4px 16px rgb(23 34 59 / 16%);
  backdrop-filter: blur(14px);
}
.connection-pill.mode-choice-visible,
.connection-pill.local-mode { width: auto; min-width: 42px; padding: 5px 7px; }

.icon-button,
.brand-mark,
.page-scroll-button,
.page-tab,
.add-page-btn,
.page-overview > button {
  border: 1px solid rgb(23 34 59 / 18%);
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 4px 16px rgb(23 34 59 / 16%);
  backdrop-filter: blur(14px);
}

.icon-button,
.page-scroll-button,
.page-tab,
.add-page-btn,
.page-overview > button { color: var(--ink); }
.brand-mark { border-color: var(--ink); background: var(--ink); color: #fff; }

.icon-button:hover,
.page-scroll-button:hover,
.page-tab:hover,
.add-page-btn:hover,
.page-overview > button:hover { background: rgb(255 255 255 / 86%); }
.page-tab.active,
.page-tab.active:hover,
.page-tab.active:focus-visible {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.page-tab.drop-before { box-shadow: -4px 0 0 var(--accent), 0 4px 16px rgb(23 34 59 / 12%); }
.page-tab.drop-after { box-shadow: 4px 0 0 var(--accent), 0 4px 16px rgb(23 34 59 / 12%); }

.toolbar {
  position: fixed;
  z-index: 6;
  top: 72px;
  bottom: 72px;
  left: max(10px, env(safe-area-inset-left));
  width: 72px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
}

.tool-group { gap: 6px; }
.tool-button {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgb(23 34 59 / 18%);
  background: rgb(255 255 255 / 82%);
  color: var(--ink);
  box-shadow: 0 2px 8px rgb(23 34 59 / 10%);
  backdrop-filter: blur(14px);
}
.tool-button > span:last-child { display: none; }
.tool-button:hover { background: rgb(255 255 255 / 86%); }
.tool-button.active { background: rgb(23 34 59 / 86%); }
.tool-settings {
  margin-top: 6px;
  padding: 8px 2px;
  border: 0;
  border-radius: 14px;
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 4px 16px rgb(23 34 59 / 16%);
  backdrop-filter: blur(14px);
}

.zoom-control { bottom: 72px; }
.toast-region { bottom: 76px; }

@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) and (max-width: 1024px) {
  .app-shell { display: block; background: var(--paper); }
  .topbar { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
  .brand-mark { border-color: var(--mobile-accent); background: var(--mobile-accent); }
  .board-wrap {
    --module-panel-offset-x: 0px;
    --module-panel-offset-y: calc(46px + env(safe-area-inset-top));
    --module-panel-bottom-space: calc(52px + env(safe-area-inset-bottom));
    --graph-safe-top: 44px;
    --graph-safe-right: 14px;
    --graph-safe-bottom: 44px;
    --graph-safe-left: 14px;
  }
  .toolbar {
    top: auto;
    left: max(8px, env(safe-area-inset-left));
    right: calc(max(8px, env(safe-area-inset-right)) + 156px);
    bottom: calc(5px + env(safe-area-inset-bottom));
    width: auto;
    height: 42px;
    padding: 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow-x: auto;
  }
  .tool-group { gap: 4px; }
  .tool-button { background: rgb(255 255 255 / 84%); }
  .tool-button.active { background: var(--mobile-accent); }
  .tool-settings {
    margin: 0;
    padding: 4px 7px;
    border: 0;
    border-radius: 14px;
  }
  .pagebar { background: transparent; border: 0; backdrop-filter: none; }
  .zoom-control { bottom: 70px; }
}

@media (orientation: portrait) and (max-width: 1024px) {
  .board-wrap {
    --module-panel-offset-x: 0px;
    --module-panel-offset-y: calc(46px + env(safe-area-inset-top));
    --module-panel-bottom-space: calc(52px + env(safe-area-inset-bottom));
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 1024px) {
  .board-wrap {
    --module-panel-offset-y: calc(40px + env(safe-area-inset-top));
    --module-panel-bottom-space: calc(46px + env(safe-area-inset-bottom));
    --graph-safe-top: 38px;
    --graph-safe-bottom: 38px;
  }
  .toolbar {
    left: max(8px, env(safe-area-inset-left));
    right: calc(max(8px, env(safe-area-inset-right)) + 156px);
    bottom: calc(3px + env(safe-area-inset-bottom));
    width: auto;
    transform: none;
  }
}
