/* Mobile adaptation layer: keep desktop stable, reshape tablet and phone views. */
@media (max-width: 1024px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  main {
    background:
      radial-gradient(circle at 12% 0%, rgba(231, 240, 235, 0.72), transparent 32%),
      linear-gradient(180deg, #f8f7f1 0%, #f4f2ea 100%);
  }

  .page {
    max-width: none;
  }

  .card,
  .gantt-card,
  .plan-table,
  .essay-paper-card,
  .essay-detail-card {
    box-shadow: 0 16px 36px rgba(55, 68, 62, 0.055);
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  main {
    padding-left: 76px;
  }

  .sidebar {
    width: 76px;
    padding: 18px 10px;
  }

  .sidebar .brand-copy,
  .sidebar-bottom .desk-link div,
  .sidebar-bottom .profile div,
  .sidebar-bottom .profile i {
    display: none !important;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: 12px !important;
    font-size: 0 !important;
  }

  .sidebar .nav-item .nav-icon,
  .sidebar .nav-item span.nav-icon {
    font-size: 20px !important;
  }

  .page,
  #planner,
  #bank {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .planner-toolbar {
    align-items: stretch;
  }

  .planner-toolbar-right {
    width: 100%;
  }

  .planner-main-actions {
    margin-left: auto;
  }

  .essay-paper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  #focus .focus-layout,
  #desk .desk-layout {
    grid-template-columns: 1fr !important;
  }

  #focus .focus-main {
    min-height: 430px;
  }

  #focus .focus-side {
    position: static !important;
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 0 !important;
  }

  #focus .focus-side > .card:first-child {
    display: block !important;
  }

  #focus .focus-side > .card:last-child {
    padding: 16px !important;
    border: 1px solid rgba(230, 230, 221, 0.8) !important;
    background: var(--paper) !important;
    box-shadow: var(--shadow) !important;
  }

  #focus .focus-side h2,
  #focus .focus-side .small-copy {
    display: block !important;
  }

  #focus .sound-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #focus .sound-grid button:not([data-sound="rain"]) {
    display: inline-flex !important;
  }

  #focus .focus-record-table-wrap,
  #focus .focus-plan-card {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #library .article-grid,
  #analytics .analytics-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #analytics .analytics-chart-grid {
    grid-template-columns: 1fr !important;
  }

  #analytics .sankey-chart {
    grid-template-columns: 1fr !important;
    overflow: visible !important;
  }

  #analytics .sankey-overlay,
  #analytics .sankey-link-space {
    display: none !important;
  }
}

