/* Desktop follows the iPad's navigation column, inspectors and split views.
   Keep these rules after phone styles so a breakpoint change preserves state. */
.desktop-screen-title {
  display: none;
}
.practice-puzzle-figure,
.practice-puzzle-choice,
.playback-timeline {
  display: contents;
}
.practice-puzzle-figure figcaption {
  display: none;
}
.case-filter-options {
  min-width: 0;
}
.case-filter-options > summary {
  display: none;
}
.notation-guide > h2 {
  font-size: 20px;
  margin: 0 0 6px;
}
.notation-guide p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  margin: 6px 0 12px;
}
.notation-guide h3 {
  font-size: 17px;
  margin: 0;
}
.notation-guide h4 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.notation-move-preview {
  height: 130px;
}
.notation-move-preview .cube-illustration {
  width: 100%;
  height: 100%;
}
.notation-card-title {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 7px;
}
.notation-card-title strong {
  font-size: 22px;
}
.notation-card-title small {
  color: var(--muted);
  font-size: 12px;
}
.notation-guide .notation-card > p {
  font-size: 12px;
  margin-bottom: 0;
}

@media (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (pointer: fine) {
  :root {
    --desktop-sidebar-width: clamp(240px, 23.25vw, 320px);
  }
  body {
    background: linear-gradient(
        var(--native-gradient-angle, 135deg) in srgb-linear,
        var(--primary),
        var(--theme-end)
      )
      fixed;
  }
  .workspace.sidebar-open {
    grid-template-columns: var(--desktop-sidebar-width) minmax(0, 1fr);
  }
  .sidebar {
    width: var(--desktop-sidebar-width);
    padding: 12px 16px 24px;
    border: 0;
    background: rgba(0, 85, 85, 0.025);
  }
  .native-sidebar-header {
    min-height: 44px;
    margin: 0 0 28px;
    justify-content: space-between;
  }
  .native-sidebar-header .brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
  }
  .native-sidebar-header .icon-button,
  .topbar .icon-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
  }
  .sidebar-group {
    margin: 0 0 22px;
  }
  .sidebar-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: color-mix(in srgb, var(--accent) 55%, transparent);
    font-size: 17px;
    list-style: none;
    cursor: pointer;
  }
  .sidebar-group > summary::-webkit-details-marker {
    display: none;
  }
  .sidebar-group > summary .icon {
    width: 16px;
    height: 16px;
    transform: rotate(90deg);
  }
  .sidebar-group:not([open]) > summary .icon {
    transform: none;
  }
  .sidebar .nav-item {
    display: flex;
    gap: 14px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 26px;
    font-size: 17px;
    font-weight: 400;
    color: var(--text);
  }
  .sidebar .nav-item .icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--accent);
  }
  .sidebar .nav-item.active {
    background: var(--control);
    font-weight: 600;
    color: var(--text);
  }
  .topbar {
    display: flex;
    position: relative;
    flex-basis: 78px;
    min-height: 78px;
    padding: 12px 10px;
    border: 0;
    background: transparent;
  }
  .topbar-left,
  .topbar-right {
    flex: 0 0 auto;
    min-width: 44px;
    gap: 8px;
    z-index: 1;
  }
  .topbar-right {
    margin-left: auto;
  }
  .desktop-screen-title {
    margin: 0;
    display: block;
    position: absolute;
    left: 100px;
    right: 100px;
    text-align: center;
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    pointer-events: none;
  }
  .desktop-screen-title:empty {
    display: none;
  }
  .workspace main {
    padding: 0 16px 20px;
  }
  .page-head {
    min-height: 0;
    margin: 8px 4px 30px;
    text-align: left;
    justify-content: flex-start;
  }
  .page-head h1 {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    text-align: left;
  }
  .workspace[data-compact-header='true'] .page-head {
    display: none;
  }
  .section-caption {
    font-size: 17px;
    color: var(--muted);
    margin: 0 0 6px;
  }
  .mobile-puzzle-menu {
    gap: 24px;
    padding: 0 8px;
  }
  .mobile-puzzle-menu .section-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
  }
  .mobile-puzzle-menu .section-caption .icon {
    width: 22px;
    height: 22px;
  }
  .puzzle-menu-buttons {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .puzzle-menu-button {
    min-height: 50px;
    font-size: 17px;
    border-radius: 16px;
  }
  .puzzle-menu-button small {
    font-size: 11px;
  }
  .puzzle-overview .native-catalog-intro {
    display: none;
  }
  .puzzle-overview .beginner-section {
    margin-bottom: 30px;
  }
  .overview-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 28px 22px;
  }
  .overview-groups .set-section {
    margin: 0;
  }
  .puzzle-overview .set-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .puzzle-overview .set-card {
    min-height: 80px;
    padding: 10px;
    gap: 18px;
    border-radius: 16px;
  }
  .puzzle-overview .set-image {
    width: 56px;
    height: 58px;
    flex-shrink: 0;
  }
  .puzzle-overview .set-copy h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 5px;
  }
  .puzzle-overview .set-copy p {
    font-size: 15px;
    margin: 0;
    color: var(--muted);
  }
  .notation-link .set-image {
    display: grid;
    place-items: center;
  }
  .puzzle-overview .catalog-lock {
    margin-left: auto;
  }
  .zbll-overview .overview-groups {
    display: block;
  }
  .zbll-overview .set-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .algorithm-list-layout {
    grid-template-columns: minmax(0, 7fr) minmax(230px, 2.7fr);
    gap: 22px;
  }
  .algorithm-list-main {
    padding-right: 0;
  }
  .algorithm-list-aside {
    gap: 16px;
    padding: 8px 0 0;
  }
  .algorithm-list-aside .panel {
    padding: 15px;
    border-radius: 16px;
  }
  .panel-heading h2 {
    font-size: 17px;
    font-weight: 600;
  }
  .algorithm-list-aside .panel-heading {
    margin-bottom: 16px;
  }
  .algorithm-list-aside .button {
    min-height: 44px;
    font-size: 17px;
  }
  .native-info-panel .info-image {
    width: 130px;
    height: 140px;
    margin: 0 auto 16px;
  }
  .native-info-panel p,
  .native-info-panel summary {
    font-size: 15px;
    line-height: 1.3;
  }
  .mobile-list-tools {
    margin-bottom: 30px;
  }
  .list-toolbar {
    position: relative;
    gap: 8px;
    margin: 0;
  }
  .search-input {
    min-width: 0;
    flex: 1;
    min-height: 44px;
    border-radius: 16px;
    padding-right: 44px;
    background: var(--panel);
  }
  .search-input input {
    font-size: 17px;
  }
  .case-filter-options {
    position: absolute;
    right: 8px;
    top: 3px;
    z-index: 2;
  }
  .case-filter-options > summary {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--accent);
    border-radius: 50%;
    list-style: none;
    cursor: pointer;
  }
  .case-filter-options[open] > .filter-chips {
    position: absolute;
    right: -8px;
    top: 44px;
    display: flex;
    flex-wrap: wrap;
    width: min(420px, 65vw);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--primary) 15%, #fff);
    box-shadow: 0 8px 24px #0002;
  }
  .case-section {
    margin-bottom: 28px;
  }
  .case-section > h2 {
    font-size: 17px;
    margin-bottom: 7px;
  }
  .case-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  .case-card {
    min-height: 94px;
    padding: 10px 8px;
    gap: 10px;
    border-radius: 16px;
  }
  .case-card .status-dot {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }
  .case-diagram {
    width: 72px;
    height: 72px;
  }
  .case-card h3 {
    font-size: 15px;
    margin: 0 0 4px;
  }
  .case-card .notation {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.25;
  }
  .algorithm-list-layout.inspector-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
  .inspector-hidden .algorithm-list-aside {
    display: none;
  }
  .detail-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 34px;
    padding: 8px 12px 0;
  }
  .case-preview {
    padding: 0;
  }
  .learning-control,
  .preview-mode-tabs {
    margin-bottom: 16px;
  }
  .segmented {
    min-height: 32px;
  }
  .segmented button {
    padding: 5px 10px;
    font-size: 13px;
  }
  .preview-mode-tabs .pro-badge {
    display: none;
  }
  .diagram-stage {
    min-height: 260px;
    margin: 30px 0 0;
  }
  .detail-diagram {
    width: 240px;
    height: 240px;
  }
  .native-case-notation {
    font-size: 21px;
    line-height: 1.35;
    font-weight: 600;
    margin: 16px 0 22px;
  }
  .detail-preview-actions,
  .case-preview > [data-action='practice-case'] {
    display: none;
  }
  .native-setup {
    font-size: 15px;
    margin-top: 18px;
  }
  .detail-right {
    gap: 24px;
    padding: 0 0 4px;
  }
  .solutions-panel .panel-heading {
    margin: 14px 16px 12px;
    color: var(--muted);
  }
  .solutions-panel h2 {
    font-size: 15px;
    font-weight: 400;
  }
  .solutions {
    gap: 6px;
  }
  .solution-row .solution {
    min-height: 44px;
    padding: 10px 65px 10px 12px;
    background: color-mix(in srgb, var(--primary) 30%, transparent);
    border-radius: 16px;
  }
  .solution code {
    font-family: inherit;
    font-size: 17px;
    line-height: 1.3;
  }
  .solution > .selected-solution-mark {
    width: 21px;
    height: 21px;
    right: 37px;
  }
  .solution-validation {
    right: 9px;
  }
  .solution-validation .icon {
    width: 18px;
    height: 18px;
  }
  .solutions-panel > [data-action='add-notation'] {
    min-height: 44px;
    margin-top: 6px;
    border: 0;
    border-radius: 16px;
    background: color-mix(in srgb, var(--primary) 30%, transparent);
    font-size: 17px;
  }
  .case-history-panel {
    padding: 16px;
    border-radius: 16px;
  }
  .case-history-panel .trend {
    min-height: 200px;
    max-height: 300px;
  }
  .native-history-item {
    padding: 15px;
    border-radius: 16px;
  }
  .native-history-item .time-link {
    font-size: 17px;
  }
  .practice-menu .practice-menu-options {
    width: min(420px, 100%);
    margin: 0 auto 20px;
    min-height: 40px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.15);
  }
  .practice-menu-options button {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
  }
  .practice-menu-options button.selected {
    color: var(--text);
  }
  .practice-filters {
    margin-bottom: 40px;
    gap: 8px;
  }
  .practice-filters .chip,
  .learn-library > .filter-chips .chip {
    font-size: 12px;
    min-height: 30px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--muted);
  }
  .practice-filters .chip.selected,
  .learn-library > .filter-chips .chip.selected {
    color: var(--text);
  }
  .practice-set-groups {
    gap: 34px;
  }
  .practice-set-groups .section-caption {
    color: var(--text);
    font-weight: 600;
    margin: 0 6px 16px;
  }
  .practice-set-groups .set-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .practice-set-card {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-height: 150px;
    padding: 15px;
    gap: 12px;
    border-radius: 16px;
    text-align: left;
  }
  .practice-set-card .set-image {
    width: 80px;
    height: 80px;
  }
  .practice-set-card .set-copy {
    flex: 0;
  }
  .practice-set-card h3 {
    font-size: 17px;
    line-height: 1.3;
  }
  .practice-set-card .set-copy p {
    display: none;
  }
  .practice-set-card > .catalog-lock {
    position: absolute;
    right: 10px;
    top: 10px;
  }
  .practice-puzzle-picker {
    background: transparent;
    border: 0;
    border-radius: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
    margin: 30px 0 0;
    padding: 0;
    gap: 40px;
  }
  .practice-puzzle-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 0;
  }
  .practice-puzzle-image {
    width: 225px;
    height: 225px;
    margin: 0;
    filter: drop-shadow(0 3px 8px #0004);
  }
  .practice-puzzle-figure figcaption {
    display: block;
    font-size: 34px;
    font-weight: 700;
  }
  .practice-puzzle-choice {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 25px;
    padding: 0 30px;
  }
  .puzzle-wheel {
    position: relative;
    width: 100%;
  }
  .puzzle-wheel-window {
    display: block;
    position: relative;
    height: 124px;
    overflow: hidden;
    mask-image: linear-gradient(transparent, #000 20%, #000 62%, transparent);
  }
  .puzzle-wheel-window::before {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    top: 28px;
    height: 32px;
    border-radius: 20px;
    background: rgba(0, 85, 85, 0.06);
  }
  .puzzle-wheel-options {
    transform: translateY(calc((1 - var(--wheel-index)) * 28px));
  }
  .puzzle-wheel-options button {
    display: block;
    width: 100%;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 28px;
    font-weight: 400;
  }
  .puzzle-wheel-options button.selected {
    color: var(--text);
  }
  .puzzle-wheel select {
    position: absolute;
    width: 1px;
    height: 1px;
    left: 50%;
    bottom: 0;
    padding: 0;
    opacity: 0;
  }
  .puzzle-wheel select:focus-visible {
    position: relative;
    width: 100%;
    height: 44px;
    left: 0;
    opacity: 1;
  }
  .start-practice {
    position: relative;
    min-height: 50px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 16px;
  }
  .start-practice .icon {
    position: absolute;
    right: 12px;
    color: var(--muted);
  }
  .learn-layout {
    gap: 32px;
    padding: 0 16px;
  }
  .learn-library {
    padding: 0;
  }
  .learn-library > .filter-chips {
    margin-bottom: 40px;
    gap: 8px;
  }
  .learn-library > .set-section > h2 {
    font-size: 17px;
    margin: 0 6px 18px;
  }
  .learn-layout .video-grid {
    gap: 12px;
    align-items: start;
  }
  .learn-layout .video-card {
    padding: 14px;
    border-radius: 16px;
  }
  .learn-layout .video-art {
    border-radius: 9px;
    filter: drop-shadow(0 3px 5px #0004);
  }
  .learn-layout .video-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 10px 0 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .learn-player {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .native-video-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 0;
    padding: 20px;
    border: 0;
    background: transparent;
    color: var(--text);
  }
  .native-video-placeholder > .icon {
    width: 44px;
    height: 44px;
    margin-bottom: 20px;
    color: var(--muted);
  }
  .native-video-placeholder h2 {
    font-size: 20px;
    margin: 0;
  }
  .native-video-placeholder p {
    font-size: 20px;
    color: var(--muted);
    margin: 0;
    line-height: 1.3;
  }
  .notation-reference-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 10px 0 24px;
  }
  .notation-guide section {
    margin: 18px 0 24px;
  }
  .notation-reference-grid .notation-card {
    padding: 10px 8px;
    border-radius: 16px;
  }
  .notation-move-preview {
    height: 130px;
    margin: 0 0 5px;
  }
  .guide-speed {
    min-width: 68px;
    border-radius: 26px;
    color: var(--accent);
  }
  dialog.notation-sheet {
    width: 580px;
    max-width: calc(100vw - 48px);
    max-height: calc(100dvh - 40px);
    padding: 16px;
    border-radius: 36px;
    background: linear-gradient(
      var(--native-gradient-angle, 135deg) in srgb-linear,
      var(--primary),
      var(--theme-end)
    );
  }
  .notation-sheet::before {
    content: '';
    position: absolute;
    top: 6px;
    left: calc(50% - 30px);
    width: 60px;
    height: 4px;
    border-radius: 4px;
    background: var(--accent);
    opacity: 0.25;
  }
  .notation-sheet .modal-head {
    position: relative;
    justify-content: center;
    min-height: 40px;
    margin: 0 0 24px;
  }
  .notation-sheet .modal-head h2 {
    max-width: calc(100% - 76px);
    font-size: 17px;
    text-align: center;
  }
  .notation-sheet .modal-head .icon-button {
    position: absolute;
    left: 0;
  }
  .notation-sheet .notation-editor {
    gap: 12px;
  }
  .notation-sheet .editor-input textarea {
    height: 80px;
  }
  .notation-sheet .editor-preview {
    gap: 12px;
  }
  .notation-sheet .editor-preview-tabs {
    width: 205px;
    min-height: 32px;
  }
  .notation-sheet #editor-cube {
    height: 200px;
  }
  .notation-sheet .editor-diagram {
    width: 200px;
    height: 200px;
  }
  .notation-keyboard .button {
    min-height: 36px;
    padding: 4px;
    font-size: 20px;
  }
  .notation-editor .modal-actions {
    margin-top: 0;
  }
  dialog.playback-sheet {
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 16px;
    background: linear-gradient(
      var(--native-gradient-angle, 135deg) in srgb-linear,
      var(--primary),
      var(--theme-end)
    );
  }
  .playback-sheet .modal-head {
    position: relative;
    justify-content: center;
    height: 44px;
    margin-bottom: 24px;
  }
  .playback-sheet .modal-head h2 {
    font-size: 17px;
  }
  .playback-sheet .modal-head .icon-button {
    position: absolute;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
  }
  .playback-sheet .playback-panel {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    height: calc(100% - 68px);
    gap: 24px;
  }
  .playback-sheet .preview-expansion {
    display: none;
  }
  .playback-sheet .playback-case-title {
    position: absolute;
    left: 50%;
    right: 0;
    top: 0;
    text-align: center;
    font-size: 17px;
  }
  .playback-sheet .playback-cube {
    height: min(75dvh, 680px);
  }
  .playback-sheet .playback-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 70px;
  }
  .playback-sheet .native-case-notation {
    font-size: 21px;
    font-weight: 500;
  }
  .playback-sheet .move-tokens {
    display: none;
  }
  .playback-sheet .playback-controls {
    position: relative;
    max-width: 420px;
    justify-content: center;
  }
  .playback-sheet .playback-controls > span {
    position: absolute;
    left: 0;
    right: 0;
    top: -30px;
    text-align: center;
  }
  .playback-sheet .playback-controls .icon-button {
    min-height: 50px;
    width: 60px;
    border-radius: 28px;
  }
  .playback-sheet .playback-controls select {
    flex-basis: 100%;
    max-width: 130px;
    margin: 12px 25% 0;
  }
}

/* Compact desktop widths retain two panes without squeezing the artwork. */
@media (min-width: 701px) and (max-width: 1000px) and (min-height: 501px),
  (min-width: 701px) and (max-width: 1000px) and (pointer: fine) {
  .detail-layout {
    gap: 18px;
    padding: 0;
  }
  .detail-diagram {
    width: 210px;
    height: 210px;
  }
  .learn-layout {
    padding: 0;
    gap: 20px;
    grid-template-columns: minmax(0, 48fr) minmax(0, 52fr);
  }
  .learn-layout .video-card {
    padding: 10px;
  }
  .learn-layout .video-card h3 {
    font-size: 15px;
  }
  .practice-puzzle-choice {
    padding: 0;
  }
  .practice-puzzle-picker {
    gap: 16px;
  }
  .algorithm-list-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 14px;
  }
}

@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  .mobile-puzzle-menu .section-caption .icon {
    display: none;
  }
  .overview-groups {
    display: contents;
  }
  .notation-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
