/* Mobile/PWA-only styles. Desktop web styles stay in styles.css. */

@media (max-width: 720px) {
  body.is-mobile {
    background: #fbfbfa;
  }

  body.is-mobile .app-shell {
    min-height: 100svh;
    padding-top: calc(58px + env(safe-area-inset-top, 0px));
    background: #fbfbfa;
  }

  body.is-mobile .topbar {
    height: calc(58px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: none;
    border-bottom: 1px solid rgba(24, 24, 24, 0.06);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
  }

  body.is-mobile .brand-logo {
    max-width: min(164px, 42vw);
    height: 28px;
    transform: none;
  }

  body.is-mobile .hamburger-button {
    left: 14px;
  }

  body.is-mobile .top-actions {
    right: 12px;
  }

  body.is-mobile .top-actions #calendar-toggle {
    display: none;
  }

  body.is-mobile .content {
    width: min(100% - 26px, 520px);
    margin: 24px auto calc(96px + env(safe-area-inset-bottom, 0px));
  }

  body.is-mobile .list-heading {
    display: flex;
    position: relative;
    align-items: center;
    min-height: 36px;
    margin-bottom: 8px;
  }

  body.is-mobile .active-heading {
    justify-content: flex-end;
    min-height: 20px;
  }

  body.is-mobile .trash-heading {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas: "back title clear";
    align-items: center;
    gap: 0 10px;
    justify-content: stretch;
    min-height: 44px;
    margin-bottom: 4px;
  }

  body.is-mobile .list-heading h1 {
    display: block;
    color: #202124;
    font-size: 24px;
    font-weight: 600;
  }

  body.is-mobile .active-heading h1 {
    display: none;
  }

  body.is-mobile .trash-heading h1 {
    grid-area: title;
  }

  body.is-mobile .list-count {
    position: absolute;
    right: 4px;
    color: #8f969b;
    font-size: 13px;
  }

  body.is-mobile .mobile-trash-back {
    position: static;
    grid-area: back;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    color: #202124;
    font-size: 34px;
    line-height: 1;
  }

  body.is-mobile .trash-clear-wrap {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    grid-area: clear;
    justify-self: end;
  }

  body.is-mobile .trash-clear-button {
    color: #c75252;
    font-size: 14px;
  }

  body.is-mobile .trash-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
  }

  body.is-mobile .trash-note {
    margin: 0;
    color: #8d9499;
    font-size: 14px;
    text-align: left;
  }

  body.is-mobile .trash-meta-row .list-count {
    position: static;
    margin-left: auto;
    color: #8f969b;
    font-size: 13px;
    white-space: nowrap;
  }

  body.is-mobile .compact-timeline {
    display: grid;
    gap: 12px;
  }

  body.is-mobile .entry-card {
    position: relative;
    overflow: hidden;
    min-height: 0;
    padding: 18px 18px 16px;
    border: 1px solid rgba(30, 30, 30, 0.06);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(18, 21, 23, 0.045);
  }

  body.is-mobile .entry-meta-line {
    color: #8d9499;
    font-size: 12px;
  }

  body.is-mobile .entry-title {
    margin: 10px 0 6px;
    font-size: 18px;
    line-height: 1.35;
  }

  body.is-mobile .entry-body {
    display: -webkit-box;
    overflow: hidden;
    color: #2b2b2b;
    font-size: 16px;
    line-height: 1.68;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
  }

  body.is-mobile .entry-read-more-hint {
    display: none;
  }

  body.is-mobile .entry-card.is-entry-incomplete .entry-body {
    position: relative;
  }

  body.is-mobile .entry-card.is-entry-incomplete .entry-read-more-hint {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    color: #2f88a7;
    font-size: 13px;
    font-weight: 600;
  }

  body.is-mobile .entry-card.is-entry-incomplete .entry-read-more-hint::after {
    content: "›";
    margin-left: 3px;
    font-size: 18px;
    line-height: 1;
  }

  body.is-mobile .entry-bottom-row {
    align-items: flex-end;
    gap: 10px;
    margin-top: 14px;
  }

  body.is-mobile .entry-foot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-width: 0;
    color: #969da2;
    font-size: 12px;
  }

  body.is-mobile .entry-count-meta {
    display: none;
  }

  body.is-mobile .entry-deleted-meta {
    flex-basis: 100%;
    color: #a3a8ad;
  }

  body.is-mobile .mobile-entry-menu-button {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(247, 249, 249, 0.96);
    color: #7f878d;
    font-size: 16px;
    letter-spacing: -1px;
    box-shadow: inset 0 0 0 1px rgba(35, 39, 41, 0.06);
  }

  body.is-mobile .entry-actions {
    display: none;
  }

  body.is-mobile .entry-card.is-swiped .entry-main {
    padding-right: 0;
  }

  body.is-mobile .fab {
    right: 18px;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    left: auto;
    width: 56px;
    height: 56px;
    transform: none;
    box-shadow: 0 12px 28px rgba(84, 168, 202, 0.28);
  }

  body.is-mobile .auth-page {
    min-height: 100svh;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(28px + env(safe-area-inset-bottom, 0px));
    background:
      radial-gradient(circle at 50% 4%, rgba(0, 0, 0, 0.04), transparent 28%),
      #fff;
  }

  body.is-mobile .auth-card {
    width: min(100%, 390px);
    padding: 30px 24px 28px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.is-mobile .auth-title {
    margin-bottom: 38px;
  }

  body.is-mobile .auth-logo {
    height: 96px;
  }

  body.is-mobile .auth-card label {
    color: #636b70;
    font-size: 14px;
  }

  body.is-mobile .auth-card input {
    height: 52px;
    border-color: #e3e5e6;
    border-radius: 8px;
    background: #fbfbfa;
    font-size: 17px;
  }

  body.is-mobile .primary-button {
    height: 52px;
    border-radius: 8px;
    background: #3f9bbd;
  }

  body.is-mobile .auth-passkey-note,
  body.is-mobile .auth-privacy-note {
    display: block;
    margin: 14px 0 0;
    color: #858d92;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
  }

  body.is-mobile .auth-privacy-note {
    margin-top: 6px;
    color: #adb3b7;
  }

  body.is-mobile .editor-shell {
    min-height: 100svh;
    padding-top: calc(128px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    background: #fff;
  }

  body.is-mobile .editor-topbar {
    height: calc(128px + env(safe-area-inset-top, 0px));
    overflow: hidden;
    padding: calc(48px + env(safe-area-inset-top, 0px)) 18px 10px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    border-bottom: 1px solid rgba(24, 24, 24, 0.06);
    box-shadow: none;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(250, 252, 251, 0.94) 58%, rgba(239, 247, 246, 0.92) 100%);
    backdrop-filter: blur(20px);
  }

  body.is-mobile .editor-topbar::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 70px;
    pointer-events: none;
    background:
      radial-gradient(ellipse at 20% 100%, rgba(84, 168, 202, 0.12), transparent 48%),
      radial-gradient(ellipse at 78% 108%, rgba(80, 113, 93, 0.12), transparent 44%),
      linear-gradient(165deg, transparent 0 58%, rgba(42, 76, 62, 0.08) 59% 60%, transparent 61%),
      linear-gradient(172deg, transparent 0 66%, rgba(42, 76, 62, 0.07) 67% 68%, transparent 69%);
  }

  body.is-mobile .editor-topbar > * {
    position: relative;
    z-index: 1;
  }

  body.is-mobile .back-button {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 13px;
    width: 42px;
    height: 42px;
    background-size: 28px 28px;
  }

  body.is-mobile .save-fab {
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: 18px;
    bottom: auto;
    width: 52px;
    height: 42px;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: #2f88a7;
    font-size: 0;
  }

  body.is-mobile .save-fab::after {
    content: "保存";
    font-size: 16px;
    font-weight: 600;
  }

  body.is-mobile .editor-date {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    transform: none;
    color: #1f2326;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    transform: translateX(-50%);
    white-space: nowrap;
  }

  body.is-mobile .editor-meta-row {
    display: grid;
    position: absolute;
    right: 18px;
    bottom: 10px;
    left: 18px;
    grid-template-columns: 1fr 1fr 1fr;
    width: auto;
    max-width: none;
    margin: 0 auto;
    gap: 8px;
  }

  body.is-mobile .editor-meta-row > * {
    position: relative;
    min-width: 0;
  }

  body.is-mobile .editor-meta-row > * + *::before {
    content: none;
  }

  body.is-mobile .mood-picker-wrap,
  body.is-mobile .location-picker-wrap {
    margin: 0;
  }

  body.is-mobile .mood-trigger,
  body.is-mobile .location-trigger,
  body.is-mobile .mobile-editor-weather {
    display: inline-flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 44px;
    border: 1px solid rgba(30, 30, 30, 0.06);
    border-radius: 12px;
    background: #f7f9f9;
    color: #4b5358;
    font-size: 12px;
    box-shadow: 0 4px 14px rgba(18, 21, 23, 0.03);
  }

  body.is-mobile .mood-trigger {
    padding: 0;
  }

  body.is-mobile .mood-trigger .mood-face {
    width: 18px;
    height: 18px;
  }

  body.is-mobile .mobile-meta-label,
  body.is-mobile .mobile-meta-value,
  body.is-mobile .location-pin-icon {
    display: block;
  }

  body.is-mobile .mobile-meta-label {
    margin-top: 0;
    color: #72797e;
    font-size: 10px;
    line-height: 1.2;
  }

  body.is-mobile .mobile-meta-value {
    margin-top: 2px;
    overflow: hidden;
    color: #30363a;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.is-mobile .location-pin-icon {
    display: none;
    color: #30363a;
    font-size: 25px;
    line-height: 1;
  }

  body.is-mobile .location-trigger {
    max-width: none;
    padding: 0 8px;
  }

  body.is-mobile .mobile-editor-weather {
    display: inline-flex;
    max-width: none;
    margin: 0;
    padding: 0 8px;
    text-align: center;
  }

  body.is-mobile .editor {
    width: min(100% - 32px, 520px);
    margin-top: 6px;
  }

  body.is-mobile .body-input {
    min-height: calc(100svh - 252px);
    padding: 22px 4px 16px;
    color: #202124;
    font-size: 18px !important;
    line-height: 1.76;
  }

  body.is-mobile .editor-image-strip {
    margin: 8px 0 18px;
  }

  body.is-mobile .editor-image-grid {
    gap: 10px;
  }

  body.is-mobile .editor-image-thumb,
  body.is-mobile .editor-image-add {
    width: 94px;
    height: 94px;
    border-radius: 8px;
  }

  body.is-mobile .editor-image-add {
    display: none;
  }

  body.is-mobile .editor-footer {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 0 14px;
  }

  body.is-mobile .editor-bottom-panel {
    justify-content: space-between;
    flex-wrap: nowrap;
    width: min(100%, 520px);
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(18, 21, 23, 0.12);
  }

  body.is-mobile .mobile-image-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(84, 168, 202, 0.12);
    color: #2f88a7;
    font-size: 14px;
  }

  body.is-mobile .editor-bottom-panel #font-family,
  body.is-mobile .editor-bottom-panel .tool-button,
  body.is-mobile .editor-bottom-panel .weather-select,
  body.is-mobile .editor-bottom-panel span:not(#count):not(.editor-delete-wrap),
  body.is-mobile .editor-bottom-panel .divider {
    display: none;
  }

  body.is-mobile .editor-bottom-panel #count {
    margin-left: auto;
    color: #92999e;
    font-size: 13px;
  }

  body.is-mobile .editor-delete-link {
    color: #c75252;
    font-size: 13px;
  }

  body.is-mobile .editor-delete-wrap {
    display: none;
  }

  body.is-mobile .editor-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(18, 21, 23, 0.26);
    backdrop-filter: blur(2px);
  }

  body.is-mobile .editor-bottom-sheet {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    z-index: 1201;
    padding: 10px 12px 12px;
    border: 1px solid rgba(30, 30, 30, 0.06);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 54px rgba(18, 21, 23, 0.2);
  }

  body.is-mobile .mobile-weather-sheet {
    max-height: min(72svh, 520px);
    overflow: auto;
  }

  body.is-mobile .mobile-mood-sheet {
    max-height: min(72svh, 520px);
    overflow: auto;
  }

  body.is-mobile .editor-leave-sheet {
    text-align: center;
  }

  body.is-mobile .editor-bottom-sheet-grip {
    width: 38px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 99px;
    background: #d8dee1;
  }

  body.is-mobile .editor-bottom-sheet-title {
    color: #1f2326;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
  }

  body.is-mobile .editor-bottom-sheet-message {
    margin: 7px 18px 14px;
    color: #7d858a;
    font-size: 13px;
    line-height: 1.5;
  }

  body.is-mobile .weather-sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0 10px;
  }

  body.is-mobile .mood-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0 10px;
  }

  body.is-mobile .weather-sheet-option,
  body.is-mobile .mood-sheet-option,
  body.is-mobile .weather-sheet-clear,
  body.is-mobile .editor-sheet-cancel,
  body.is-mobile .editor-leave-save,
  body.is-mobile .editor-leave-discard {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
  }

  body.is-mobile .weather-sheet-option {
    background: #f4f7f7;
    color: #283033;
  }

  body.is-mobile .mood-sheet-option {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 66px;
    background: #f4f7f7;
    color: #283033;
    font-size: 12px;
  }

  body.is-mobile .mood-sheet-option .mood-face {
    width: 22px;
    height: 22px;
  }

  body.is-mobile .weather-sheet-option.selected,
  body.is-mobile .mood-sheet-option.selected {
    background: #54a8ca;
    color: #fff;
  }

  body.is-mobile .weather-sheet-clear {
    margin-top: 2px;
    background: #edf4f6;
    color: #2f88a7;
  }

  body.is-mobile .editor-sheet-cancel {
    margin-top: 8px;
    background: #f3f4f4;
    color: #252b2e;
  }

  body.is-mobile .editor-leave-actions {
    display: grid;
    gap: 8px;
    margin-top: 14px;
  }

  body.is-mobile .editor-leave-save {
    background: #54a8ca;
    color: #fff;
  }

  body.is-mobile .editor-leave-discard {
    background: #fff0f0;
    color: #c75252;
  }

  body.is-mobile .location-panel {
    top: 34px;
    right: -92px;
  }

  body.is-mobile .mood-panel {
    display: none;
  }

  body.is-mobile .lock-screen {
    min-height: 100svh;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(28px + env(safe-area-inset-bottom, 0px));
    background: #fbfbfa;
  }

  body.is-mobile .lock-reset-link {
    color: #8b9298;
    text-align: center;
  }

  body.is-mobile .lock-card {
    min-height: 0;
    padding: 44px 24px 34px;
    border: 1px solid rgba(30, 30, 30, 0.06);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(18, 21, 23, 0.06);
  }

  body.is-mobile .lock-title {
    display: block;
    margin-bottom: 26px;
    color: #202124;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
  }

  body.is-mobile .lock-icon {
    display: none;
  }

  body.is-mobile .face-id-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 0 28px;
    background: transparent;
    color: #202124;
    font-size: 18px;
    font-weight: 600;
  }

  body.is-mobile .face-id-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    border: 1px solid #dde3e6;
    border-radius: 50%;
    color: #2f88a7;
  }

  body.is-mobile .face-id-glyph svg {
    width: 48px;
    height: 48px;
  }

  body.is-mobile .lock-pin-label {
    display: block;
    margin-bottom: 14px;
    color: #7f878d;
    font-size: 14px;
    text-align: center;
  }

  body.is-mobile .lock-submit {
    margin-top: 22px;
  }

  body.is-mobile .viewer-shell {
    min-height: 100svh;
    padding: calc(70px + env(safe-area-inset-top, 0px)) 18px calc(28px + env(safe-area-inset-bottom, 0px));
    background: #fbfbfa;
  }

  body.is-mobile .viewer-back-button {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 14px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    height: 42px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 22px rgba(26, 30, 33, 0.08);
    color: #202124;
    font-size: 28px;
  }

  body.is-mobile .viewer-back-label {
    display: inline-block;
    color: #202124;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
  }

  body.is-mobile .viewer-article {
    width: 100%;
    max-width: none;
    padding: 24px 18px 28px;
    border-radius: 8px;
    box-shadow: 0 8px 26px rgba(22, 24, 26, 0.06);
  }

  body.is-mobile .mobile-undo-toast {
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
    border-radius: 14px;
    background: rgba(26, 28, 30, 0.94);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
    color: #fff;
    font-size: 15px;
  }

  body.is-mobile .mobile-undo-toast button {
    border: 0;
    background: transparent;
    color: #9bd7eb;
    font: inherit;
    font-weight: 700;
  }

  body.is-mobile .mobile-list-notice {
    position: fixed;
    right: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 66;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(31, 42, 43, 0.9);
    color: #fff;
    font-size: 13px;
    transform: translateX(50%);
  }

  body.is-mobile .mobile-action-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 64;
    background: rgba(21, 24, 25, 0.26);
  }

  body.is-mobile .mobile-action-sheet {
    position: fixed;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    z-index: 65;
    padding: 12px 12px 14px;
    border-radius: 20px;
    background: #1f2a2b;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.28);
    color: #fff;
  }

  body.is-mobile .mobile-clear-trash-sheet {
    background: #1f2a2b;
  }

  body.is-mobile .mobile-action-sheet-grip {
    width: 42px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
  }

  body.is-mobile .mobile-action-sheet-title {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
  }

  body.is-mobile .mobile-action-sheet-subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    text-align: center;
  }

  body.is-mobile .mobile-sheet-actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }

  body.is-mobile .mobile-sheet-action {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
  }

  body.is-mobile .mobile-sheet-action.pin-action {
    background: #2f7d78;
  }

  body.is-mobile .mobile-sheet-action.danger-action {
    background: #d94a3d;
  }

  body.is-mobile .mobile-sheet-action.cancel-action {
    background: rgba(255, 255, 255, 0.92);
    color: #202425;
  }

  body.is-mobile .action-popover {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    z-index: 70;
    width: auto;
    padding: 18px 16px 14px;
    border-radius: 16px;
    text-align: center;
    transform: none;
  }

  body.is-mobile .action-popover::before {
    display: none;
  }

  body.is-mobile .delete-popover-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
  }
}