@media (max-width: 767px) {
  :root {
    --mobile-x: 12px;
    --mobile-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  body {
    min-width: 0;
  }

  main {
    padding-left: 0 !important;
    padding-bottom: var(--mobile-bottom) !important;
  }

  header {
    height: 54px !important;
    padding: 0 var(--mobile-x) !important;
    border-bottom: 1px solid rgba(224, 226, 217, 0.78);
    background: rgba(255, 254, 250, 0.82);
    backdrop-filter: blur(18px);
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
    gap: 8px !important;
  }

  .countdown {
    min-height: 34px;
    padding: 6px 10px;
    border-color: rgba(218, 226, 220, 0.86);
    background: rgba(255, 254, 250, 0.78);
  }

  .countdown span {
    font-size: 11px !important;
  }

  .countdown b {
    font-size: 15px;
  }

  .countdown-panel {
    left: var(--mobile-x) !important;
    right: var(--mobile-x) !important;
    top: 62px !important;
    width: auto !important;
    max-height: calc(100dvh - 82px);
    overflow: auto;
    border-radius: 20px;
  }

  .sidebar {
    position: fixed !important;
    z-index: 70 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    height: var(--mobile-bottom) !important;
    padding: 7px max(9px, env(safe-area-inset-left, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(9px, env(safe-area-inset-right, 0px)) !important;
    border-top: 1px solid rgba(222, 226, 217, 0.9);
    border-right: 0 !important;
    background: rgba(255, 254, 250, 0.94);
    box-shadow: 0 -16px 34px rgba(48, 63, 57, 0.1);
    backdrop-filter: blur(20px);
  }

  .sidebar .brand,
  .sidebar-bottom {
    display: none !important;
  }

  .sidebar nav {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    height: 100%;
  }

  .sidebar .nav-item {
    display: flex !important;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 2px !important;
    border-radius: 16px;
    font-size: 0 !important;
  }

  .sidebar .nav-item .nav-icon,
  .sidebar .nav-item span.nav-icon {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    font-size: 0 !important;
  }

  .sidebar .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .sidebar .nav-item::after {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #76847e;
    font-size: 10px;
    font-weight: 650;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar .nav-item.active::after {
    color: var(--green);
  }

  .sidebar .nav-item[data-page="dashboard"]::after {
    content: "今日";
  }

  .sidebar .nav-item[data-page="planner"]::after {
    content: "计划";
  }

  .sidebar .nav-item[data-page="focus"]::after {
    content: "专注";
  }

  .sidebar .nav-item[data-page="bank"]::after {
    content: "题库";
  }

  .sidebar .nav-item[data-page="library"]::after {
    content: "留言";
  }

  .sidebar .nav-item[data-page="analytics"]::after {
    content: "复盘";
  }

  .page,
  #planner,
  #bank {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 14px var(--mobile-x) calc(18px + var(--mobile-bottom)) !important;
  }

  .hero {
    margin: 0 0 14px;
    padding: 2px 2px 0;
  }

  .hero h1,
  #planner > .planner-title h1,
  .bank-hero h1 {
    font-size: 24px !important;
    line-height: 1.32;
    letter-spacing: -0.4px;
  }

  .card,
  .gantt-card,
  .plan-table,
  .essay-filter-card,
  .essay-paper-card,
  .essay-detail-card {
    border-radius: 22px !important;
  }

  .modal-backdrop.show {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  .modal {
    width: 100% !important;
    max-width: none !important;
    max-height: 88dvh !important;
    overflow: auto !important;
    border-radius: 26px 26px 0 0 !important;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
  }

  button,
  .primary-btn,
  .ghost-btn,
  .planner-action,
  .pretty-select-trigger,
  .pretty-date-trigger,
  input,
  textarea {
    min-height: 44px;
  }
}

@media (max-width: 767px) {
  #planner .planner-toolbar {
    display: grid !important;
    gap: 10px;
    margin: 0 0 14px !important;
  }

  #planner .view-tabs {
    display: flex;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid rgba(224, 226, 217, 0.68);
    border-radius: 17px;
    background: rgba(255, 254, 250, 0.54);
    scrollbar-width: none;
  }

  #planner .view-tabs::-webkit-scrollbar {
    display: none;
  }

  #planner .view-tabs button {
    flex: 0 0 auto;
    min-height: 38px;
    border-radius: 13px;
    white-space: nowrap;
  }

  #planner .planner-toolbar-right {
    display: grid !important;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-left: 0 !important;
  }

  #planner .date-control {
    width: 100%;
    height: 46px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(255, 254, 250, 0.66);
  }

  #planner .date-control b {
    min-width: 0;
    flex: 1;
    font-size: 13px;
  }

  #planner .planner-main-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0;
    background: transparent;
  }

  #planner .planner-action {
    width: 100% !important;
    justify-content: center;
    border-radius: 15px;
  }

  #planner .gantt-card {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 16px 12px !important;
    -webkit-overflow-scrolling: touch;
  }

  #planner .gantt-card > .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
  }

  #planner .gantt-actions {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  #planner .legend {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    white-space: nowrap;
    scrollbar-width: none;
  }

  #planner .legend::-webkit-scrollbar {
    display: none;
  }

  #planner .drag-hint {
    margin-top: 4px;
    color: #8a9691;
    font-size: 11px;
    line-height: 1.7;
  }

  #planner .gantt {
    width: max-content !important;
    min-width: 930px !important;
    overflow: visible !important;
    padding-bottom: 10px;
    scrollbar-color: rgba(102, 143, 132, 0.35) transparent;
    scrollbar-width: thin;
  }

  #planner .gantt.today-axis-mode {
    min-width: 880px !important;
  }

  #planner .gantt.week-calendar-mode {
    min-width: 940px !important;
  }

  #planner .week-parent-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    min-width: 0;
    margin: 0 0 14px;
    padding: 15px;
    border-radius: 20px;
  }

  #planner .week-parent-list {
    width: 100%;
  }

  #planner .week-parent-chip {
    min-width: 226px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  #planner .week-parent-empty {
    display: block;
    padding: 12px;
    border-radius: 14px;
    background: rgba(247, 246, 240, 0.78);
  }

  #planner .week-calendar {
    height: 650px;
  }

  #planner .week-day-grid {
    grid-template-columns: repeat(7, minmax(118px, 1fr));
  }

  #planner .week-day-body {
    height: 592px;
  }

  #planner .plan-table {
    margin-top: 14px;
    padding: 16px 12px !important;
  }

  #planner .plan-table .section-head {
    align-items: flex-start;
    gap: 8px;
  }

  #planner .plan-table table,
  #planner .plan-table thead,
  #planner .plan-table tbody,
  #planner .plan-table tr,
  #planner .plan-table td {
    display: block;
    width: 100%;
  }

  #planner .plan-table thead {
    display: none;
  }

  #planner .plan-table tbody {
    display: grid;
    gap: 10px;
  }

  #planner .plan-table tr {
    padding: 12px;
    border: 1px solid rgba(224, 226, 217, 0.86);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(250, 249, 244, 0.88));
    box-shadow: 0 10px 24px rgba(55, 68, 62, 0.045);
  }

  #planner .plan-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 0 !important;
    border: 0 !important;
    color: #34433d;
    font-size: 12px;
    line-height: 1.55;
  }

  #planner .plan-table td:first-child {
    display: block;
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(226, 228, 220, 0.76) !important;
    font-size: 14px;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
  }

  #planner .plan-table td:not(:first-child):not(:last-child)::before {
    color: #8a9691;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.3px;
  }

  #planner[data-plan-view="year"] .plan-table td:nth-child(2)::before,
  #planner[data-plan-view="month"] .plan-table td:nth-child(2)::before {
    content: "起止日期";
  }

  #planner[data-plan-view="year"] .plan-table td:nth-child(3)::before,
  #planner[data-plan-view="month"] .plan-table td:nth-child(3)::before {
    content: "预计番茄钟";
  }

  #planner[data-plan-view="year"] .plan-table td:nth-child(4)::before,
  #planner[data-plan-view="month"] .plan-table td:nth-child(4)::before {
    content: "当前状态";
  }

  #planner[data-plan-view="year"] .plan-table td:nth-child(5)::before,
  #planner[data-plan-view="month"] .plan-table td:nth-child(5)::before {
    content: "备注";
  }

  #planner[data-plan-view="week"] .plan-table td:nth-child(2)::before,
  #planner[data-plan-view="today"] .plan-table td:nth-child(2)::before {
    content: "日期";
  }

  #planner[data-plan-view="week"] .plan-table td:nth-child(3)::before,
  #planner[data-plan-view="today"] .plan-table td:nth-child(3)::before {
    content: "起止时间";
  }

  #planner[data-plan-view="week"] .plan-table td:nth-child(4)::before,
  #planner[data-plan-view="today"] .plan-table td:nth-child(4)::before {
    content: "归属计划";
  }

  #planner[data-plan-view="week"] .plan-table td:nth-child(5)::before,
  #planner[data-plan-view="today"] .plan-table td:nth-child(5)::before {
    content: "状态";
  }

  #planner .plan-table td:last-child {
    display: flex;
    justify-content: flex-end;
    padding-top: 0 !important;
  }

  #planner .task-manage,
  #planner .plan-table .more-btn {
    min-width: 42px;
    height: 34px;
    border-radius: 12px;
    background: rgba(247, 246, 240, 0.78);
  }

  #planner .plan-note {
    white-space: normal;
  }
}

