:root {
  --bg: #f6f0ec;
  --bg-elevated: rgba(255, 255, 255, 0.86);
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --line: rgba(74, 67, 58, 0.10);
  --line-strong: rgba(74, 67, 58, 0.18);
  --ink: #2e2a24;
  --muted: #7f766a;
  --accent: #bb4b42;
  --accent-soft: rgba(187, 75, 66, 0.10);
  --accent-deep: #953830;
  --warn: #c45a46;
  --warn-soft: rgba(198, 110, 78, 0.12);
  --highlight: rgba(245, 230, 74, 0.34);
  --shadow-soft: 0 18px 42px rgba(31, 26, 20, 0.07);
  --shadow-float: 0 20px 40px rgba(34, 29, 23, 0.18);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; height: 100%; }
body {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.75) 0%, transparent 38%),
    linear-gradient(180deg, #f6f3ee 0%, #efebe5 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic UI", sans-serif;
  line-height: 1.5;
  overflow: hidden;
}

img, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.device-preview {
  min-height: 100dvh;
  height: 100%;
}

.device-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.75) 0%, transparent 38%),
    linear-gradient(180deg, #f6f3ee 0%, #efebe5 100%);
}

.app-shell {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px calc(env(safe-area-inset-bottom, 0px) + 150px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: -12px -14px 12px;
  padding: 10px 14px 12px;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand-block {
  text-decoration: none;
  color: inherit;
  display: block;
}

.brand-block,
.topbar-tools {
  min-width: 0;
}

.brand-kicker {
  display: block;
  margin: 0 0 3px;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.brand-title {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1;
  font-weight: 700;
}

.brand-copy {
  display: none;
}

.topbar-tools {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}

.usage-chip,
.lang-select,
.soft-btn,
.icon-btn,
.tab-btn,
.chip-btn,
.ghost-btn,
.mode-btn,
.secondary-btn,
.primary-btn,
.tool-btn,
.detail-chip {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  color: var(--ink);
}

.usage-chip,
.lang-select,
.soft-btn,
.icon-btn,
.chip-btn,
.ghost-btn,
.mode-btn,
.secondary-btn,
.primary-btn,
.tool-btn,
.detail-chip {
  border-radius: 999px;
}

.usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-height: 34px;
  box-shadow: none;
}

.usage-chip span { color: var(--muted); font-size: 0.68rem; }
.usage-chip strong { font-size: 0.76rem; }

.lang-select,
.soft-btn,
.icon-btn {
  min-height: 34px;
  padding: 0 10px;
  box-shadow: none;
}

.lang-select {
  min-width: 98px;
  font-size: 0.72rem;
}

.icon-btn {
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
}

.soft-btn {
  font-weight: 700;
  font-size: 0.72rem;
}

.view-tabs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 0;
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 4px);
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 24px rgba(20, 17, 14, 0.06);
  backdrop-filter: blur(18px);
}

.view-tabs::before {
  content: none;
}

.tab-btn {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: 6px 6px 4px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.68rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--muted);
  overflow: visible;
}

#tab-activity {
  z-index: 1;
}

#tab-capture {
  z-index: 2;
}

#tab-collections {
  z-index: 1;
}

.tab-btn .line-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.1;
}

.tab-btn.is-active {
  color: var(--accent-deep);
}

.tab-btn.is-capture {
  color: var(--accent-deep);
  font-weight: 800;
}

#tab-capture .line-icon {
  width: 30px;
  height: 30px;
}

.tab-btn span {
  display: block;
  line-height: 1.08;
}

.main-layout {
  margin-top: 6px;
}

.panel-shell {
  display: grid;
  gap: 12px;
}

.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(249,245,238,0.94) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: none;
  margin-bottom: 6px;
}

.draft-banner-copy strong { display: block; font-size: 0.86rem; }
.draft-banner-copy span { color: var(--muted); font-size: 0.72rem; }

.draft-banner.is-inline {
  padding: 10px 12px;
  border-radius: 14px;
  gap: 10px;
  margin-bottom: 0;
}

.draft-banner.is-inline .draft-banner-copy,
.draft-inline-copy {
  min-width: 0;
  margin: 0;
}

.draft-banner.is-inline .draft-banner-copy strong,
.draft-inline-copy strong {
  font-size: 0.78rem;
  display: inline;
  margin-right: 6px;
}

