:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #666d75;
  --paper: #f6f4ef;
  --surface: #ffffff;
  --line: #d9dce1;
  --calc: #1f2328;
  --calc-panel: #2b3037;
  --calc-key: #3b424c;
  --calc-muted: #c6ccd3;
  --accent: #1f7a6d;
  --accent-strong: #155f55;
  --warm: #cc633f;
  --blue: #3562a6;
  --danger: #b63d32;
  --shadow: 0 24px 60px rgb(20 26 34 / 16%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
}

.calculator-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgb(255 255 255 / 52%), rgb(255 255 255 / 0%) 44%),
    #dfe2df;
}

.calculator {
  width: min(100%, 390px);
  background: var(--calc);
  color: #f8fafc;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.calc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  color: #aeb6c2;
  font-size: 0.78rem;
}

.calc-brand {
  letter-spacing: 0;
}

.calc-indicator {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #596272;
}

.calc-display-wrap {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  padding: 22px 4px 18px;
  overflow: hidden;
}

.calc-history {
  min-height: 22px;
  max-width: 100%;
  color: #9aa3af;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-display {
  width: 100%;
  color: #fff;
  font-size: clamp(2.4rem, 12vw, 4.2rem);
  line-height: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.calc-key {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  background: var(--calc-key);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 70ms ease,
    background 70ms ease;
}

.calc-key:active {
  transform: scale(0.97);
}

.calc-key-muted {
  background: var(--calc-muted);
  color: #1d2229;
}

.calc-key-op,
.calc-key-equals {
  background: #d58832;
  color: #101419;
  font-weight: 700;
}

.calc-key-zero {
  grid-column: span 2;
  aspect-ratio: auto;
  border-radius: 999px;
  text-align: left;
  padding-left: 30px;
}

.blog-screen {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 88% 8%, rgb(209 142 104 / 15%), transparent 28rem),
    linear-gradient(180deg, #fbfaf6 0, #f5f1e9 36rem, #eef1f2 100%);
}

.blog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) clamp(18px, 4vw, 42px) 18px;
  border-bottom: 1px solid rgb(32 33 36 / 7%);
  background: rgb(251 250 246 / 84%);
  backdrop-filter: blur(20px) saturate(150%);
}

.blog-kicker {
  margin: 0 0 4px;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.blog-header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.header-actions,
.form-actions,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.current-user-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgb(31 122 109 / 28%);
  border-radius: 999px;
  background: rgb(31 122 109 / 10%);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.blog-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 42px) 72px;
}

.journal-overview {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.7fr);
  align-items: end;
  gap: clamp(28px, 5vw, 72px);
  margin-bottom: 22px;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgb(65 58 49 / 9%);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0, rgb(201 102 63 / 18%), transparent 45%),
    linear-gradient(135deg, #fffdf8, #f3ece1);
  box-shadow: 0 28px 70px rgb(68 59 48 / 10%);
}

.journal-overview::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -100px;
  bottom: -130px;
  border: 42px solid rgb(31 122 109 / 8%);
  border-radius: 50%;
}

.overview-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.overview-eyebrow,
.section-heading p {
  margin: 0 0 8px;
  color: var(--warm);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.overview-copy h2 {
  max-width: 12em;
  margin: 0;
  font-family: Georgia, "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.overview-copy > p:last-child {
  max-width: 38rem;
  margin: 20px 0 0;
  color: #69635b;
  font-size: clamp(0.94rem, 2vw, 1.05rem);
  line-height: 1.8;
}

.overview-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgb(65 58 49 / 10%);
  border-radius: 18px;
  background: rgb(255 255 255 / 58%);
  backdrop-filter: blur(12px);
}

.overview-stats > div {
  display: grid;
  gap: 5px;
  padding: 20px 16px;
  text-align: center;
}

.overview-stats > div + div {
  border-left: 1px solid rgb(65 58 49 / 10%);
}

.overview-stats strong {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.overview-stats span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 180px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 28px;
  padding: 14px;
  border: 1px solid rgb(32 33 36 / 8%);
  border-radius: 18px;
  background: rgb(255 255 255 / 72%);
  box-shadow: 0 12px 34px rgb(31 37 44 / 6%);
  backdrop-filter: blur(14px);
}

label,
.search-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 170px;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(31 122 109 / 14%);
}

.primary-button,
.secondary-button,
.danger-button,
.file-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.secondary-button,
.file-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff;
  border-color: rgb(182 61 50 / 45%);
  color: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.2rem;
}

.notification-button {
  position: relative;
}

.notification-button.has-unread {
  border-color: rgb(182 61 50 / 38%);
  background: rgb(182 61 50 / 7%);
}