@media (max-width: 767px) {
  #bank {
    padding-top: 14px !important;
  }

  #bank .bank-page-shell {
    gap: 14px !important;
  }

  #bank .bank-compact-toolbar {
    display: grid;
    gap: 10px;
    margin: 0 0 12px;
  }

  #bank .bank-mode-tabs {
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: none;
  }

  #bank .bank-mode-tabs::-webkit-scrollbar {
    display: none;
  }

  #bank .bank-mode-tabs button {
    flex: 1 0 auto;
    min-height: 38px;
    padding: 0 12px;
  }

  #bank .essay-search {
    width: 100% !important;
    height: 44px;
    border-radius: 16px;
  }

  #bank .essay-filter-card {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin: 0 0 16px !important;
    padding: 16px !important;
  }

  #bank .essay-filter-summary {
    padding: 0 !important;
  }

  #bank .essay-filter-summary b {
    font-size: 16px !important;
  }

  #bank .essay-filter-summary small {
    margin-top: 6px;
    font-size: 11px;
  }

  #bank .essay-filter-controls {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  #bank .essay-paper-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  #bank .essay-paper-card {
    min-height: 0;
    padding: 17px !important;
  }

  #bank .essay-paper-card h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px !important;
    line-height: 1.48;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #bank .essay-paper-card p {
    min-height: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  #bank .essay-card-stats {
    gap: 7px;
  }

  #bank .essay-card-stats span {
    padding: 9px 8px;
  }

  #bank .essay-pagination {
    width: 100%;
    margin-top: 14px;
    border-radius: 18px;
  }

  #bank .essay-detail-card {
    padding: 16px !important;
  }

  #bank .essay-detail-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  #bank .essay-detail-head h2 {
    font-size: 18px;
    line-height: 1.45;
  }

  #bank .essay-detail-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  #bank .essay-question-nav {
    position: sticky;
    z-index: 8;
    top: 54px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    background: linear-gradient(180deg, rgba(248, 247, 241, 0.98), rgba(248, 247, 241, 0.88));
    scrollbar-width: none;
  }

  #bank .essay-question-nav::-webkit-scrollbar {
    display: none;
  }

  #bank .essay-question-nav button {
    min-width: 142px;
    padding: 10px 11px;
    border-radius: 14px;
  }

  #bank .essay-materials,
  #bank .essay-question-panel,
  #bank .essay-answer-panel {
    padding: 15px !important;
    border-radius: 18px;
  }

  #bank .essay-material summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  #bank .essay-answer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #bank .essay-answer-actions {
    width: 100%;
  }

  #bank .essay-answer-actions button {
    flex: 1;
    min-height: 38px;
  }

  #bank .essay-favorites,
  #bank .essay-answer-list {
    gap: 12px;
  }
}