.draft-banner.is-inline .draft-banner-copy span,
.draft-inline-copy {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.35;
}

.draft-inline-copy span {
  display: inline;
  color: var(--muted);
}

.draft-inline-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
}

.draft-inline-btn strong {
  font-size: 0.68rem;
  color: var(--accent-deep);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.chip-btn,
.tool-btn,
.detail-chip,
.mode-btn {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-weight: 700;
}

.primary-btn {
  background: var(--accent);
  color: #f8f5f0;
  border-color: transparent;
  box-shadow: 0 14px 28px rgba(187, 75, 66, 0.22);
}

.secondary-btn,
.ghost-btn,
.tool-btn {
  background: rgba(255,255,255,0.74);
}

.mode-segment {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mode-btn {
  border: 1px solid transparent;
  background: transparent;
  min-height: 40px;
  padding: 0 14px;
  width: 100%;
}

.mode-btn.is-active {
  background: var(--surface-strong);
  border-color: var(--line);
}

.tool-btn.is-active,
.ghost-btn.is-active {
  background: var(--accent-soft);
  border-color: rgba(187, 75, 66, 0.22);
}

.activity-hero,
.empty-state,
.collection-group,
.card-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(252,250,246,0.95) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.activity-hero {
  padding: 20px 22px;
  display: grid;
  gap: 14px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.hero-meta strong { color: var(--ink); }

.activity-list {
  display: grid;
  gap: 16px;
}

.activity-history-list,
.activity-history-grid {
  display: grid;
  gap: 10px;
}

.timeline-shell,
.timeline-section {
  display: grid;
  gap: 10px;
}

.timeline-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.timeline-head-copy {
  display: grid;
  gap: 2px;
}

.timeline-head-copy strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.timeline-head-copy span {
  font-size: 0.68rem;
  color: var(--muted);
}

.timeline-mode-section {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.timeline-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
}

.timeline-mode-btn {
  min-height: 42px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.timeline-mode-btn.is-active {
  color: var(--accent-deep);
  background: rgba(252, 241, 239, 0.96);
  border-color: rgba(187, 75, 66, 0.16);
}

.latest-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 11px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(32, 26, 22, 0.06);
}

.latest-card-button {
  width: 100%;
  text-align: left;
}

.latest-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-top: 2px;
}

.latest-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.24;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest-gloss,
.latest-digest,
.latest-meaning {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest-digest {
  font-size: 0.76rem;
  color: var(--muted);
}

.photo-card {
  border: 1px solid rgba(46, 42, 36, 0.08);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 14, 12, 0.08);
}

.photo-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(220, 214, 205, 0.75);
}

.photo-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card-caption {
  min-height: 24px;
  padding: 6px 8px 7px;
  border-top: 1px solid rgba(46, 42, 36, 0.08);
  font-size: 0.64rem;
  color: var(--muted);
}

.photo-card.is-small .photo-card-caption {
  min-height: 22px;
  padding: 5px 7px 6px;
  font-size: 0.6rem;
}

.photo-card.is-history {
  box-shadow: none;
}

.photo-card-overlay-badge {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(46, 42, 36, 0.08);
  font-size: 0.62rem;
  color: var(--ink);
  backdrop-filter: blur(10px);
}

.photo-card-date {
  padding: 6px 6px 0;
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--muted);
  text-align: center;
}

.history-tile {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 6px 16px rgba(24, 20, 16, 0.05);
  text-align: left;
}

.history-tile.is-select-mode {
  cursor: pointer;
}

.history-tile.is-selected {
  border-color: rgba(187, 75, 66, 0.28);
  background: rgba(252, 241, 239, 0.9);
}

.history-select-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(46, 42, 36, 0.08);
  background: rgba(255,255,255,0.92);
  color: var(--muted);
  box-shadow: 0 4px 10px rgba(20, 17, 14, 0.08);
}

.history-tile.is-selected .history-select-badge {
  color: var(--accent-deep);
  background: rgba(255,255,255,0.98);
}

.history-select-badge .line-icon {
  width: 15px;
  height: 15px;
}

.history-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-top: 2px;
}

