@media (min-width: 768px) {
  .md\:text-5xl {
    font-size: clamp(2.5rem, 5vw, 3.8rem);
  }

  .md\:text-6xl {
    font-size: clamp(3rem, 6vw, 4.4rem);
  }
}

@media (min-width: 901px) and (max-width: 2100px) {
  :root {
    --container: 980px;
  }

  .max-w-3xl {
    max-width: 720px;
  }

  header {
    gap: 18px;
    padding-top: 2px;
  }

  .header-title {
    top: 18px;
  }

  .site-title {
    font-size: clamp(1.12rem, 2.1vw, 1.95rem);
  }

  #weather {
    gap: 10px;
  }

  #weather .text-2xl {
    font-size: clamp(1.3rem, 1.45vw, 1.75rem);
  }

  #weather .font-medium,
  #clock {
    font-size: clamp(1.55rem, 2.7vw, 2.3rem);
  }

  #weather .text-xs,
  #date {
    font-size: clamp(0.82rem, 0.9vw, 0.94rem);
  }

  section.flex-1 {
    margin-top: 0.35rem;
  }

  #searchArea {
    max-width: 800px;
    padding: 16px 20px 18px;
    border-radius: 18px;
  }

  .search-input-wrap {
    min-height: 50px;
    border-radius: 25px;
  }

  .search-engine-indicator {
    left: 12px;
    width: 30px;
    height: 30px;
  }

  .search-engine-icon {
    width: 17px;
    height: 17px;
  }

  .search-input {
    width: calc(100% - 64px);
    min-height: 50px;
    padding: 13px 15px 11px 52px;
    border-radius: 25px 0 0 25px;
    font-size: 0.96rem;
  }

  .search-input.is-empty-single-line {
    padding-top: 14px;
    padding-bottom: 10px;
  }

  .search-line-numbers {
    left: 46px;
    width: 22px;
  }

  .search-line-numbers-content {
    padding-top: 13px;
    padding-bottom: 11px;
    font-size: 0.76rem;
    line-height: calc(0.96rem * 1.35);
  }

  .search-input.has-line-numbers {
    width: calc(100% - 64px);
    padding-left: 76px;
  }

  .search-hint {
    right: 10px;
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .search-redirect-notice {
    gap: 12px;
    margin-top: 8px;
    padding: 10px 12px;
  }

  .search-redirect-copy {
    font-size: 0.9rem;
  }

  .search-redirect-button {
    min-width: 88px;
    height: 34px;
    padding: 0 12px;
    font-size: 0.9rem;
  }

  #engineButtons {
    margin-top: 12px;
    gap: 0.6rem;
  }

  .engine-btn {
    gap: 8px;
    padding: 7px 11px;
  }

  .engine-btn.active {
    padding: 6px 10px;
  }

  .engine-btn img {
    width: 17px;
    height: 17px;
  }

  .engine-btn span {
    font-size: 0.95rem;
  }

  #quickLinks {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.9rem;
  }

  .group-card {
    padding: 15px 15px 11px;
    border-radius: 15px;
  }

  .group-card h3 {
    font-size: 0.96rem;
  }

  .group-icon {
    width: 36px;
    height: 36px;
    font-size: 0.94rem;
  }

  .link-item {
    gap: 10px;
    padding: 9px 11px;
  }

  .link-title {
    font-size: 0.9rem;
  }

  .link-desc {
    font-size: 0.78rem;
  }

  footer {
    margin-top: 1.5rem;
  }

  .theme-switcher,
  .search-delay-settings {
    bottom: 16px;
  }

  .theme-switcher {
    left: 16px;
  }

  .search-delay-settings {
    right: 16px;
  }

  .theme-switcher-toggle {
    min-height: 38px;
    padding: 0 12px 0 9px;
  }

  .theme-switcher-badge {
    width: 22px;
    height: 22px;
  }

  .search-delay-toggle {
    width: 42px;
    height: 42px;
  }

  .search-delay-panel {
    width: 220px;
  }
}