/* Full mobile polish: keep desktop intact, make every module feel intentional on phones. */
@media (max-width: 767px) {
  html {
    background: #f4f2ea;
  }

  body {
    background:
      radial-gradient(circle at 15% 0%, rgba(231, 240, 235, 0.76), transparent 34%),
      linear-gradient(180deg, #f8f7f1 0%, #f3f1e8 100%);
  }

  main {
    min-width: 0;
  }

  .page,
  #planner,
  #bank,
  #analytics,
  #focus,
  #library,
  #desk {
    padding-top: 14px !important;
  }

  .page > .hero {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 10px;
    margin-bottom: 14px !important;
  }

  .page > .hero p {
    display: block !important;
    max-width: 100%;
    color: #7d8984;
    font-size: 12px;
    line-height: 1.7;
  }

  .card,
  .gantt-card,
  .plan-table,
  .essay-paper-card,
  .essay-detail-card,
  .analytics-trend-card,
  .analytics-pie-card,
  .analytics-heatmap-card,
  .sankey-card {
    padding: 16px !important;
    border-radius: 20px !important;
    box-shadow: 0 12px 28px rgba(55, 68, 62, 0.05) !important;
  }

  .section-head {
    align-items: flex-start !important;
    gap: 10px;
    margin-bottom: 13px;
  }

  .section-head h2 {
    font-size: 16px;
    line-height: 1.35;
  }

  .section-head p,
  .small-copy {
    font-size: 12px;
    line-height: 1.7;
  }

  .week-total {
    flex-shrink: 0;
    line-height: 1.5;
  }

  .toast {
    left: var(--mobile-x) !important;
    right: var(--mobile-x) !important;
    bottom: calc(var(--mobile-bottom) + 12px) !important;
    width: auto;
    transform: translateY(20px) !important;
    text-align: center;
  }

  .toast.show {
    transform: translateY(0) !important;
  }

  .pretty-select-menu,
  .pretty-date-panel {
    max-height: min(320px, 52dvh) !important;
  }
}