.history-title {
  font-size: 0.86rem;
  line-height: 1.28;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-meaning {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.48;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-tags {
  margin: 0;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card.is-history .photo-card-media {
  aspect-ratio: 1 / 1;
}

.photo-card.is-history .photo-card-overlay-badge,
.photo-card.is-history .photo-card-date {
  display: none;
}

.history-photo-meta {
  padding: 6px 6px 0;
  display: grid;
  gap: 3px;
}

.history-photo-category {
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-photo-date-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(46, 42, 36, 0.08);
  font-size: 0.6rem;
  line-height: 1;
  color: var(--ink);
  backdrop-filter: blur(10px);
}

.history-photo-share {
  font-size: 0.56rem;
  line-height: 1.1;
  color: var(--accent-deep);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill,
.accent-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.tag-pill {
  background: rgba(46, 42, 36, 0.05);
  color: var(--muted);
}

.accent-chip {
  background: rgba(187, 75, 66, 0.10);
  color: var(--accent-deep);
  border-color: rgba(187, 75, 66, 0.16);
}

.activity-card {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.activity-card.is-featured {
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  padding: 18px;
}

.card-media {
  aspect-ratio: 1 / 1;
  border-radius: calc(var(--radius-lg) - 6px);
  overflow: hidden;
  background: rgba(220, 214, 205, 0.75);
  position: relative;
}

.card-media img { width: 100%; height: 100%; object-fit: cover; }

.card-media-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.88);
  border-radius: 999px;
  border: 1px solid rgba(46, 42, 36, 0.08);
  font-size: 0.8rem;
  font-weight: 700;
}

.card-body { display: grid; gap: 12px; min-width: 0; }
.card-topline,
.card-footline,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.soft-chip,
.state-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--line);
  font-size: 0.68rem;
  color: var(--muted);
}

.state-chip.is-error {
  background: rgba(255, 247, 243, 0.9);
  border-color: rgba(198, 110, 78, 0.24);
  color: var(--warn);
}

.card-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.18;
}

.card-summary,
.card-english,
.card-description,
.detail-copy p,
.draft-card-copy p,
.setting-copy p {
  margin: 0;
  color: var(--muted);
}

.card-description { color: var(--ink); }

.card-english strong,
.detail-copy strong { color: var(--ink); }

.card-actions,
.dialog-actions,
.compose-actions,
.compose-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  padding: 28px;
  display: grid;
  gap: 14px;
  place-items: start;
}

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

.collection-browser,
.collection-layout {
  display: grid;
  gap: 10px;
}

.collection-browser-section {
  display: grid;
  gap: 8px;
}

.collection-browser-panel {
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.collection-browser-panel .collection-group {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.collection-browser-panel .collection-group + .collection-group {
  border-top: 1px solid var(--line);
}

.collection-group {
  padding: 12px;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.collection-group.is-accordion {
  padding: 0;
  overflow: hidden;
}

.collection-accordion-toggle {
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.collection-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collection-head-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.collection-head-copy strong {
  font-size: 0.84rem;
  color: var(--ink);
}

.collection-head-copy span {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-head-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.collection-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.collection-group.is-open .collection-chevron {
  transform: rotate(180deg);
}

.collection-accordion-body {
  padding: 0 12px 12px;
}

.collection-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.collection-category-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.collection-category-link.is-active {
  color: var(--accent-deep);
}

.collection-category-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--accent-deep);
}

.collection-category-badge {
  position: absolute;
  top: -4px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(187, 75, 66, 0.12);
  color: var(--accent-deep);
  font-size: 0.58rem;
  font-weight: 800;
}

.collection-category-label {
  font-size: 0.76rem;
  line-height: 1.2;
}

.collection-folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.collection-folder {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  text-align: left;
}

.collection-folder.is-active {
  border-color: rgba(187, 75, 66, 0.24);
  background: rgba(252, 241, 239, 0.92);
}

.collection-folder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(187, 75, 66, 0.08);
  color: var(--accent-deep);
}

.collection-folder-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.collection-folder-copy strong {
  font-size: 0.82rem;
  line-height: 1.25;
  color: var(--ink);
}

.collection-folder-copy span {
  font-size: 0.7rem;
  color: var(--muted);
}

.collection-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.collection-tag-btn {
  border: 1px solid transparent;
  cursor: pointer;
}

.collection-tag-btn strong {
  font-size: 0.66rem;
  color: inherit;
}

.collection-tag-btn.is-active {
  background: rgba(252, 241, 239, 0.92);
  border-color: rgba(187, 75, 66, 0.24);
  color: var(--accent-deep);
}

.collection-results-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-chip-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  font-size: 0.68rem;
  color: var(--muted);
}

.ghost-chip-btn.is-active {
  color: var(--accent-deep);
  border-color: rgba(187, 75, 66, 0.16);
  background: rgba(252, 241, 239, 0.96);
}

.collection-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(187, 75, 66, 0.14);
  border-radius: 18px;
  background: rgba(252, 241, 239, 0.72);
}

