@media (min-width: 1600px) {
  .page {
    padding: 40px 48px;
  }
  .workspace {
    padding: 25px 42px;
    grid-template-columns: minmax(0, 1fr) 360px;
  }
  .board-stage {
    max-width: 100%;
  }
  .puzzle-layout {
    gap: 60px;
  }
  .analysis-panel {
    padding-left: 30px;
  }
  .puzzle-board-area {
    max-width: 100%;
  }
}
@media (max-width: 1150px) {
  .app-sidebar {
    width: 180px;
  }
  .app-main {
    margin-left: 180px;
  }
  .wordmark {
    padding-left: 21px;
  }
  .main-navigation > a,
  .main-navigation > button {
    padding: 11px 9px;
    font-size: 12px;
    gap: 9px;
  }
  .page,
  .analytics-workspace {
    padding: 25px;
  }
  .study-header {
    padding: 0 25px;
  }
  .overview-grid {
    gap: 28px;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  }
  .plan-row {
    gap: 10px;
    padding: 16px 0;
  }
  .plan-row strong {
    font-size: 12px;
  }
  .plan-row small {
    font-size: 12px;
  }
  .training-record {
    margin-top: 24px;
  }
  .account-invite {
    margin-top: 20px;
    padding: 14px;
  }
  .library {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 0 22px;
  }
  .library .game-item {
    grid-template-columns: 37px minmax(0, 1fr) 65px 72px;
    gap: 8px;
  }
  .library .game-item > span:last-child {
    display: none;
  }
  .recent-players strong {
    font-size: 12px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 275px;
    padding: 20px;
    gap: 20px;
  }
  .analysis-panel {
    padding-left: 18px;
  }
  .report-form {
    grid-template-columns: 1.2fr 1fr 1fr;
  }
  .report-form > .primary-button {
    grid-column: 2/4;
  }
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 26px;
  }
  .settings-layout {
    gap: 30px;
    grid-template-columns: minmax(300px, 1.3fr) minmax(170px, 0.7fr);
  }
  .board-swatches {
    gap: 6px;
  }
  .swatch {
    width: 54px;
  }
  .board-toolbar {
    gap: 6px;
  }
  .keyboard-hint {
    display: none;
  }
  #analyze-position {
    font-size: 12px;
    padding: 5px;
  }
  .toast {
    left: calc(50% + 90px);
  }
}
@media (max-width: 900px) {
  .app-sidebar {
    width: 76px;
  }
  .app-main {
    margin-left: 76px;
  }
  .wordmark {
    font-size: 0;
    height: 76px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .wordmark #brand {
    width: 24px;
  }
  .brand-period {
    display: none;
  }
  .main-navigation {
    padding: 8px;
  }
  .main-navigation > a,
  .main-navigation > button {
    font-size: 0;
    padding: 14px;
    justify-content: center;
    gap: 0;
  }
  .main-navigation svg {
    width: 23px;
    height: 23px;
  }
  .main-navigation .nav-count {
    position: absolute;
    font-size: 12px;
    margin: 0 0 25px 35px;
  }
  .sidebar-bottom {
    padding: 12px;
  }
  .sidebar-engine {
    display: none;
  }
  .sidebar-account {
    justify-content: center;
  }
  .sidebar-account > span:nth-child(2),
  .sidebar-account > span:last-child {
    display: none;
  }
  .overview-grid {
    grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr);
  }
  .daily-plan .training-record dl {
    flex-wrap: wrap;
  }
  .daily-plan .account-invite {
    display: none;
  }
  .library {
    grid-template-columns: minmax(0, 1fr);
  }
  .library #import-panel {
    grid-column: 1;
    grid-row: auto;
    margin: 0 0 24px;
  }
  .library > .section-title {
    grid-row: 1;
  }
  .source-row {
    flex-direction: row;
  }
  .source-row select {
    width: 140px;
  }
  .library #import-panel #username-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    align-items: end;
  }
  .library #username-form > label {
    grid-column: 1/3;
    margin-top: 0;
  }
  .library .source-row {
    grid-column: 1;
  }
  .library #import-username {
    margin: 0;
  }
  .library-filters {
    grid-row: 3;
  }
  .library #game-list {
    grid-row: 4;
  }
  .library .storage-note {
    grid-row: 6;
  }
  .library .demo-game {
    grid-row: 5;
  }
  .library #pgn-input {
    max-height: 90px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 265px;
    gap: 18px;
    padding: 20px;
  }
  .game-heading h1 {
    font-size: 15px;
  }
  .game-heading p {
    font-size: 12px;
  }
  .analysis-panel {
    padding-left: 15px;
  }
  .board-toolbar {
    flex-wrap: wrap;
  }
  .board-toolbar #position-label {
    font-size: 12px;
  }
  #copy-fen {
    display: none;
  }
  .report-form {
    gap: 10px;
  }
  .analytics-columns {
    gap: 26px;
  }
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 22px;
  }
  .puzzle-feedback h2 {
    font-size: 20px;
  }
  .puzzle-feedback p {
    font-size: 12px;
  }
  .toast {
    left: calc(50% + 38px);
  }
}
@media (max-width: 700px) {
  .app-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    overflow: auto;
  }
  .wordmark {
    height: 58px;
    min-width: 61px;
  }
  .wordmark #brand,
  .wordmark #brand svg {
    width: 20px;
    height: 27px;
  }
  .main-navigation {
    flex-direction: row;
    gap: 0;
    padding: 0;
    flex: 1;
    justify-content: space-around;
  }
  .main-navigation > a,
  .main-navigation > button {
    width: auto;
    min-width: 42px;
    padding: 12px 9px;
    min-height: 42px;
    position: relative;
  }
  .main-navigation svg {
    width: 21px;
    height: 21px;
  }
  .main-navigation .nav-count {
    display: none;
  }
  .sidebar-bottom {
    display: none;
  }
  .app-main {
    margin-left: 0;
  }
  .study-header {
    height: 48px;
    padding: 0 18px;
    gap: 12px;
  }
  .study-header .quiet-button {
    padding: 6px 9px;
    min-height: 29px;
    font-size: 12px;
  }
  .study-header .quiet-button svg {
    width: 13px;
    height: 13px;
  }
  #page-label {
    font-size: 12px;
  }
  #toggle-settings {
    display: none;
  }
  #sync-status {
    display: none;
  }
  .header-signin {
    font-size: 12px;
  }
  .page,
  .analytics-workspace {
    padding: 24px 18px;
  }
  .page-heading {
    margin-bottom: 25px;
    gap: 15px;
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 27px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .page-heading .primary-link {
    font-size: 12px;
    padding: 10px;
    min-height: 38px;
    white-space: nowrap;
  }
  .page-heading .primary-link svg {
    width: 14px;
    height: 14px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 27px;
  }
  .home-training {
    max-width: 450px;
    margin: auto;
    width: 100%;
  }
  .home-puzzle-link {
    max-width: none;
  }
  .home-training .section-title h2 {
    font-size: 17px;
  }
  .daily-plan {
    padding-top: 0;
  }
  .daily-plan > h2 {
    font-size: 17px;
    margin-bottom: 4px;
  }
  .plan-row {
    padding: 16px 0;
    gap: 16px;
  }
  .plan-row strong {
    font-size: 13px;
  }
  .plan-row small {
    font-size: 12px;
  }
  .training-record dl {
    justify-content: flex-start;
    gap: 35px;
  }
  .training-record dt {
    font-size: 12px;
  }
  .training-record dd {
    font-size: 24px;
  }
  .daily-plan .account-invite {
    display: flex;
  }
  .recent-section {
    margin-top: 30px;
  }
  .recent-section .section-title h2 {
    font-size: 17px;
  }
  .recent-game,
  .library .game-item {
    grid-template-columns: 39px minmax(0, 1fr) 74px;
    gap: 8px;
    padding: 15px 0;
  }
  .recent-game > span:last-child {
    display: none;
  }
  .recent-game .game-date,
  .game-item .game-date {
    display: none;
  }
  .recent-players strong {
    font-size: 12px;
  }
  .game-state {
    font-size: 12px;
    text-align: right;
  }
  .recent-players small {
    font-size: 12px;
  }
  .game-result {
    font-size: 12px;
  }
  .study-footer {
    padding: 20px 18px;
  }
  .library > .section-title {
    margin-bottom: 14px;
  }
  .library #import-panel {
    padding: 17px;
  }
  .library #import-panel #username-form {
    grid-template-columns: 1fr;
  }
  .library #username-form > label {
    grid-column: 1;
  }
  .library .source-row {
    grid-column: 1;
  }
  .library #import-username {
    width: 100%;
  }
  .library-filters {
    gap: 8px;
  }
  .library-filters select {
    max-width: 125px;
    padding: 9px 7px;
    font-size: 12px;
  }
  .library-filters input {
    font-size: 12px;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 20px 16px;
  }
  .board-stage {
    max-width: none;
    width: 100%;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 7px;
  }
  .game-heading {
    margin-bottom: 14px;
  }
  .game-heading h1 {
    font-size: 17px;
  }
  .game-heading p {
    font-size: 12px;
  }
  .game-heading .icon-button {
    width: 30px;
    min-height: 30px;
    height: 30px;
  }
  .game-actions > summary {
    font-size: 12px;
    padding: 6px;
  }
  .board-toolbar {
    gap: 8px;
    flex-wrap: nowrap;
  }
  .board-toolbar #position-label {
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .navigation {
    gap: 3px;
  }
  .navigation .icon-button {
    width: 28px;
    height: 29px;
    min-height: 29px;
    padding: 5px;
  }
  #analyze-position {
    font-size: 12px;
    max-width: 82px;
  }
  .board-caption {
    font-size: 12px;
  }
  .eval-score {
    font-size: 12px;
  }
  .file-label,
  .rank-label {
    font-size: 12px;
  }
  .graph-heading {
    margin-top: 15px;
  }
  .eval-graph {
    height: 72px;
  }
  .analysis-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 22px 0 0;
    max-height: none;
    overflow: visible;
  }
  .analysis-panel .section-title h2 {
    font-size: 15px;
  }
  .analysis-panel .hint {
    font-size: 12px;
  }
  .line-san {
    font-size: 13px;
  }
  .line-head {
    font-size: 12px;
  }
  .line-head strong {
    font-size: 14px;
  }
  .line-head em {
    font-size: 12px;
  }
  .move-feedback p {
    font-size: 12px;
  }
  .move-list {
    max-height: 330px;
  }
  .move-button {
    font-size: 15px;
    min-height: 35px;
  }
  .move-number {
    font-size: 12px;
  }
  .study-settings {
    top: 0;
  }
  .player-name {
    font-size: 12px;
  }
  .player-detail {
    font-size: 12px;
  }
  .classification {
    font-size: 12px;
  }
  .analytics-heading {
    align-items: start;
  }
  .analytics-heading h1 {
    font-size: 27px;
  }
  .analytics-heading p {
    font-size: 12px;
  }
  .share-action .quiet-button {
    font-size: 12px;
    padding: 7px;
  }
  .player-setup {
    padding: 16px;
  }
  .report-form {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .report-form > label:first-child {
    grid-column: 1/3;
  }
  .report-form > .primary-button {
    grid-column: 1/3;
  }
  .report-start {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .report-start .primary-button {
    justify-content: center;
  }
  .report-game strong {
    font-size: 12px;
  }
  .report-game small,
  .report-game .text-button {
    font-size: 12px;
  }
  .insights-filters {
    gap: 10px;
  }
  .insights-filters label {
    flex: 1;
    font-size: 12px;
    min-width: 0;
  }
  .insights-filters select {
    min-width: 0;
    width: 100%;
    font-size: 12px;
    padding: 8px 5px;
  }
  .analytics-overview {
    align-items: start;
    gap: 10px;
  }
  .analytics-overview p {
    font-size: 12px;
  }
  .analytics-overview h2 {
    font-size: 21px;
  }
  .analytics-overview button {
    font-size: 12px;
    white-space: nowrap;
  }
  .result-labels {
    gap: 12px;
    font-size: 12px;
  }
  .analytics-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .analytics-columns table {
    font-size: 12px;
  }
  .analytics-columns td,
  .analytics-columns th {
    padding: 10px 5px;
  }
  .analytics-columns h3 {
    font-size: 16px;
  }
  .analytics-method {
    font-size: 12px;
  }
  .puzzles-page .page-heading {
    margin-bottom: 16px;
  }
  .puzzle-rating {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: end;
    max-width: 135px;
  }
  .puzzle-rating > span:first-child {
    font-size: 12px;
    width: 100%;
    text-align: right;
  }
  .puzzle-rating strong {
    font-size: 24px;
  }
  .training-tabs {
    gap: 19px;
    margin-bottom: 18px;
  }
  .training-tabs button {
    font-size: 12px;
    padding: 12px 0;
  }
  .puzzle-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .puzzle-board-area {
    max-width: none;
  }
  .puzzle-player {
    font-size: 12px;
  }
  .puzzle-panel {
    display: grid;
    grid-template-columns: 1fr;
    padding: 0;
  }
  .puzzle-feedback {
    min-height: 0;
    padding-bottom: 23px;
  }
  .feedback-icon {
    display: none;
  }
  .puzzle-feedback h2 {
    font-size: 21px;
    margin-bottom: 7px;
  }
  .puzzle-feedback p {
    font-size: 13px;
  }
  .puzzle-help {
    margin-top: 18px;
  }
  .puzzle-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    padding: 20px 0;
  }
  .puzzle-options label:first-child {
    grid-column: 1;
    grid-row: 1;
  }
  .puzzle-options label:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
  }
  .puzzle-options select {
    grid-row: 2;
    margin-bottom: 0;
    font-size: 12px;
  }
  .puzzle-options .hint {
    grid-column: 1/3;
    font-size: 12px;
  }
  .puzzle-session {
    padding-top: 18px;
  }
  .puzzle-credit {
    margin-top: 18px;
  }
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .settings-preview {
    max-width: 300px;
    position: static;
    grid-row: 1;
  }
  .settings-preview .mini-chessboard {
    max-width: 220px;
  }
  .settings-preview p {
    font-size: 12px;
  }
  .board-swatches {
    gap: 9px;
  }
  .swatch {
    width: 62px;
  }
  .settings-fields > h2 {
    font-size: 18px;
  }
  .setting-line {
    font-size: 12px;
  }
  .account-signin {
    padding: 24px 20px;
  }
  .account-profile {
    gap: 13px;
    flex-wrap: wrap;
  }
  .profile-avatar {
    width: 45px;
    height: 45px;
    font-size: 21px;
  }
  .account-profile h2 {
    font-size: 19px;
  }
  .account-profile p {
    font-size: 12px;
  }
  .account-profile button {
    font-size: 12px;
  }
  .account-library > p {
    font-size: 12px;
  }
  .account-actions {
    gap: 8px;
  }
  .account-actions button {
    font-size: 12px;
  }
  .danger-zone form {
    flex-direction: column;
    align-items: start;
  }
  .toast {
    left: 50%;
    bottom: 16px;
    font-size: 12px;
  }
  .piece-letter {
    font-size: clamp(22px, 6.5vw, 40px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 700px) {
  .position-workspace {
    max-width: none;
  }
}
.setup-strip,
.lesson-strip {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.setup-strip form {
  display: grid;
  grid-template-columns: minmax(160px, 2fr) 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.setup-strip label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}
.setup-strip input,
.setup-strip select {
  width: 100%;
  min-width: 0;
}
.setup-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}
.lesson-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.lesson-strip h2 {
  font-size: 18px;
}
.lesson-strip p,
.profile-link small {
  font-size: 12px;
  color: var(--muted);
}
.profile-link {
  margin: 12px 0;
  overflow-wrap: anywhere;
}
#connect-chesscom,
#import-linked-profile,
#restart-onboarding {
  margin-top: 12px;
  display: block;
}
@media (max-width: 700px) {
  .setup-strip form {
    grid-template-columns: 1fr;
  }
  .lesson-strip {
    align-items: flex-start;
    flex-direction: column;
  }
  .setup-strip input,
  .setup-strip select,
  .setup-actions button {
    min-height: 44px;
  }
}