@media (max-width: 900px) {
  header {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "weather title time";
    align-items: center;
    gap: 14px 18px;
    padding: 4px 2px 0;
  }

  .header-title {
    --header-title-base-shift: 0px;
    position: static;
    grid-area: title;
    min-width: 0;
    justify-content: center;
    padding-top: 8px;
    pointer-events: auto;
  }

  .site-title {
    font-size: clamp(1.35rem, 3.6vw, 2.1rem);
    white-space: nowrap;
  }

  #weather {
    grid-area: weather;
    margin-top: 0;
  }

  header .text-right {
    grid-area: time;
    align-items: flex-end;
    text-align: right;
  }

  #date {
    white-space: nowrap;
  }

  header.header-date-stacked #date {
    display: inline-block;
    max-width: 10ch;
    white-space: normal;
    line-height: 1.05;
    text-align: right;
  }

  header.header-date-stacked:not(.header-title-stacked) .header-title {
    padding-top: 14px;
  }

  header.header-date-stacked:not(.header-title-stacked) .text-right {
    transform: translateY(-4px);
  }

  header.header-date-stacked:not(.header-title-stacked) #date {
    margin-top: 0.15rem;
  }

  header.header-title-stacked {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "weather time"
      "title title";
    align-items: start;
    gap: 12px 18px;
  }

  header.header-title-stacked .header-title {
    padding-top: 8px;
  }

  header.header-title-stacked .site-title {
    width: 100%;
    text-align: center;
  }

  .-mt-20 {
    margin-top: 0;
  }

  #searchArea {
    padding: 20px 22px;
    border-radius: 18px;
  }
}

@media (max-width: 640px) {
  .max-w-6xl {
    width: min(calc(100% - 20px), var(--container));
  }

  .px-4 {
    padding-left: 16px;
    padding-right: 16px;
  }

  .py-8 {
    padding-top: 18px;
    padding-bottom: 24px;
  }

  header {
    margin-bottom: 1.75rem;
    padding: 0;
  }

  #weather {
    min-width: 0;
    margin-top: 0;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 10px;
  }

  .header-title {
    --header-title-base-shift: 0px;
    position: static;
    justify-content: center;
    padding-top: 8px;
    pointer-events: auto;
  }

  .site-title {
    font-size: clamp(1.18rem, 5.8vw, 1.45rem);
  }

  .text-right {
    min-width: 0;
    text-align: right;
  }

  #searchArea {
    padding: 18px 16px;
  }

  .search-input {
    min-height: 56px;
    padding-left: 58px;
    padding-right: 58px;
    font-size: 1.08rem;
    width: 100%;
    border-radius: 28px;
  }

  .search-line-numbers {
    left: 52px;
    width: 22px;
  }

  .search-line-numbers-content {
    padding-top: 16px;
    padding-bottom: 16px;
    font-size: 0.8rem;
    line-height: calc(1.08rem * 1.35);
  }

  .search-input.has-line-numbers {
    width: 100%;
    padding-left: 82px;
  }

  .search-engine-indicator {
    left: 12px;
    width: 34px;
    height: 34px;
  }

  .search-hint {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 40px;
    margin-top: 0;
  }

  .search-redirect-notice {
    flex-direction: column;
    align-items: stretch;
  }

  .search-redirect-button {
    width: 100%;
  }

  #engineButtons {
    justify-content: flex-start;
  }

  .engine-btn {
    width: calc(50% - 4px);
    justify-content: center;
  }

  .theme-switcher {
    left: 10px;
    bottom: 10px;
  }

  .search-delay-settings {
    right: 10px;
    bottom: 10px;
  }

  .theme-switcher-panel {
    bottom: calc(100% + 8px);
    width: min(180px, calc(100vw - 20px));
  }

  .search-delay-panel {
    bottom: calc(100% + 8px);
    width: min(224px, calc(100vw - 20px));
  }

  .search-delay-card {
    gap: 7px;
    padding: 10px;
    border-radius: 14px;
  }

  .search-delay-title {
    font-size: 0.84rem;
  }

  .search-delay-group {
    gap: 8px;
  }

  .search-delay-input {
    width: 64px;
    height: 32px;
    padding: 0 8px;
    border-radius: 9px;
  }

  .search-delay-unit {
    font-size: 0.8rem;
  }

  .search-delay-help {
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .search-setting-toggle {
    gap: 8px;
  }

  .search-setting-copy {
    gap: 1px;
  }

  .search-setting-slider {
    width: 34px;
    height: 20px;
  }

  .search-setting-slider::before {
    width: 14px;
    height: 14px;
  }

  .search-setting-input:checked + .search-setting-slider::before {
    transform: translateX(14px);
  }

  .group-card {
    padding: 16px 14px 12px;
  }

  footer {
    margin-top: 2rem;
    letter-spacing: 0.08em;
  }
}