.collection-batch-copy {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.collection-batch-copy strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.collection-batch-copy span {
  font-size: 0.72rem;
  color: var(--muted);
}

.collection-batch-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(240px, 100%);
}

.collection-batch-actions .stack-action-btn[disabled] {
  opacity: 0.46;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.collection-card {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.collection-card figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  background: rgba(220, 214, 205, 0.75);
}

.collection-card img { width: 100%; height: 100%; object-fit: cover; }

.collection-card-body {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.compose-fab {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 76px;
  transform: translateX(-50%);
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #c25549 0%, #a53e34 100%);
  color: #f9f5ef;
  font-weight: 800;
  box-shadow: var(--shadow-float);
  z-index: 35;
}

.compose-fab[hidden] {
  display: none !important;
}

.overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 30, 24, 0.42);
  backdrop-filter: blur(8px);
}

.overlay-card {
  position: relative;
  width: min(100%, 980px);
  max-height: calc(100% - 24px);
  overflow: auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(249,245,239,0.97) 100%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 34px;
  box-shadow: var(--shadow-float);
  padding: 18px;
}

.overlay-card.is-wide { width: min(100%, 1120px); }

.overlay-card.is-compose {
  width: min(100%, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.overlay-card.is-item {
  width: min(100%, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.overlay-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.overlay-title {
  margin: 0;
  font-size: 1.4rem;
}

.overlay-subtitle,
.compose-note,
.compose-hint,
.setting-copy span,
.draft-list-head span {
  color: var(--muted);
  margin: 0;
}

.camera-stage,
.preview-stage {
  background: rgba(20, 18, 15, 0.94);
  border-radius: 26px;
  overflow: hidden;
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
}

.camera-stage video,
.preview-stage canvas {
  width: 100%;
  height: 100%;
}

.camera-stage video {
  object-fit: cover;
}

.preview-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-canvas {
  position: absolute;
  inset: 0;
}

.camera-placeholder {
  padding: 28px;
  text-align: center;
  color: rgba(255,255,255,0.86);
  display: grid;
  gap: 14px;
}

.compose-grid {
  display: grid;
  gap: 16px;
}

.compose-shell {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.compose-shell > * {
  min-width: 0;
}

.compose-grid > * {
  min-width: 0;
}

.compose-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compose-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.field-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-stack label {
  display: flex;
  align-items: flex-end;
  min-height: 2.2em;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.field-stack select {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  padding: 0 14px;
}

.compose-detail-grid > .field-stack {
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.54);
  align-content: start;
}

.tag-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-check-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  color: var(--muted);
  cursor: pointer;
}

.tag-check-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  pointer-events: none;
}

.tag-check-chip.is-active {
  background: rgba(252, 241, 239, 0.92);
  border-color: rgba(187, 75, 66, 0.24);
  color: var(--accent-deep);
}

.tag-check-chip .line-icon {
  width: 16px;
  height: 16px;
}

.ghost-btn.is-danger {
  color: var(--warn);
  border-color: rgba(198, 110, 78, 0.22);
  background: rgba(255, 247, 243, 0.82);
}

.preview-toolbar {
  display: grid;
  gap: 10px;
}

.compose-control-stack {
  display: grid;
  gap: 10px;
}

.rotation-card {
  min-width: 0;
  width: 100%;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
  display: grid;
  gap: 10px;
}

.rotation-card-compact {
  padding: 12px 14px;
  gap: 8px;
}

.rotation-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.rotation-inline-summary {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.rotation-inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  justify-content: flex-end;
}

.rotation-inline strong {
  font-size: 0.86rem;
}

.rotation-icon-btn {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
}

.rotation-icon-btn .line-icon {
  width: 18px;
  height: 18px;
}

.rotation-reset-btn {
  width: auto;
  min-height: 38px;
  padding: 0 12px;
  justify-content: center;
  background: var(--accent-soft);
  border-color: rgba(187, 75, 66, 0.18);
}

.rotation-state-pill,
.rotation-chip-btn {
  width: 100%;
  min-height: 64px;
  padding: 8px 6px 9px;
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font-size: 0.63rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
}

.rotation-state-pill {
  border: 1px solid rgba(187, 75, 66, 0.16);
  background: rgba(255, 244, 240, 0.96);
  color: var(--accent-deep);
}

.rotation-state-pill .line-icon,
.rotation-chip-btn .line-icon {
  width: 18px;
  height: 18px;
}

.rotation-state-pill span,
.rotation-chip-btn span {
  min-width: 0;
}

.rotation-chip-btn {
  background: rgba(255,255,255,0.9);
}

.rotation-chip-reset {
  border-color: rgba(187, 75, 66, 0.18);
  background: rgba(255, 247, 243, 0.96);
}

.camera-stage-tools,
.preview-stage-tools {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.preview-stage-tools {
  top: auto;
  bottom: 12px;
  right: auto;
  width: min(408px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-stage-btn {
  width: 100%;
  min-height: 64px;
  padding: 8px 6px 9px;
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 5px;
  background: rgba(255,255,255,0.92);
  border-color: rgba(31, 27, 22, 0.10);
  color: var(--ink);
  backdrop-filter: blur(14px);
}

.preview-stage-btn .line-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.05;
}

.preview-stage-btn span {
  min-width: 0;
  font-size: 0.63rem;
  line-height: 1.05;
  text-align: center;
}

.preview-stage-btn.is-marker {
  color: #c49800;
}

.preview-stage-btn.is-marker.is-active {
  background: rgba(255, 216, 31, 0.98);
  border-color: rgba(118, 94, 0, 0.22);
  color: #5d4500;
  box-shadow: 0 10px 24px rgba(118, 94, 0, 0.18);
}

.preview-stage-btn.is-confirm {
  color: var(--accent-deep);
}

.preview-stage-btn.is-confirm.is-active {
  background: rgba(252, 241, 239, 0.98);
  border-color: rgba(187, 75, 66, 0.22);
  color: var(--accent-deep);
  box-shadow: 0 10px 24px rgba(187, 75, 66, 0.14);
}

.preview-stage-btn.is-eraser {
  color: #8c7f78;
}

.preview-stage-btn[aria-pressed="true"] {
  transform: translateY(-1px);
}

.preview-stage-btn[disabled] {
  opacity: 0.58;
}

.preview-stage-status {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.preview-stage-chip {
  background: rgba(31, 27, 22, 0.62);
  border-color: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.84);
  backdrop-filter: blur(14px);
}

.preview-angle-chip {
  min-width: 0;
}

.camera-stage-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.camera-capture-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.24);
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.94) 0 58%, rgba(214,208,200,0.96) 59% 72%, rgba(255,255,255,0.18) 73% 100%);
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 34px rgba(10, 8, 6, 0.24);
  pointer-events: auto;
}

.camera-capture-btn .line-icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.1;
}

