@media (max-width: 1279px) {
  body[data-wall-dashboard="true"] .wall-safety-strip {
    position: static !important;
    width: fit-content;
    max-width: min(100%, 920px);
    margin: 12px auto 0;
    box-shadow: none;
  }
}

@media (orientation: landscape) and (max-width: 1279px) {
  body[data-wall-dashboard="true"] .family-shell {
    width: min(1500px, calc(100% - 18px));
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body[data-wall-dashboard="true"] .family-header {
    min-height: 0;
    padding: 4px 2px 10px;
    gap: 14px;
  }

  body[data-wall-dashboard="true"] .family-kicker,
  body[data-wall-dashboard="true"] .family-view-label,
  body[data-wall-dashboard="true"] .family-subtitle,
  body[data-wall-dashboard="true"] .family-navigation,
  body[data-wall-dashboard="true"] .family-footer {
    display: none;
  }

  body[data-wall-dashboard="true"] .family-header h1 {
    margin: 2px 0 0;
    font-size: clamp(30px, 4.4vw, 46px);
  }

  body[data-wall-dashboard="true"] .family-clock {
    font-size: clamp(34px, 5.2vw, 56px);
  }

  body[data-wall-dashboard="true"] .family-header-side,
  body[data-wall-dashboard="true"] .wall-display-actions {
    gap: 6px;
  }

  body[data-wall-dashboard="true"] .wall-display-actions a,
  body[data-wall-dashboard="true"] .wall-display-actions button {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 13px;
  }

  body[data-wall-dashboard="true"] .family-grid {
    gap: 8px;
  }

  body[data-wall-dashboard="true"] .family-card,
  body[data-wall-dashboard="true"] .routine-card,
  body[data-wall-dashboard="true"] .calendar-card,
  body[data-wall-dashboard="true"] .weather-card,
  body[data-wall-dashboard="true"] .meal-card,
  body[data-wall-dashboard="true"] .family-tasks-card,
  body[data-wall-dashboard="true"] .system-card {
    min-height: 210px !important;
    padding: 14px;
    border-radius: 22px;
  }

  body[data-wall-dashboard="true"] .card-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 24px;
  }

  body[data-wall-dashboard="true"] .card-heading h2 {
    font-size: clamp(19px, 2.1vw, 25px);
  }

  body[data-wall-dashboard="true"] .routine-card-content,
  body[data-wall-dashboard="true"] .routine-panel,
  body[data-wall-dashboard="true"] .routine-copy {
    min-width: 0;
  }

  body[data-wall-dashboard="true"] .routine-card-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  body[data-wall-dashboard="true"] .routine-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body[data-wall-dashboard="true"] .routine-pictogram-frame {
    min-height: 84px;
    max-height: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body[data-wall-dashboard="true"] .routine-pictogram {
    width: 86px;
    height: 86px;
    max-width: 86px;
    max-height: 86px;
  }

  body[data-wall-dashboard="true"] .routine-copy {
    width: 100%;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
  }

  body[data-wall-dashboard="true"] .routine-title {
    font-size: clamp(28px, 3.4vw, 42px);
    line-height: 1.04;
    overflow-wrap: break-word;
    word-break: normal;
  }

  body[data-wall-dashboard="true"] .routine-label,
  body[data-wall-dashboard="true"] .routine-progress,
  body[data-wall-dashboard="true"] .routine-time,
  body[data-wall-dashboard="true"] .routine-message {
    font-size: 14px;
  }

  body[data-wall-dashboard="true"] .routine-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
  }

  body[data-wall-dashboard="true"] .routine-actions button,
  body[data-wall-dashboard="true"] .routine-reset,
  body[data-wall-dashboard="true"] .routine-edit-action,
  body[data-wall-dashboard="true"] .routine-switch button {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 14px;
  }

  body[data-wall-dashboard="true"] .weather-symbol {
    width: 56px;
    height: 56px;
    border-radius: 17px;
    font-size: 34px;
  }

  body[data-wall-dashboard="true"] .weather-temperature {
    font-size: clamp(44px, 5.4vw, 64px);
  }

  body[data-wall-dashboard="true"] .weather-uv {
    margin-top: 6px;
    padding: 7px 10px;
    font-size: 14px;
  }

  body[data-wall-dashboard="true"] .weather-forecast,
  body[data-wall-dashboard="true"] .wall-safety-strip {
    gap: 6px;
  }

  body[data-wall-dashboard="true"] .weather-forecast-item {
    min-height: 82px;
    padding: 9px;
  }

  body[data-wall-dashboard="true"] .weather-forecast-day,
  body[data-wall-dashboard="true"] .weather-forecast-temperatures {
    font-size: 15px;
  }

  body[data-wall-dashboard="true"] .weather-forecast-symbol {
    font-size: 24px;
  }

  body[data-wall-dashboard="true"] .calendar-range-controls {
    margin: 7px 0;
  }

  body[data-wall-dashboard="true"] .calendar-range-controls button {
    min-height: 34px;
    padding: 5px 10px;
    font-size: 13px;
  }

  body[data-wall-dashboard="true"] .calendar-day-events .calendar-event {
    min-height: 68px;
  }

  body[data-wall-dashboard="true"] .calendar-event-title,
  body[data-wall-dashboard="true"] .family-task-summary {
    font-size: 15px;
  }

  body[data-wall-dashboard="true"] .wall-safety-strip {
    padding: 5px;
  }

  body[data-wall-dashboard="true"] .wall-safety-item {
    min-height: 32px;
    padding: 5px 10px;
    gap: 5px;
    font-size: 12px;
  }

  body[data-wall-dashboard="true"] .wall-safety-icon {
    font-size: 15px;
  }
}