@media (max-width: 767px) {
  header .points {
    display: none !important;
  }

  .header-right .icon-btn,
  .mobile-account {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 50%;
    background: rgba(255, 254, 250, 0.74) !important;
    box-shadow: inset 0 0 0 1px rgba(224, 226, 217, 0.74);
  }

  .countdown {
    max-width: calc(100vw - 166px);
    min-width: 0;
  }

  .countdown span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .countdown-form {
    grid-template-columns: 1fr;
  }

  .countdown-form input,
  .countdown-form button {
    height: 40px;
    font-size: 12px;
  }
}

@media (max-width: 767px) {
  #dashboard .dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 13px !important;
  }

  #dashboard .main-column,
  #dashboard .side-column {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 13px !important;
  }

  #dashboard .timeline-card .section-head {
    flex-direction: column;
  }

  #dashboard .timeline-card .tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  #dashboard .timeline-card .tabs::-webkit-scrollbar {
    display: none;
  }

  #dashboard .task {
    grid-template-columns: 42px 10px minmax(0, 1fr) 28px !important;
    gap: 7px;
    padding: 7px 0;
  }

  #dashboard .task time {
    font-size: 11px;
  }

  #dashboard .task-content {
    min-width: 0;
    padding: 10px 11px;
    border-radius: 13px;
  }

  #dashboard .task-content b {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.45;
  }

  #dashboard .task-content small {
    line-height: 1.55;
  }

  #dashboard .progress-wrap {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  #dashboard .ring {
    width: 94px;
    height: 94px;
  }

  #dashboard .ring::before {
    width: 68px;
    height: 68px;
  }

  #dashboard .ring b {
    font-size: 22px;
  }

  #dashboard .chart {
    height: 166px;
    gap: 10px;
  }

  #dashboard .bars div {
    width: 22px;
  }

  #dashboard .reading .article {
    gap: 10px;
  }
}

