.funify-notes-page .notes-mobile-editor-tools,
.funify-notes-page .notes-mobile-history {
  display: none;
}

@media screen and (max-width: 767px) {
  .funify-notes-page[data-notes-editing='true'] .notes-compact-toolbar {
    position: fixed;
    inset: auto 0 var(--notes-keyboard-inset, 0px);
    z-index: 90;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: none;
    height: calc(66px + env(safe-area-inset-bottom));
    margin: 0;
    padding: 0 8px env(safe-area-inset-bottom);
    overflow: visible;
    border-width: 1px 0 0;
    border-radius: 0;
    background: var(--color-surface);
  }

  .funify-notes-page .notes-compact-toolbar > .notes-toolbar-group {
    display: none;
  }

  .funify-notes-page .notes-compact-toolbar > .notes-mobile-editor-tools {
    display: block;
    width: 100%;
    min-width: 0;
    height: 65px;
  }

  .funify-notes-page .notes-mobile-navigation {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    height: 65px;
    padding-block: 6px;
  }

  .funify-notes-page .notes-compact-toolbar .notes-mobile-main-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 1px;
    border: 0;
    border-radius: 9px;
    background: var(--gh-canvas-subtle);
    color: var(--color-text);
  }

  .funify-notes-page .notes-mobile-editor-tools .notes-toolbar-svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }

  .funify-notes-page .notes-mobile-icon-text {
    fill: currentColor;
    stroke: none;
    font-family: var(--font-family-title);
    font-size: 15px;
    font-weight: 600;
  }

  .funify-notes-page .notes-mobile-tool-caption {
    color: var(--color-muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .funify-notes-page .notes-mobile-main-tool:is(
    [aria-pressed='true'],
    [aria-expanded='true']
  ),
  .funify-notes-page .notes-mobile-editor-tools .notes-mobile-tile[aria-pressed='true'] {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    color: var(--color-primary);
  }

  .funify-notes-page .notes-mobile-main-tool:is(
    [aria-pressed='true'],
    [aria-expanded='true']
  ) .notes-mobile-tool-caption {
    color: inherit;
  }

  .funify-notes-page .notes-mobile-popover {
    position: absolute;
    inset: auto 8px calc(100% + 8px);
    z-index: 170;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--color-border);
    border-radius: 15px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--gh-shadow);
    touch-action: pan-y;
  }

  .funify-notes-page .notes-mobile-popover-header {
    position: sticky;
    top: -12px;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  .funify-notes-page .notes-mobile-popover-header strong {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
  }

  .funify-notes-page .notes-compact-toolbar .notes-mobile-popover-action {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: var(--color-muted);
  }

  .funify-notes-page .notes-mobile-popover-action .notes-mobile-tool-caption {
    display: none;
  }

  .funify-notes-page .notes-mobile-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .funify-notes-page .notes-mobile-view:is(
    [data-mobile-view='list'],
    [data-mobile-view='numbers'],
    [data-mobile-view='paragraph']
  ) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .funify-notes-page .notes-compact-toolbar .notes-mobile-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 8px 3px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--gh-canvas-subtle);
    color: var(--color-text);
  }

  .funify-notes-page .notes-mobile-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .funify-notes-page .notes-compact-toolbar .notes-mobile-category {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 12px 9px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--gh-canvas-subtle);
    color: var(--color-text);
  }

  .funify-notes-page .notes-mobile-category > .notes-toolbar-svg:last-child {
    flex-basis: 14px;
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: var(--color-muted);
  }

  .funify-notes-page .notes-mobile-category .notes-mobile-tool-caption {
    color: var(--color-text);
    font-size: 12px;
    text-align: left;
  }

  .funify-notes-page .notes-mobile-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .funify-notes-page .notes-mobile-fields > label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--color-text);
    font-size: 13px;
  }

  .funify-notes-page .notes-mobile-fields :is(
    .notes-inline-font-family,
    .notes-inline-font-size
  ) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 16px;
  }

  .funify-notes-page .notes-mobile-fields .notes-inline-color-control {
    width: 52px;
    height: 48px;
    background: var(--gh-canvas-subtle);
  }

  .funify-notes-page .notes-mobile-fields .notes-inline-color {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
  }

  .funify-notes-page .notes-mobile-color-tile::after {
    position: absolute;
    top: 26px;
    right: calc(50% - 14px);
    width: 10px;
    height: 4px;
    border-radius: 1px;
    background: var(--notes-current-color);
    content: '';
  }

  .funify-notes-page .notes-compact-toolbar .notes-mobile-apply {
    align-self: flex-end;
    min-width: 88px;
    min-height: 44px;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--color-primary);
    color: var(--color-surface);
  }

  .funify-notes-page .notes-mobile-apply .notes-mobile-tool-caption {
    color: inherit;
  }

  .funify-notes-page .notes-mobile-popover .notes-tools-panel,
  .funify-notes-page .notes-mobile-popover #dividerPanel {
    position: static;
    inset: auto;
    z-index: auto;
    width: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .funify-notes-page .notes-mobile-popover .notes-list-option,
  .funify-notes-page .notes-mobile-popover #dividerPanel button {
    width: 100%;
    min-height: 44px;
    height: auto;
    padding: 8px;
  }

  .funify-notes-page .notes-mobile-popover #htmlModeBtn,
  .funify-notes-page .notes-mobile-popover .notes-mobile-html-return {
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: var(--gh-canvas-subtle);
    font-size: 13px;
  }

  .funify-notes-page [data-mobile-view='advanced'] > label {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 6px 8px;
  }

  .funify-notes-page [data-mobile-view='advanced'] input {
    order: 1;
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
  }

  .funify-notes-page .notes-mobile-editor-tools [hidden] {
    display: none;
  }

  .funify-notes-page .notes-compact-toolbar.is-html-mode .notes-source-back {
    display: none;
  }

  .funify-notes-page .notes-compact-toolbar.is-html-mode {
    opacity: 1;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-panel-heading {
    position: relative;
    min-height: 44px;
    padding-right: 96px;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-mobile-history {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    width: 92px;
  }

  .funify-notes-page .notes-mobile-history > .notes-toolbar-group {
    display: flex;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .funify-notes-page .notes-mobile-history .notes-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .funify-notes-page .notes-mobile-history .notes-toolbar-svg {
    width: 20px;
    height: 20px;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-document {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .funify-notes-page .notes-editor {
    scroll-padding-bottom: 80px;
  }
}

@media print {
  .funify-notes-page .notes-mobile-history {
    display: none;
  }
}