@media (max-width: 640px), (orientation: portrait) {
  body[data-wall-dashboard="true"] .family-shell {
    width: min(100% - 14px, 1500px);
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  body[data-wall-dashboard="true"] .family-header {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 8px 2px 14px;
  }

  body[data-wall-dashboard="true"] .family-kicker,
  body[data-wall-dashboard="true"] .family-view-label,
  body[data-wall-dashboard="true"] .family-subtitle {
    display: none;
  }

  body[data-wall-dashboard="true"] .family-header h1 {
    margin: 0;
    font-size: clamp(40px, 13vw, 62px);
    line-height: 0.95;
  }

  body[data-wall-dashboard="true"] .family-header-side {
    justify-items: stretch;
    gap: 8px;
  }

  body[data-wall-dashboard="true"] .family-clock {
    font-size: clamp(44px, 14vw, 68px);
    line-height: 0.95;
  }

  body[data-wall-dashboard="true"] .wall-display-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body[data-wall-dashboard="true"] .wall-display-actions a,
  body[data-wall-dashboard="true"] .wall-display-actions button {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 16px;
    justify-content: center;
  }

  body[data-wall-dashboard="true"] .wall-home-status {
    grid-column: 1 / -1;
    justify-content: center;
  }

  body[data-wall-dashboard="true"] .family-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body[data-wall-dashboard="true"] .routine-card,
  body[data-wall-dashboard="true"] .calendar-card,
  body[data-wall-dashboard="true"] .weather-card,
  body[data-wall-dashboard="true"] .home-card,
  body[data-wall-dashboard="true"] .meal-card,
  body[data-wall-dashboard="true"] .family-tasks-card,
  body[data-wall-dashboard="true"] .system-card,
  body[data-wall-dashboard="true"] .family-card {
    grid-column: 1 / -1 !important;
    min-height: 0 !important;
    padding: 18px;
    border-radius: 24px;
  }

  body[data-wall-dashboard="true"] .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 26px;
  }

  body[data-wall-dashboard="true"] .card-heading h2 {
    font-size: clamp(24px, 7vw, 34px);
  }

  body[data-wall-dashboard="true"] .routine-card-content,
  body[data-wall-dashboard="true"] .routine-panel,
  body[data-wall-dashboard="true"] .routine-copy {
    min-width: 0;
  }

  body[data-wall-dashboard="true"] .routine-panel {
    display: grid;
    gap: 14px;
  }

  body[data-wall-dashboard="true"] .routine-pictogram-frame {
    min-height: 120px;
  }

  body[data-wall-dashboard="true"] .routine-title {
    font-size: clamp(34px, 12vw, 54px);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  body[data-wall-dashboard="true"] .routine-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body[data-wall-dashboard="true"] .routine-actions button,
  body[data-wall-dashboard="true"] .routine-reset,
  body[data-wall-dashboard="true"] .routine-edit-action,
  body[data-wall-dashboard="true"] .routine-switch button {
    min-height: 44px;
    padding: 8px 12px;
  }

  body[data-wall-dashboard="true"] .wall-safety-strip {
    position: static !important;
    width: 100%;
    max-width: 100%;
    margin: 12px 0 0;
    padding: 7px;
    border-radius: 24px;
    box-shadow: none;
    backdrop-filter: none;
  }

  body[data-wall-dashboard="true"] .wall-safety-item {
    flex: 1 1 100%;
    min-height: 38px;
    justify-content: center;
    padding: 7px 10px;
    font-size: 14px;
    white-space: normal;
    text-align: center;
  }

  body[data-wall-dashboard="true"] .wall-safety-icon {
    font-size: 17px;
  }

  body[data-wall-dashboard="true"] .calendar-range-controls {
    margin: 8px 0;
  }

  body[data-wall-dashboard="true"] .calendar-range-controls button {
    min-height: 36px;
    padding: 6px 10px;
  }

  body[data-wall-dashboard="true"] .weather-symbol {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: 36px;
  }

  body[data-wall-dashboard="true"] .weather-temperature {
    font-size: clamp(44px, 13vw, 62px);
  }

  body[data-wall-dashboard="true"] .weather-forecast-item {
    min-height: 78px;
    padding: 10px;
  }
}