@media (max-width: 767px) {
  #focus .focus-main {
    padding: 16px 14px 18px !important;
  }

  #focus .focus-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #focus .focus-top .pretty-select,
  #focus .focus-mode-switch {
    width: 100% !important;
  }

  #focus .focus-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    border-radius: 15px;
  }

  #focus .focus-mode-switch button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #focus .focus-duration-row {
    width: 100%;
    margin-top: 10px;
  }

  #focus .timer-ring {
    width: min(224px, 68vw) !important;
    height: min(224px, 68vw) !important;
    margin: 18px auto 14px !important;
  }

  #focus .timer-ring b {
    font-size: clamp(36px, 11vw, 44px) !important;
  }

  #focus .timer-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }

  #focus .timer-actions button {
    width: 100%;
    min-width: 0 !important;
    padding: 0 10px;
  }

  #focus #toggleTimer {
    grid-column: 1 / -1;
    order: -1;
  }

  #focus .focus-side {
    margin: 10px 0 14px !important;
    padding: 0 !important;
  }

  #focus .focus-side > .card:last-child {
    width: 100% !important;
  }

  #focus .sound-grid {
    display: flex !important;
    justify-content: center;
  }

  .focus-plan-card,
  .focus-record-table-card {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .focus-plan-head,
  #focus .focus-record-table-card .section-head {
    flex-direction: column;
  }

  .focus-plan-head p,
  #focus .focus-record-table-card .section-head p {
    margin: 4px 0 0;
    color: #7d8984;
    font-size: 12px;
    line-height: 1.65;
  }

  .focus-plan-card {
    padding: 16px 0 16px 14px !important;
  }

  .focus-plan-card .focus-plan-head {
    padding-right: 14px;
  }

  .focus-today-gantt {
    width: max-content !important;
    min-width: 720px !important;
    overflow: visible !important;
  }

  .focus-plan-card::after,
  #planner .gantt-card::after {
    display: block;
    margin: 8px 14px 0 0;
    color: #8a9691;
    font-size: 11px;
    content: "左右滑动查看完整时间轴";
  }

  .focus-record-table-wrap {
    overflow: visible !important;
  }

  .focus-record-table,
  .focus-record-table thead,
  .focus-record-table tbody,
  .focus-record-table tr,
  .focus-record-table td {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .focus-record-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .focus-record-table thead {
    display: none;
  }

  .focus-record-table tbody {
    display: grid;
    gap: 10px;
  }

  .focus-record-table tr {
    padding: 12px;
    border: 1px solid rgba(224, 226, 217, 0.86);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(250, 249, 244, 0.9));
  }

  .focus-record-table td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    height: auto !important;
    min-height: 0;
    padding: 6px 0 !important;
    border: 0 !important;
    color: #34433d;
    font-size: 12px;
    line-height: 1.55;
  }

  .focus-record-table td:first-child {
    display: block;
    padding: 0 0 10px !important;
    border-bottom: 1px solid rgba(226, 228, 220, 0.76) !important;
    font-size: 14px;
    font-weight: 750;
  }

  .focus-record-table td:not(:first-child):not(:last-child)::before {
    color: #8a9691;
    font-size: 11px;
    font-weight: 650;
  }

  .focus-record-table td:nth-child(2)::before {
    content: "日期";
  }

  .focus-record-table td:nth-child(3)::before {
    content: "时间";
  }

  .focus-record-table td:nth-child(4)::before {
    content: "归属";
  }

  .focus-record-table td:nth-child(5)::before {
    content: "状态";
  }

  .focus-record-table td:last-child {
    display: none;
  }

  .focus-record-empty-row td {
    display: block !important;
    padding: 22px 10px !important;
    text-align: center;
  }
}

