@media (max-width: 767px) {
  :root {
    --dock-height: 92px;
    --chat-input-height: 88px;
    --chat-input-gap: 8px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: var(--safe-bottom);
  }

  .screen {
    padding: 24px 20px 32px;
    gap: 24px;
    max-width: 100%;
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  .profile-page .screen {
    padding-top: 0;
  }

  .stage {
    border-radius: 28px;
    min-height: 55vh;
  }

  .home-code {
    padding: 18px;
  }

  .home-code__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tasks-view {
    padding: 20px;
    gap: 16px;
  }

  .page-network-status {
    margin-top: -2px;
    padding: 7px 10px;
    font-size: 11px;
    line-height: 1.35;
  }

  .home-code {
    padding: 20px;
  }

  .home-code__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .home-code__grid .countdown-value {
    font-size: 24px;
  }

  .finish-code__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .finish-code__grid .countdown-value {
    font-size: 24px;
  }

  .finish-code__button {
    width: 100%;
    font-size: 13px;
    padding: 11px 12px;
  }

  .finish-code__success-title {
    font-size: 21px;
  }

  .finish-code__success-text {
    font-size: 13px;
  }

  .finish-credits__line {
    font-size: 20px;
  }

  .finish-credits__line--heading {
    font-size: 30px;
  }

  .chat-view {
    padding: 20px;
    padding-bottom: 24px;
    gap: 16px;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .chat-mention-notice {
    padding: 7px 10px;
    font-size: 11px;
  }

  .chat-message__mention {
    padding: 0 3px;
    border-radius: 6px;
  }

  html.chat-page-mode .screen {
    height: 100dvh;
    padding-bottom: calc(var(--dock-height) + 8px + var(--safe-bottom));
  }

  html.chat-page-mode .stage {
    height: 100%;
    min-height: 0;
  }

  html.chat-page-mode .chat-view {
    height: 100%;
    min-height: 0;
    padding-bottom: calc(var(--chat-input-height) + var(--chat-input-gap) + 4px + var(--safe-bottom));
  }

  .chat-panel {
    padding: 12px;
    border-radius: 22px;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    margin-bottom: calc(var(--chat-input-height) + var(--chat-input-gap));
    min-height: 0;
  }

  html.chat-page-mode .chat-panel {
    margin-bottom: 0;
    max-height: 100%;
  }

  .tasks-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tasks-title h1 {
    font-size: 22px;
  }

  .tasks-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .task-card {
    padding: 14px;
    border-radius: 12px;
    gap: 8px;
  }

  .task-head {
    gap: 8px;
    align-items: center;
  }

  .task-title {
    font-size: 15px;
    line-height: 1.3;
  }

  .task-meta {
    font-size: 11px;
    line-height: 1.4;
  }

  .task-badge {
    font-size: 10px;
    padding: 4px 8px;
    max-width: 42%;
  }

  .task-body {
    font-size: 13px;
    line-height: 1.45;
  }

  .task-code {
    gap: 8px;
  }

  .task-input,
  .task-activate {
    min-height: 40px;
    font-size: 13px;
  }

  .task-activate {
    width: 100%;
    padding: 10px 12px;
  }

  .tasks-controls {
    gap: 10px;
  }

  .profile-network-status {
    margin-top: 0;
    padding: 7px 10px;
    font-size: 11px;
  }

  .tasks-hints {
    padding: 9px 10px;
  }

  .site-announcement {
    top: calc(8px + var(--safe-top));
    width: calc(100% - 16px);
    padding: 9px 10px;
  }

  .tasks-search {
    font-size: 13px;
    padding: 10px 11px;
  }

  .tasks-filters {
    gap: 6px;
  }

  .tasks-filter {
    font-size: 11px;
    padding: 7px 10px;
  }

  .countdown-card {
    padding: 22px 16px 18px;
  }

  .countdown-title {
    font-size: 24px;
  }

  .countdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .countdown-value {
    font-size: 30px;
  }

  .ambient-glow {
    inset: -20% 15% 35% 15%;
  }

  .bottom-dock {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: calc(12px + var(--safe-bottom)) !important;
    width: calc(100% - 16px);
    padding: 10px 14px 12px;
    border-radius: 18px;
    max-width: none;
    margin: 0 !important;
    z-index: 999;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    transform: translateX(-50%) !important;
  }

  .dock-btn {
    flex-direction: column;
    flex: 1;
    font-size: 9px;
    gap: 6px;
    padding: 10px 9px;
    min-width: 0;
    letter-spacing: 0.02em;
  }

  .dock-btn--play {
    padding: 10px 9px;
  }

  .icon {
    width: 26px;
    height: 26px;
  }

  .label {
    white-space: nowrap;
  }

  .chat-form {
    padding: 8px;
    border-radius: 18px;
    min-height: 56px;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--dock-height) + 6px + var(--safe-bottom));
    width: auto;
    transform: none;
    z-index: 1000;
  }

  .chat-list {
    padding-bottom: 0;
    min-height: 0;
    overflow: auto;
  }

  .chat-mention-suggest {
    left: 6px;
    right: 6px;
    border-radius: 10px;
  }

  .chat-mention-suggest__list {
    padding: 5px;
  }

  .chat-mention-suggest__item {
    padding: 7px 8px;
  }

  .chat-mention-suggest__handle,
  .chat-mention-suggest__label {
    font-size: 11px;
  }

  .chat-message__photo-wrap {
    max-width: min(100%, 240px);
  }


  .profile-card {
    width: 100%;
    padding: 18px 16px 24px;
    max-width: 100%;
  }

  .avatar-wrap {
    width: 96px;
    height: 96px;
  }

  .avatar {
    font-size: 44px;
  }

  .profile-name {
    font-size: 20px;
  }

  .profile-actions {
    margin-top: 16px;
  }

  .profile-quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-quick-actions.profile-quick-actions--user {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 320px);
    margin: 0 auto;
  }

  .profile-action-btn {
    justify-content: center;
    padding: 10px 8px;
    font-size: 10px;
  }

  .auth-btn {
    padding: 8px 12px;
  }

  .admin-panel {
    padding: 14px;
    max-width: 100%;
  }

  .admin-drawer {
    padding: 10px;
  }

  .admin-panel--drawer {
    width: min(100%, 100vw - 20px);
    max-height: calc(90vh - var(--safe-bottom));
    padding-top: 42px;
  }

  .admin-drawer__close {
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
  }

  .admin-head h3 {
    font-size: 16px;
  }

  .admin-head p {
    font-size: 12px;
  }

  .admin-section h4 {
    font-size: 13px;
  }

  .admin-tabs {
    gap: 6px;
  }

  .admin-tab {
    font-size: 10px;
    padding: 6px 10px;
  }

  .admin-user__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-users__controls {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-users-layout {
    grid-template-columns: 1fr;
  }

  .admin-users-list {
    max-height: none;
  }

  .admin-select,
  .admin-input {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .profile-stats__grid {
    grid-template-columns: 1fr;
  }

  .profile-stat__value {
    font-size: 16px;
  }

  .admin-stat__value {
    font-size: 16px;
  }

  .admin-user {
    padding: 12px;
  }

  .admin-actions {
    gap: 8px;
  }

  .admin-task-controls {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 18px 16px 24px;
  }

  .modal-hero__shape {
    width: 130px;
    height: 100px;
  }

  @supports (-webkit-touch-callout: none) {
    html,
    body {
      min-height: -webkit-fill-available;
    }

    .screen {
      min-height: -webkit-fill-available;
    }

    html.chat-page-mode .screen {
      height: -webkit-fill-available;
      min-height: 100dvh;
      padding-bottom: calc(var(--dock-height) + 10px + var(--safe-bottom));
    }

    html.chat-page-mode .chat-view {
      padding-bottom: calc(var(--chat-input-height) + var(--chat-input-gap) + 8px + var(--safe-bottom));
    }

    .bottom-dock {
      padding-bottom: calc(12px + max(var(--safe-bottom), 2px));
    }

    .chat-form {
      bottom: calc(var(--dock-height) + 8px + var(--safe-bottom));
    }
  }

}