.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.composer {
  margin-bottom: 32px;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid rgb(32 33 36 / 9%);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 65px rgb(30 36 42 / 10%);
}

.composer-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.5fr)
    minmax(136px, 0.7fr)
    minmax(120px, 0.6fr)
    minmax(120px, 0.6fr);
  gap: 12px;
  margin-bottom: 12px;
}

.media-composer {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.media-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.media-heading-row h3,
.media-heading-row p {
  margin: 0;
}

.media-heading-row h3 {
  font-size: 0.98rem;
}

.media-heading-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.capture-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgb(31 122 109 / 34%);
  border-radius: 8px;
  background: #fff;
}

.capture-preview {
  width: min(100%, 640px);
  max-height: 58vh;
  margin: 0 auto;
  border-radius: 8px;
  background: #15191d;
  object-fit: contain;
}

.capture-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.capture-status {
  font-weight: 700;
}

.recording-timer {
  margin-right: auto;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.upload-status {
  min-height: 1.3em;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.draft-status {
  min-height: 1.2em;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-progress-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.upload-progress-wrap progress {
  width: 100%;
  accent-color: var(--accent);
}

.selected-files,
.existing-files {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.selected-files p,
.existing-files p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.pending-file-list {
  display: grid;
  gap: 8px;
}

.pending-file {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pending-file > img,
.pending-file > video {
  width: 84px;
  height: 64px;
  border-radius: 6px;
  background: #d8dde3;
  object-fit: cover;
}

.pending-file > audio {
  width: min(100%, 260px);
  height: 42px;
}

.pending-file > .file-icon {
  min-height: 64px;
}

.pending-file-name {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.existing-file-list {
  display: grid;
  gap: 8px;
}

.existing-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.existing-file a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.journal-sections {
  display: grid;
  gap: 44px;
}

.journal-section {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.55rem, 3.5vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.025em;
}

.section-heading p {
  margin-bottom: 5px;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.posts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.post-card {
  position: relative;
  overflow: hidden;
  display: grid;
  min-width: 0;
  border: 1px solid rgb(32 33 36 / 8%);
  border-radius: 24px;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 20px 50px rgb(28 34 40 / 8%);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 70px rgb(28 34 40 / 12%);
}

.post-card-featured {
  grid-column: 1 / -1;
}

.post-card-featured.has-attachments {
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  min-height: 430px;
}

.post-content {
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
  padding: clamp(22px, 4vw, 34px);
}

.post-card-featured.has-attachments > .post-content {
  grid-column: 1;
  grid-row: 1;
}

.post-card-featured.has-attachments > .attachment-grid {
  grid-column: 2;
  grid-row: 1;
}

.post-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 18px;
}

.post-card h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.post-date {
  display: grid;
  min-width: 58px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.post-date strong {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
}

.post-date span {
  margin-top: 7px;
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.mood-pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: rgb(204 99 63 / 10%);
  color: #9d472b;
  font-weight: 700;
}

.edited-pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: rgb(120 120 120 / 12%);
  color: var(--muted);
  font-weight: 700;
  font-style: italic;
}

.published-time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.author-pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 800;
}

.author-alice {
  background: rgb(31 122 109 / 13%);
  color: var(--accent-strong);
}

.author-bob {
  background: rgb(204 99 63 / 15%);
  color: #9d472b;
}

.author-owner {
  background: rgb(70 81 95 / 12%);
  color: #46515f;
}

.post-body {
  margin: 0;
  max-width: 70ch;
  color: #45484d;
  font-size: 0.98rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-actions {
  display: flex;
  gap: 8px;
  align-self: end;
  padding-top: 4px;
}

.post-actions button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.post-actions .delete-post {
  color: var(--danger);
  border-color: rgb(182 61 50 / 34%);
}

.post-conversation {
  display: grid;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.read-receipts {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.read-receipts.is-read {
  color: #54705f;
}

.reaction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 52px;
  min-height: 38px;
  padding: 5px 11px;
  border: 1px solid rgb(32 33 36 / 10%);
  border-radius: 999px;
  background: rgb(248 247 243 / 88%);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.reaction-button:hover {
  transform: translateY(-1px);
  border-color: rgb(204 99 63 / 30%);
}

.reaction-button.is-active {
  border-color: rgb(204 99 63 / 34%);
  background: rgb(204 99 63 / 12%);
  color: #903f29;
  box-shadow: inset 0 0 0 1px rgb(204 99 63 / 8%);
}

.reaction-button span:first-child {
  font-size: 1.1rem;
}

.reaction-button span:last-child {
  min-width: 1ch;
  font-size: 0.78rem;
  font-weight: 800;
}

.comments-block {
  display: grid;
  gap: 12px;
}

.comments-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
}

.comments-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.comment-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.76rem;
  font-weight: 900;
}

.comment-copy {
  min-width: 0;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgb(245 245 241 / 92%);
}

.comment-copy > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.comment-copy strong {
  font-size: 0.8rem;
}

.comment-copy time {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.comment-copy p {
  margin: 4px 0 0;
  color: #4a4d51;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-delete {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}

.comment-delete:hover {
  background: rgb(182 61 50 / 10%);
  color: var(--danger);
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.comment-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 78%);
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
}

.comment-form textarea:focus {
  outline: 2px solid rgb(204 99 63 / 18%);
  border-color: rgb(204 99 63 / 38%);
}

.comment-form button {
  align-self: start;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.comment-status {
  grid-column: 1 / -1;
  min-height: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  padding: 0 22px 22px;
}

.post-card-featured.has-attachments .attachment-grid {
  height: 100%;
  padding: 0;
}

.image-gallery.attachment-count-1 {
  grid-template-columns: 1fr;
}

.image-gallery.attachment-count-3 .attachment:first-child {
  grid-row: span 2;
}

.attachment {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  min-height: 150px;
  border: 0;
  border-radius: 12px;
  background: #e9ecec;
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
}

.attachment img,
.attachment video {
  width: 100%;
  height: 100%;
  min-height: 180px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 9px;
  background: #d8dde3;
}

.attachment img {
  object-fit: contain;
}

.attachment audio {
  width: 100%;
  min-height: 54px;
}

.attachment-download {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.post-card-featured.has-attachments .attachment,
.post-card-featured.has-attachments .attachment > a:first-child,
.post-card-featured.has-attachments .attachment-preview-button,
.post-card-featured.has-attachments .attachment img,
.post-card-featured.has-attachments .attachment video {
  height: 100%;
  min-height: 100%;
}

.post-card-featured.has-attachments .attachment,
.post-card-featured.has-attachments .attachment img,
.post-card-featured.has-attachments .attachment video {
  border-radius: 0;
}

.video-attachment .attachment-download {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  overflow: hidden;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgb(18 22 26 / 70%);
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.image-attachment .attachment-download {
  display: none;
}

.file-icon {
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 6px;
  background: #e7ebef;
  color: #46515f;
  font-size: 0.82rem;
  font-weight: 800;
}

.archive-list {
  display: grid;
  gap: 12px;
}

.month-group {
  border: 1px solid rgb(32 33 36 / 8%);
  border-radius: 20px;
  background: rgb(255 255 255 / 68%);
  overflow: hidden;
  box-shadow: 0 14px 38px rgb(28 34 40 / 5%);
}

.month-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  cursor: pointer;
  font-weight: 800;
}

.month-group summary span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.month-group .posts-list {
  padding: 2px 18px 18px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 6px;
  border: 1px dashed #bbc2ca;
  border-radius: 8px;
  background: rgb(255 255 255 / 72%);
  padding: 28px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.settings-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: min(88dvh, 900px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgb(18 22 27 / 45%);
}

.settings-dialog form {
  display: grid;
  gap: 16px;
  padding: 18px;
  overflow-y: auto;
}

.notifications-dialog {
  width: min(560px, calc(100% - 28px));
}

.notifications-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.notification-summary,
.notification-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: min(60dvh, 560px);
  overflow-y: auto;
}

.notification-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.notification-item.is-unread {
  border-color: rgb(31 122 109 / 32%);
  background: rgb(31 122 109 / 7%);
}

.notification-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.notification-item-heading strong {
  font-size: 0.9rem;
}

.notification-item-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.notification-item-body {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-footer {
  display: flex;
  justify-content: flex-end;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
}

.settings-actions {
  align-items: stretch;
}

.account-status,
.settings-note,
.settings-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.account-secret-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-heading h3,
.advanced-settings summary {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 800;
}

.trash-list {
  display: grid;
  gap: 8px;
}

.trash-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trash-item > div:first-child {
  display: grid;
  gap: 3px;
}

.trash-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.trash-actions {
  display: flex;
  gap: 8px;
}

.advanced-settings {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.advanced-settings summary {
  cursor: pointer;
}

.advanced-settings .settings-actions {
  margin-top: 12px;
}

.status-line {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 28px;
}

.attachment-preview-button {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.image-viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  background: rgb(8 10 12 / 96%);
  color: #fff;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.image-viewer::backdrop {
  background: #080a0c;
}

.image-viewer[open] {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
}

.image-viewer-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 4px 8px;
}

.image-viewer-toolbar button,
.image-viewer-nav {
  width: 44px;
  height: 44px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  color: #fff;
  font-size: 1.8rem;
}

.image-viewer figure {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.image-viewer img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  touch-action: pinch-zoom;
}

.image-viewer figcaption {
  overflow: hidden;
  padding: 10px 8px 2px;
  color: rgb(255 255 255 / 76%);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer-prev {
  grid-column: 1;
  grid-row: 2;
}

.image-viewer-next {
  grid-column: 3;
  grid-row: 2;
}

.update-banner {
  position: fixed;
  z-index: 1000;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(420px, calc(100% - 32px));
  margin-left: auto;
  padding: 12px 14px;
  border-radius: 14px;
  background: #202124;
  color: #fff;
  box-shadow: var(--shadow);
}

.update-banner button {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #202124;
  padding: 8px 14px;
  font-weight: 800;
}

@media (max-width: 680px) {
  .calculator {
    padding: 16px;
  }

  .calc-pad {
    gap: 10px;
  }

  .calc-key {
    font-size: 1.3rem;
  }

  .blog-header {
    align-items: flex-start;
  }

  .blog-main {
    padding-top: 16px;
  }

  .journal-overview {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 26px 22px;
    border-radius: 22px;
  }

  .overview-copy h2 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .overview-stats > div {
    padding: 16px 8px;
  }

  .toolbar,
  .composer-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    border-radius: 16px;
  }

  .posts-list,
  .post-card-featured.has-attachments {
    grid-template-columns: 1fr;
  }

  .post-card {
    border-radius: 20px;
  }

  .post-card-featured.has-attachments > .post-content,
  .post-card-featured.has-attachments > .attachment-grid {
    grid-column: 1;
    grid-row: auto;
  }

  .post-card-featured.has-attachments > .attachment-grid {
    min-height: 0;
  }

  .post-card-featured.has-attachments {
    min-height: 0;
  }

  .post-content {
    padding: 22px 18px;
  }

  .post-card header {
    gap: 12px;
  }

  .post-date {
    min-width: 52px;
    padding-right: 12px;
  }

  .post-date strong {
    font-size: 1.7rem;
  }

  .attachment-grid {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .image-viewer[open] {
    grid-template-columns: 1fr;
  }

  .image-viewer figure {
    grid-column: 1;
  }

  .image-viewer-nav {
    position: fixed;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
  }

  .image-viewer-prev {
    left: max(8px, env(safe-area-inset-left));
  }

  .image-viewer-next {
    right: max(8px, env(safe-area-inset-right));
  }

  .attachment-grid.image-gallery {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .image-gallery.attachment-count-1 {
    grid-template-columns: 1fr;
  }

  .image-gallery.attachment-count-3 .attachment:first-child {
    grid-row: auto;
  }

  .image-gallery .attachment,
  .attachment-grid .image-attachment {
    min-height: 0;
    padding: 0;
  }

  .image-gallery .attachment > a:first-child,
  .image-gallery .attachment-preview-button,
  .attachment-grid .image-attachment > a:first-child,
  .attachment-grid .image-attachment .attachment-preview-button {
    display: block;
    height: auto;
    min-height: 0;
  }

  .image-gallery .attachment img,
  .attachment-grid .image-attachment img {
    display: block;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    object-fit: contain;
    border-radius: 10px;
  }

  .post-card-featured.has-attachments .image-gallery,
  .post-card-featured.has-attachments .image-gallery .attachment,
  .post-card-featured.has-attachments .image-gallery .attachment > a:first-child,
  .post-card-featured.has-attachments .image-gallery .attachment-preview-button,
  .post-card-featured.has-attachments .image-gallery .attachment img {
    height: auto;
    min-height: 0;
  }

  .post-card-featured.has-attachments .attachment-grid .image-attachment,
  .post-card-featured.has-attachments .attachment-grid .image-attachment > a:first-child,
  .post-card-featured.has-attachments .attachment-grid .attachment-preview-button,
  .post-card-featured.has-attachments .attachment-grid .image-attachment img {
    height: auto;
    min-height: 0;
  }

  .image-gallery .attachment-download {
    display: none;
  }

  .post-card-featured.has-attachments .image-gallery .attachment,
  .post-card-featured.has-attachments .image-gallery .attachment img {
    border-radius: 0;
  }

  .existing-file {
    grid-template-columns: 1fr;
  }

  .account-secret-grid,
  .trash-item {
    grid-template-columns: 1fr;
  }

  .trash-actions {
    flex-wrap: wrap;
  }

  .media-heading-row {
    display: grid;
  }

  .media-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .pending-file {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .pending-file > img,
  .pending-file > video {
    width: 72px;
    height: 58px;
  }

  .pending-remove {
    grid-column: 2;
    justify-self: start;
  }

  .header-actions {
    justify-content: flex-end;
    gap: 8px;
  }

  .header-actions .primary-button {
    min-width: 0;
    padding-inline: 14px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .file-button {
    min-width: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