@media (max-width: 767px) {
  #analytics .analytics-toolbar {
    margin-bottom: 12px;
    overflow: visible !important;
  }

  #analytics .analytics-range-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  #analytics .analytics-range-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #analytics .analytics-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #analytics .stat-card {
    min-height: 118px;
    padding: 14px !important;
  }

  #analytics .stat-card b {
    font-size: 25px;
  }

  #analytics .stat-card small {
    line-height: 1.55;
  }

  #analytics .analytics-main-grid,
  #analytics .analytics-chart-grid {
    gap: 13px;
    margin-bottom: 13px;
  }

  #analytics .analytics-heatmap-card {
    width: 100% !important;
    overflow: hidden;
  }

  #analytics .analytics-heatmap-card .section-head {
    flex-direction: column;
  }

  #analytics .heatmap-frame {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    padding: 6px 0 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #analytics .heatmap-frame::-webkit-scrollbar {
    display: none;
  }

  #analytics .heatmap-months,
  #analytics .heatmap-shell,
  #analytics .heatmap-foot {
    min-width: max-content;
  }

  #analytics .heatmap-months {
    margin-left: 38px;
    font-size: 11px;
  }

  #analytics .heatmap-shell {
    grid-template-columns: 28px max-content;
    gap: 10px;
  }

  #analytics .heatmap-foot {
    margin: 8px 12px 0 38px;
  }

  #analytics .heatmap-foot > span {
    display: none;
  }

  #analytics .analytics-bar-chart {
    min-height: 220px !important;
  }

  #analytics .trend-y-axis {
    padding-right: 8px;
    font-size: 10px;
  }

  #analytics .trend-bars {
    gap: 3px !important;
  }

  #analytics .trend-bar-item small {
    font-size: 10px;
  }

  #analytics .analytics-pie-top {
    grid-template-columns: 106px minmax(0, 1fr) !important;
    gap: 14px;
  }

  #analytics .analytics-pie {
    width: 106px !important;
  }

  #analytics .analytics-pie-summary b {
    font-size: 24px !important;
  }

  #analytics .pie-legend-row {
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 8px;
  }

  #analytics .pie-legend-row small {
    grid-column: 2 / -1;
  }

  #analytics .sankey-card .section-head {
    flex-direction: column;
  }

  #analytics .sankey-chart {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #analytics .sankey-overlay,
  #analytics .sankey-link-space {
    display: none !important;
  }

  #analytics .sankey-col {
    gap: 8px;
  }

  #analytics .sankey-node {
    min-height: 48px;
    padding: 11px 12px 11px 15px;
    border-radius: 14px;
  }

  #analytics .sankey-node b {
    white-space: normal;
  }
}

@media (max-width: 767px) {
  #library .hero {
    margin-bottom: 12px !important;
  }

  #library .library-tabs,
  #library .article-grid {
    width: 100%;
  }

  #library .library-tabs {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  #library .library-tabs::-webkit-scrollbar {
    display: none;
  }

  #library .library-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #library .library-search {
    width: 100%;
  }

  #library .library-search input {
    width: 100%;
  }

  #library .article-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  #library .article-card {
    min-height: 0;
  }

  #library .article-card h2 {
    font-size: 16px;
    line-height: 1.45;
  }
}

@media (max-width: 767px) {
  #desk .hero.compact {
    margin-bottom: 13px !important;
  }

  #desk .big-points {
    align-self: stretch;
    text-align: left;
  }

  #desk .desk-layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 13px;
  }

  #desk .full-desk-card .section-head {
    flex-direction: column;
  }

  #desk .full-scene {
    height: 190px !important;
    border-radius: 16px;
  }

  #desk .backpack-row {
    margin: 0 -2px;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  #desk .backpack-row::-webkit-scrollbar {
    display: none;
  }

  #desk .shop-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  #desk .shop-card {
    min-height: 156px;
    padding: 14px 10px !important;
    text-align: center;
  }

  #desk .shop-card .shop-icon {
    margin-inline: auto;
  }

  #desk .shop-card button {
    width: 100%;
    min-height: 38px;
  }
}

@media (max-width: 767px) {
  .modal .section-head {
    align-items: flex-start !important;
  }

  .modal input,
  .modal select,
  .modal textarea,
  .pretty-select-trigger,
  .pretty-date-trigger {
    font-size: 16px !important;
  }

  .code-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .code-row .soft-btn {
    width: 100%;
  }

  .dialog-footer,
  .profile-actions {
    align-items: stretch !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .dialog-footer .primary-btn,
  .profile-actions .primary-btn,
  .footer-primary {
    width: 100% !important;
  }

  .year-detail-modal {
    display: block;
  }

  .record-table-wrap {
    margin-inline: -4px;
    overflow-x: auto;
  }

  .record-table {
    min-width: 620px;
  }
}

@media (max-width: 380px) {
  :root {
    --mobile-x: 10px;
  }

  .sidebar .nav-item::after {
    font-size: 9px;
  }

  #analytics .analytics-stat-grid,
  #desk .shop-grid {
    grid-template-columns: 1fr !important;
  }

  #focus .timer-ring {
    width: 208px !important;
    height: 208px !important;
  }
}