.camera-sheet {
  display: grid;
  gap: 10px;
}

.condition-card {
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
  display: grid;
  gap: 12px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.condition-card.is-open {
  border-color: rgba(187, 75, 66, 0.18);
  background: rgba(255,250,247,0.92);
}

.condition-card-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: var(--ink);
}

.condition-card-summary {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.condition-card-summary strong {
  font-size: 0.74rem;
  color: var(--muted);
}

.condition-card-summary span {
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.condition-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.condition-card-body {
  display: grid;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.24s ease, opacity 0.18s ease;
}

.condition-card.is-open .condition-card-body {
  max-height: 360px;
  opacity: 1;
}

.rotation-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.rotation-slider {
  width: 100%;
  accent-color: var(--accent);
}

.rotation-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.preview-adjust-row,
.preview-hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compose-action-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 10px;
  align-items: center;
}

.compose-hint:empty {
  display: none;
}

.detail-shell {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.detail-media-hero {
  aspect-ratio: 4 / 3;
}

.detail-hero-copy {
  display: grid;
  gap: 12px;
  align-content: start;
}

.detail-lead {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}

.detail-sublead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.detail-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-inline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-mini-card {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
  display: grid;
  gap: 8px;
}

.detail-mini-card h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.detail-mini-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.detail-layout,
.draft-list,
.draft-card,
.setting-list {
  display: grid;
  gap: 16px;
}

.detail-layout {
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
}

.detail-media {
  border-radius: 24px;
  overflow: hidden;
  background: rgba(220, 214, 205, 0.75);
  aspect-ratio: 1 / 1;
  position: relative;
}

.detail-media img { width: 100%; height: 100%; object-fit: cover; }

.detail-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(20, 18, 15, 0.64);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  backdrop-filter: blur(14px);
}

.detail-copy {
  display: grid;
  gap: 14px;
}

.detail-action-dock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.detail-quick-dock {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
  padding-top: 10px;
}

.detail-quick-dock::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: 0;
  bottom: -18px;
  background: linear-gradient(180deg, rgba(249,245,239,0) 0%, rgba(249,245,239,0.92) 28%, rgba(249,245,239,0.98) 100%);
  z-index: -1;
  pointer-events: none;
}

