@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;600;700&family=Sora:wght@400;600;700&display=swap');

:root {
  --bg: #f4f0ea;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #1f6feb;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff6e6 0%, #f4f0ea 55%, #e7f0ff 100%);
  min-height: 100vh;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.print-only {
  display: none;
}

@media print {
  body {
    background: #fff !important;
  }
  .page {
    padding: 0 !important;
    max-width: none !important;
  }
  .topbar,
  .layout {
    display: none !important;
  }
  .print-only {
    display: block;
    padding: 24px 32px;
    color: #111;
  }
  #printTitle {
    font-size: 22px;
    margin: 0 0 16px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
  }
  #printText {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "Sora", "Noto Sans TC", sans-serif;
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
  }
  @page {
    margin: 16mm;
  }
}

.title {
  font-family: "Sora", "Noto Sans TC", sans-serif;
  font-size: 32px;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(31, 111, 235, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(31, 111, 235, 0.35);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.preview {
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  position: sticky;
  top: 24px;
  scrollbar-gutter: stable;
}

.editor {
  width: 100%;
  min-width: 0;
}

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

.layout.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  padding: 12px;
}

.sidebar-collapsed .folder-actions,
.sidebar-collapsed .folder-tree,
.sidebar-collapsed .sidebar-hint {
  display: none;
}

.sidebar-collapsed .sidebar .panel-title {
  font-size: 14px;
}

.sidebar-collapsed .folder-icons {
  display: grid;
}

.sidebar {
  min-height: 520px;
}

.folder-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ghost-btn {
  border: 1px solid #e0d2c3;
  background: #fffaf3;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.folder-icons {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.folder-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #f0e0cf;
  background: #fff7ee;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-icon.active {
  border-color: var(--accent);
  box-shadow: 0 6px 12px rgba(31, 111, 235, 0.2);
}

.folder-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-badge {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #ffe9d2;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.folder-item {
  border: 1px solid #f0e0cf;
  background: #fff7ee;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.folder-item.active {
  border-color: var(--accent);
  box-shadow: 0 8px 16px rgba(31, 111, 235, 0.2);
}

.folder-name {
  font-weight: 700;
  font-size: 14px;
}

.folder-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.folder-posts {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 6px;
}

.post-item {
  border: 1px solid #f3e6d7;
  background: #fffdf9;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.post-item.active {
  border-color: var(--accent);
  box-shadow: 0 6px 12px rgba(31, 111, 235, 0.2);
}

.post-item-title {
  font-weight: 700;
  font-size: 13px;
}

.post-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.sidebar-hint {
  font-size: 12px;
  color: var(--muted);
}

.panel-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header .panel-title {
  margin-bottom: 0;
}

.switch-row {
  display: flex;
  gap: 10px;
}

.device-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.device-btn {
  border: 1px solid #e0d2c3;
  background: #fffaf3;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.device-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.switch-btn {
  border: 1px solid #e0d2c3;
  background: #fffaf3;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.switch-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.3);
}

.editor-input {
  flex: none;
  width: 100%;
  border: 2px solid #f0e4d6;
  border-radius: 16px;
  padding: 16px;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  background: #fffaf3;
  font-family: "Sora", "Noto Sans TC", sans-serif;
  min-height: 300px;
}

.editor-input:focus {
  outline: none;
  border-color: var(--accent);
}

.editor-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.editor-stats {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.symbol-box {
  margin-top: 16px;
  padding: 12px;
  border-radius: 16px;
  background: #fff7ee;
  border: 1px solid #f0e0cf;
}

.symbol-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}

.symbol-summary::-webkit-details-marker {
  display: none;
}

.symbol-body {
  margin-top: 12px;
}

.symbol-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

.symbol-grid-compact {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.symbol-strip {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  background: #fff7ee;
  border: 1px solid #f0e0cf;
}

.symbol-strip-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.symbol-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ead8c7;
  font-size: 14px;
  margin-bottom: 12px;
  background: #fffaf3;
}

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

.symbol-btn {
  border: 1px solid #ead8c7;
  background: #fffaf3;
  border-radius: 10px;
  padding: 6px 0;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.symbol-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.symbol-section {
  grid-column: 1 / -1;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.symbol-empty {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  display: none;
}

.upload-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #ead8c7;
  background: #fff7eb;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.fb-card {
  background: #ffffff;
  border: 1px solid #e4e6eb;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: min(100%, calc(var(--fb-text-width, 560px) + 32px));
}

.fb-header {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d8e8ff, #fcd0a1);
}

.name {
  font-weight: 700;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.fb-text {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.65;
  min-height: 160px;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: min(100%, var(--fb-text-width, 560px));
}

.fb-media {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.fb-media img,
.fb-media video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e4e6eb;
  background: #000;
  max-height: 320px;
  object-fit: cover;
}

.fb-actions {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e4e6eb;
  color: var(--muted);
  font-weight: 600;
}

.ig-card {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 470px;
}

.ig-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ig-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, #ffdc80, #f77737, #fd1d1d, #c13584, #833ab4, #5851db, #405de6, #ffdc80);
  padding: 2px;
}

.ig-avatar::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 50%;
}

.ig-name {
  font-weight: 700;
}

.ig-dots {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
}

.ig-media {
  width: 100%;
  min-height: 220px;
  border-radius: 14px;
  overflow: hidden;
  background: #f7f7f7;
  border: 1px solid #ededed;
  display: grid;
  place-items: center;
}

.ig-media img,
.ig-media video {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.ig-actions {
  display: flex;
  gap: 16px;
  font-size: 18px;
  margin: 10px 0 8px;
}

.ig-caption {
  display: flex;
  gap: 8px;
  line-height: 1.6;
  font-size: 14px;
}

.ig-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ig-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.hidden {
  display: none;
}

.preview.mobile .ig-card {
  max-width: 360px;
  margin: 0 auto;
}

.preview.mobile .fb-card {
  margin: 0 auto;
}

.preview.mobile .fb-text {
  font-size: 17px;
  line-height: 1.7;
}

.preview.mobile .ig-caption {
  font-size: 15px;
  line-height: 1.65;
}

.copy-status {
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
  min-height: 22px;
}

@media (max-width: 1400px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr);
  }

  .layout.sidebar-collapsed {
    grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .layout.sidebar-collapsed {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .editor,
  .preview {
    grid-column: 2;
  }
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout,
  .layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .editor,
  .preview {
    grid-column: auto;
  }
}