.detail-quick-dock .stack-action-btn {
  min-height: 58px;
}

.detail-quick-dock .stack-action-btn .line-icon {
  width: 20px;
  height: 20px;
}

.detail-section {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.74);
  border: 1px solid var(--line);
}

.detail-section h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.draft-list-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.draft-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,0.82);
}

.draft-card-layout {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.draft-card-visual {
  display: grid;
  gap: 8px;
}

.draft-card-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(220, 214, 205, 0.75);
}

.draft-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draft-card-photo-meta {
  display: grid;
  gap: 2px;
  padding: 0 2px;
}

.draft-card-photo-meta strong {
  font-size: 0.68rem;
  color: var(--ink);
  line-height: 1.2;
}

.draft-card-photo-meta span {
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.2;
}

.draft-card-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.draft-card-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
}

.stack-action-btn {
  min-height: 54px;
  padding: 6px 8px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  white-space: normal;
  box-shadow: none;
}

.stack-action-label {
  display: block;
  line-height: 1.05;
  font-size: 0.66rem;
  font-weight: 700;
}

.stack-action-btn .line-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.stack-action-btn.is-compact {
  min-height: 50px;
  padding: 6px 6px;
}

.stack-action-btn.is-compact .line-icon {
  width: 17px;
  height: 17px;
}

.stack-action-btn.is-danger {
  color: var(--warn);
  border-color: rgba(198, 110, 78, 0.22);
  background: rgba(255, 247, 243, 0.82);
}

.draft-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.draft-card-title {
  margin: 0;
  font-size: 1rem;
}

.setting-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  display: grid;
  gap: 12px;
}

.setting-copy strong { display: block; margin-bottom: 6px; }

.edit-sheet {
  gap: 14px;
}

.edit-section-card {
  gap: 14px;
}

.edit-item-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background: rgba(255,255,255,0.62);
  color: var(--ink);
  font-weight: 700;
}

.edit-item-chip .line-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-deep);
}

.edit-item-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-save-row {
  padding-top: 2px;
}

.edit-manage-card {
  background: rgba(253, 250, 248, 0.86);
}

.edit-manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edit-manage-grid .stack-action-btn {
  min-height: 68px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 2px;
  font-size: 0.88rem;
  color: var(--ink);
}

.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-deep);
}

.field-stack input[type="text"] {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  padding: 0 14px;
}

.field-stack input[type="text"]:disabled {
  background: rgba(242, 236, 228, 0.7);
  color: var(--muted);
}

.setting-url-box {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background: rgba(255,255,255,0.62);
}

.setting-url-box a {
  color: var(--accent-deep);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.setting-help {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

.share-state-btn.is-public {
  background: rgba(252, 241, 239, 0.96);
  border-color: rgba(187, 75, 66, 0.16);
  color: var(--accent-deep);
}

.share-sheet {
  gap: 12px;
}

.share-preview-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background: rgba(255,255,255,0.62);
}

.share-preview-image {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background: rgba(242, 236, 228, 0.7);
  aspect-ratio: 4 / 3;
}

.share-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.share-preview-copy {
  display: grid;
  gap: 10px;
}

.share-preview-body p {
  margin: 0;
  line-height: 1.45;
  color: var(--ink);
}

.share-preview-link-row {
  display: grid;
  gap: 4px;
}

.share-preview-link-label {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-preview-link {
  color: var(--accent-deep);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.share-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.share-service-btn {
  min-height: 78px;
  padding: 10px 8px;
  border-radius: 20px;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.share-service-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(31, 27, 22, 0.08);
  background: rgba(255,255,255,0.92);
}

.share-service-mark .line-icon {
  width: 18px;
  height: 18px;
}

.share-service-mark.is-native { color: var(--accent-deep); }
.share-service-mark.is-line { color: #06c755; }
.share-service-mark.is-facebook { color: #1877f2; }
.share-service-mark.is-instagram { color: #d62976; }
.share-service-mark.is-zalo { color: #0068ff; }
.share-service-mark.is-mail { color: #8c7f78; }

.share-service-label {
  font-size: 0.7rem;
  line-height: 1.1;
  font-weight: 700;
}

@media (min-width: 560px) {
  .share-service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.debug-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.debug-pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(246, 242, 235, 0.88);
  color: var(--ink);
  font: 12px/1.6 Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 52vh;
  overflow: auto;
}

.line-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.compose-fab .line-icon { width: 20px; height: 20px; }

@media (min-width: 960px) {
  body.is-debug-frame .device-preview {
    display: grid;
    place-items: center;
    padding: 24px;
  }

  body.is-debug-frame .device-shell {
    width: min(100%, 430px);
    height: min(calc(100dvh - 24px), 920px);
    border-radius: 42px;
    border: 10px solid rgba(27, 24, 22, 0.96);
    box-shadow:
      0 36px 90px rgba(20, 17, 14, 0.28),
      0 10px 24px rgba(20, 17, 14, 0.16);
  }

  body.is-debug-frame .device-shell::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 42%;
    height: 26px;
    transform: translateX(-50%);
    border-radius: 0 0 18px 18px;
    background: rgba(27, 24, 22, 0.98);
    z-index: 70;
  }

  body.is-debug-frame .device-shell::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 12px;
    width: 34%;
    height: 5px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255,255,255,0.72);
    z-index: 70;
    pointer-events: none;
  }

  body.is-debug-frame .app-shell {
    padding-top: 52px;
  }
}

@media (max-width: 900px) {
  .activity-card,
  .activity-card.is-featured,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .compose-detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-hero,
  .detail-inline-grid {
    grid-template-columns: 1fr;
  }

  .draft-card-layout {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }

  .collection-folder-grid {
    grid-template-columns: 1fr;
  }

  .collection-category-list {
    gap: 8px 12px;
  }

  .collection-category-label {
    font-size: 0.72rem;
  }

  .collection-head-copy span {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .draft-card-actions {
    gap: 6px;
  }

  .stack-action-btn {
    min-height: 48px;
    padding: 5px 6px;
  }

  .stack-action-label {
    font-size: 0.58rem;
  }

  .detail-quick-dock {
    gap: 6px;
  }

  .detail-quick-dock::before {
    left: -12px;
    right: -12px;
    bottom: -16px;
  }

  .edit-item-chip {
    font-size: 0.88rem;
  }

  .edit-manage-grid {
    gap: 8px;
  }

  .edit-manage-grid .stack-action-btn {
    min-height: 60px;
  }

  .collection-batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .collection-batch-actions {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px calc(env(safe-area-inset-bottom, 0px) + 150px);
  }

  .tab-btn {
    justify-content: center;
  }

  .draft-banner,
  .compose-controls,
  .preview-toolbar,
  .draft-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .draft-banner.is-inline {
    flex-direction: row;
    align-items: center;
  }

  .overlay-layer.is-compose {
    padding: 0;
  }

  .overlay-layer.is-item {
    padding: 0;
  }

  .overlay-card {
    padding: 16px;
    border-radius: 28px;
  }

  .overlay-card.is-compose {
    width: 100%;
    max-height: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .overlay-card.is-item {
    width: 100%;
    max-height: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .overlay-card.is-compose .overlay-head {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    background: rgba(249,245,239,0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }

  .overlay-card.is-item .overlay-head {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    background: rgba(249,245,239,0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }

  .overlay-card.is-compose .overlay-title {
    font-size: 1.04rem;
  }

  .overlay-card.is-item .overlay-title {
    font-size: 1.04rem;
  }

  .overlay-card.is-compose .overlay-subtitle {
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .overlay-card.is-item .overlay-subtitle {
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .overlay-card.is-compose .compose-shell {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
    gap: 12px;
  }

  .overlay-card.is-item .detail-shell {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
    gap: 12px;
  }

  .camera-stage,
  .preview-stage {
    min-height: clamp(310px, 46dvh, 500px);
    border-radius: 24px;
  }

  .latest-card {
    grid-template-columns: 94px minmax(0, 1fr);
    padding: 9px;
  }

  .compose-fab {
    left: 14px;
    right: 14px;
    transform: none;
    justify-content: center;
  }

  .camera-stage-tools,
  .preview-stage-tools {
    top: 10px;
    left: 10px;
    gap: 6px;
  }

  .preview-stage-tools {
    top: auto;
    right: auto;
    bottom: 10px;
    width: min(392px, calc(100% - 20px));
  }

  .preview-stage-btn {
    min-height: 60px;
    padding: 7px 6px 8px;
  }

  .preview-stage-chip {
    justify-content: center;
  }

  .camera-capture-btn {
    width: 82px;
    height: 82px;
  }

  .mode-segment {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-btn,
  .camera-sheet > .secondary-btn,
  .camera-sheet > .ghost-btn {
    width: 100%;
  }

  .rotation-card-compact {
    padding: 10px 12px;
  }

  .rotation-inline {
    gap: 8px;
  }

  .rotation-state-pill,
  .rotation-chip-btn {
    min-height: 58px;
    padding: 7px 5px 8px;
    font-size: 0.58rem;
  }

  .rotation-inline-actions {
    gap: 6px;
  }

  .rotation-icon-btn {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .compose-action-dock {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 4px);
  }

  .compose-action-dock::before {
    content: "";
    position: absolute;
    left: -12px;
    right: -12px;
    top: 0;
    bottom: -14px;
    background: linear-gradient(180deg, rgba(249,245,239,0) 0%, rgba(249,245,239,0.92) 28%, rgba(249,245,239,0.98) 100%);
    z-index: -1;
    pointer-events: none;
  }

  .condition-card {
    padding: 11px 12px;
  }

  .detail-media-hero {
    aspect-ratio: 4 / 3;
  }

  .detail-mini-card {
    padding: 13px 14px;
  }

  .detail-action-dock {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) and (max-height: 780px) {
  .overlay-card.is-compose .overlay-head {
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
  }

  .overlay-card.is-compose .compose-shell {
    padding-top: 10px;
  }

  .camera-stage,
  .preview-stage {
    min-height: clamp(220px, 34dvh, 320px);
  }

  .compose-action-dock {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0px);
    padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 4px);
  }

  .compose-action-dock::before {
    display: block;
  }

  .compose-hint {
    font-size: 0.74rem;
    line-height: 1.35;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .overlay-card.is-compose .overlay-subtitle {
    display: none;
  }

  .overlay-card.is-item .overlay-subtitle {
    display: none;
  }

  .camera-stage,
  .preview-stage {
    min-height: clamp(200px, 30dvh, 280px);
  }

  .preview-stage-tools {
    bottom: 8px;
    left: 8px;
    width: min(100%, calc(100% - 16px));
  }

  .preview-stage-btn {
    min-height: 56px;
    padding: 6px 5px 7px;
  }

  .preview-stage-btn .line-icon {
    width: 18px;
    height: 18px;
  }

  .preview-stage-btn span {
    font-size: 0.58rem;
  }

  .rotation-card-compact,
  .condition-card {
    padding: 10px 11px;
  }

  .detail-lead {
    font-size: 0.94rem;
  }
}

@media (max-width: 360px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .latest-card {
    grid-template-columns: 1fr;
  }

  .history-tile {
    grid-template-columns: 82px minmax(0, 1fr);
    padding: 8px;
  }
}

/* ================================================================
   v6 additions — post-answer re-ask + dictionary chips
   ================================================================ */

.reinterpret-sheet .reinterpret-hint {
  font-size: .84rem;
  color: var(--ink-soft, #6b7280);
  margin: 0 0 12px;
}

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

.reinterpret-option.is-current {
  opacity: .45;
}

.detail-dict-section[hidden] {
  display: none;
}

.dict-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.dict-chip {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e9f6f1;
  border: 1px solid #a9dcc9;
  color: #0d7a5f;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}

.dict-chip:hover {
  background: #dcf0e8;
}

.dict-chip-note {
  font-size: .74rem;
  color: #94a3ad;
}

.dict-chip-footnote {
  margin: 8px 0 0;
}
