:root {
  --sys-bg: #EAEBEE;
  --sys-card: rgba(255, 255, 255, 0.65);
  --sys-card-border: rgba(255, 255, 255, 0.4);
  --sys-text: #1C1C1E;
  --sys-text-secondary: #8E8E93;
  --sys-tint: #007AFF;
  --sys-tint-hover: #0056b3;
  --sys-divider: rgba(60, 60, 67, 0.1);
  --sys-radius: 20px;
  --sys-radius-sm: 10px;
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --sys-bg: #0f0f10;
  --sys-card: rgba(28,28,30,0.7);
  --sys-card-border: rgba(255,255,255,0.06);
  --sys-text: #F2F2F7;
  --sys-text-secondary: #AEAEB2;
  --sys-divider: rgba(84,84,88,0.28);
  --sys-tint: #0A84FF;
}

[data-theme="light"] {
  --sys-bg: #EAEBEE;
  --sys-card: rgba(255,255,255,0.65);
  --sys-card-border: rgba(255,255,255,0.4);
  --sys-text: #1C1C1E;
  --sys-text-secondary: #8E8E93;
  --sys-divider: rgba(60,60,67,0.1);
  --sys-tint: #007AFF;
}

body, .glass-header, .glass-pane, .app-footer {
  transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--sys-text);
  background-color: var(--sys-bg);
  background-image: url('https://oss.ericzhao3366.work/blog/background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

.app-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.12);
  z-index: -1;
  pointer-events: none;
  transition: background-color 200ms ease;
}

[data-theme="dark"] .app-bg {
  background-color: rgba(0,0,0,0.45);
}

.app-container {
  width: 95vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
}

.glass-header {
  height: 60px;
  min-height: 60px;
  background: var(--sys-card);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sys-card-border);
  border-radius: var(--sys-radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.glass-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.mode-tabs {
  display: flex;
  background: var(--sys-divider);
  border-radius: 10px;
  padding: 2px;
  margin-left: 8px;
}

.mode-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sys-text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--sys-text);
}

.mode-tab.active {
  background: var(--sys-card);
  color: var(--sys-text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.header-actions, .flex-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  background: var(--sys-tint);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,122,255,0.3);
}

.btn-primary:hover {
  background: var(--sys-tint-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary svg {
  width: 16px;
  height: 16px;
}

.theme-toggle-label {
  position: relative;
  display: flex;
  align-items: center;
  height: 28px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.theme-toggle-label:hover { opacity: 0.8; }
.theme-toggle-label input { display: none; }

.theme-toggle-track {
  width: 56px;
  height: 28px;
  background-color: #E5E7EB;
  border: 1px solid #D1D5DB;
  border-radius: 9999px;
  transition: background-color 0.5s, border-color 0.5s;
}

.theme-toggle-knob {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background-color: #FFFFFF;
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), background-color 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-icon-sun, .theme-icon-moon {
  position: absolute;
  width: 16px;
  height: 16px;
  transition: all 0.5s cubic-bezier(0.4,0,0.2,1);
}

.theme-icon-sun { color: #EAB308; opacity: 1; transform: rotate(0) scale(1); }
.theme-icon-moon { color: #1F2937; opacity: 0; transform: rotate(-90deg) scale(0.5); }

[data-theme="dark"] .theme-toggle-track {
  background-color: #374151;
  border-color: #4B5563;
}
[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(28px) translateY(-50%);
  background-color: #E5E7EB;
}
[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.main-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.glass-pane {
  background: var(--sys-card);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sys-card-border);
  border-radius: var(--sys-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-meta-container {
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.meta-header, .pane-header {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .meta-header, [data-theme="dark"] .pane-header { background: rgba(255, 255, 255, 0.03); }

.meta-header h2, .pane-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--sys-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toggle-icon {
  width: 20px;
  height: 20px;
  color: var(--sys-text-secondary);
  transition: transform 0.3s;
}

.meta-content, .pane-content {
  padding: 0 24px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform-origin: top;
  transition: max-height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s, padding 0.3s;
  max-height: 500px;
  opacity: 1;
  overflow: hidden;
}

.pane-content {
  max-height: 2000px;
}

.meta-content.collapsed, .pane-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.meta-top-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: nowrap;
}

.meta-top-row .form-group { flex: 1 1 0%; }
.meta-top-row .form-group:nth-child(1) { flex: 2 1 320px; }
.meta-top-row .form-group:nth-child(2) { flex: 1 1 220px; }
.meta-top-row .form-group:nth-child(3) { flex: 0 0 160px; }
.meta-top-row .form-group:nth-child(4) { flex: 1 1 200px; }
.meta-top-row .form-group:nth-child(5) { flex: 1 1 200px; }
.meta-top-row .form-group:nth-child(6) { flex: 0 0 auto; }

@media (max-width: 700px) {
  .meta-top-row { gap: 8px; }
  .meta-top-row .form-group:nth-child(1) { flex-basis: 180px; }
  .meta-top-row .form-group:nth-child(2) { flex-basis: 120px; }
  .meta-top-row .form-group:nth-child(3) { flex-basis: 110px; }
  .meta-top-row .form-group:nth-child(4),
  .meta-top-row .form-group:nth-child(5) { flex-basis: 120px; }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sys-text-secondary);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  width: 100%;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--sys-divider);
  border-radius: var(--sys-radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--sys-text);
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

[data-theme="dark"] .form-group input, [data-theme="dark"] .form-group textarea {
  background: rgba(255,255,255,0.05);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--sys-tint);
  background: transparent;
}

.toggle-group {
  display: flex;
  flex-direction: row;
  height: 36px;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 30px;
  display: inline-block;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.toggle-switch .track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--sys-divider);
  border: 1px solid rgba(0,0,0,0.06);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .toggle-switch .track {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
}

.toggle-switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.toggle-switch input:checked ~ .track {
  background: #34C759;
  border-color: rgba(0,0,0,0.06);
}

.toggle-switch input:checked ~ .knob {
  transform: translateX(20px);
}

.no-margin-bottom {
  margin-bottom: 0;
}

/* Bottom Panes */
.bottom-panes {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.pane-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Tab Bar (WeChat mode) */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--sys-divider);
  background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .tab-bar { background: rgba(255,255,255,0.03); }

.tab-btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sys-text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--sys-text); }

.tab-btn.active {
  color: var(--sys-tint);
  border-bottom-color: var(--sys-tint);
}

.tab-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#markdown-edit-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.ios-toolbar {
  height: 50px;
  border-bottom: 1px solid var(--sys-divider);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  background: rgba(255,255,255,0.3);
}

[data-theme="dark"] .ios-toolbar { background: rgba(0,0,0,0.2); }

.toolbar-group {
  display: flex;
  gap: 4px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--sys-divider);
}

.flex-grow {
  flex-grow: 1;
  background: transparent;
}

.tb-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--sys-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.2s;
}

.tb-btn:hover {
  background: var(--sys-divider);
}

.sc-btn {
  font-weight: bold;
}
.text-yellow-400 { color: #FF9F0A; }
.text-red-400 { color: #FF453A; }
.text-green-400 { color: #32D74B; }
.text-gray-400 { color: #8E8E93; }
.text-blue-400 { color: #0A84FF; }
.text-pink-400 { color: #FF2D55; }

#editor {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  padding: 24px;
  font-size: 16px;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--sys-text);
  resize: none;
  outline: none;
}

.pane-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preview-content {
  padding: 24px;
  overflow-y: auto;
  line-height: 1.7;
  flex: 1;
}

.preview-content h1, .preview-content h2, .preview-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

.preview-content p {
  margin-bottom: 1em;
}

.preview-content img {
  max-width: 100%;
  border-radius: var(--sys-radius-sm);
  cursor: zoom-in;
}

.preview-content code {
  background: var(--sys-divider);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, monospace;
}

.preview-content blockquote {
  margin: 1.25em 0;
  padding: 14px 16px;
  border-left: 4px solid var(--sys-tint);
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
  color: var(--sys-text-secondary);
  font-style: italic;
  line-height: 1.6;
}

[data-theme="dark"] .preview-content blockquote {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-left-color: rgba(255,255,255,0.12);
  color: rgba(242,242,247,0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 10px 30px rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.preview-content blockquote p:last-child { margin-bottom: 0; }

.preview-content a {
  color: var(--sys-tint);
  text-decoration: none;
}

.preview-content a:hover {
  text-decoration: underline;
}

.preview-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.preview-content th, .preview-content td {
  border: 1px solid var(--sys-divider);
  padding: 8px 12px;
  text-align: left;
}

.preview-content th {
  background: rgba(0,0,0,0.03);
  font-weight: 600;
}

/* Custom Shortcodes Preview Styles */
.shortcode-block {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 1em 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.shortcode-warn { background: rgba(255, 159, 10, 0.1); border-left: 4px solid #FF9F0A; }
.shortcode-wrong { background: rgba(255, 69, 58, 0.1); border-left: 4px solid #FF453A; }
.shortcode-right { background: rgba(50, 215, 75, 0.1); border-left: 4px solid #32D74B; }
.shortcode-hide {
  background: #000; color: #000; cursor: pointer; -webkit-user-select: none; user-select: none; border-radius: 4px; padding: 2px 6px;
  transition: color 0.3s;
}
.shortcode-hide:hover { color: #fff; }

.shortcode-icon { font-size: 1.2em; line-height: 1; }
.shortcode-content { flex: 1; }
.shortcode-content p:last-child { margin-bottom: 0; }

.media-embed {
  margin: 1.5em 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--sys-card);
  border: 1px solid var(--sys-card-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .media-embed {
  background: linear-gradient(165deg, rgba(38, 40, 47, 0.72), rgba(24, 26, 31, 0.55));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.media-embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(203, 168, 139, 0.22);
}

[data-theme="dark"] .media-embed-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.media-embed-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.media-embed-platform {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  color: #8a6a51;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(203, 168, 139, 0.3);
}

[data-theme="dark"] .media-embed-platform {
  color: #f6d9be;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

.media-embed-link {
  font-size: 0.8rem;
  color: #8a6a51;
  text-decoration: none;
  opacity: 0.85;
}

[data-theme="dark"] .media-embed-link {
  color: #f4e2d2;
}

.media-embed-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
  opacity: 1;
}

.media-embed-title {
  font-size: 0.86rem;
  color: #6f5a47;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(58vw, 420px);
}

[data-theme="dark"] .media-embed-title {
  color: #f0dcc9;
}

.media-embed-body {
  padding: 0.75rem;
}

.media-embed-body iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.media-embed-video iframe {
  aspect-ratio: 16 / 9;
  min-height: 220px;
}

.media-embed-music iframe {
  height: 152px;
  min-height: 152px;
}

.media-embed-netease iframe {
  height: 86px;
  min-height: 86px;
}

.media-fallback-link {
  display: inline-flex;
  margin: 1em 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--sys-divider);
  background: rgba(255, 255, 255, 0.12);
  color: var(--sys-tint);
  text-decoration: none;
}

[data-theme="dark"] .media-fallback-link {
  background: rgba(255, 255, 255, 0.03);
}

/* WeChat Markdown Preview Header */
.wechat-preview-header {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--sys-divider);
}

[data-theme="dark"] .wechat-preview-header { background: rgba(255,255,255,0.03); }

.wechat-preview-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--sys-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 16px;
  gap: 5px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

/* WeChat Article View */
.wechat-article-view {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.wechat-article-view h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.wechat-article-view .article-meta {
  font-size: 13px;
  color: var(--sys-text-secondary);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sys-divider);
}

.wechat-article-view .article-meta span {
  margin-right: 16px;
}

.wechat-article-view .article-body {
  font-size: 16px;
  line-height: 1.9;
  word-wrap: break-word;
}

.wechat-article-view .article-body p {
  margin-bottom: 16px;
  text-indent: 2em;
}

.wechat-article-view .article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px auto;
  border-radius: var(--sys-radius-sm);
  cursor: zoom-in;
}

.wechat-article-view .article-body h1,
.wechat-article-view .article-body h2,
.wechat-article-view .article-body h3 {
  margin: 28px 0 14px;
  font-weight: 600;
}

.wechat-article-view .article-body h1 { font-size: 22px; }
.wechat-article-view .article-body h2 { font-size: 20px; }
.wechat-article-view .article-body h3 { font-size: 18px; }

.wechat-article-view .article-body blockquote {
  border-left: 4px solid var(--sys-tint);
  padding: 10px 20px;
  margin: 16px 0;
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
  color: var(--sys-text-secondary);
}

[data-theme="dark"] .wechat-article-view .article-body blockquote {
  background: rgba(255,255,255,0.02);
}

.wechat-article-view .article-body pre {
  background: #282c34;
  color: #abb2bf;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 14px;
  margin: 16px 0;
}

.wechat-article-view .article-body code {
  background: var(--sys-divider);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: ui-monospace, monospace;
}

.wechat-article-view .article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.wechat-article-view .article-body th,
.wechat-article-view .article-body td {
  border: 1px solid var(--sys-divider);
  padding: 8px 12px;
  text-align: left;
}

.wechat-article-view .article-body th {
  background: rgba(0,0,0,0.03);
  font-weight: 600;
}

.wechat-article-view .article-body a {
  color: var(--sys-tint);
  text-decoration: none;
}

.wechat-article-view .article-body a:hover {
  text-decoration: underline;
}

/* URL Input Row (WeChat mode) */
.url-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.url-input-row input {
  flex: 1;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--sys-divider);
  border-radius: var(--sys-radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--sys-text);
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

[data-theme="dark"] .url-input-row input {
  background: rgba(255,255,255,0.05);
}

.url-input-row input:focus {
  outline: none;
  border-color: var(--sys-tint);
  background: transparent;
}

.url-input-row input::placeholder {
  color: var(--sys-text-secondary);
}

.article-meta-bar {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--sys-text-secondary);
}

.article-meta-bar span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.loading {
  background: rgba(0,122,255,0.12);
  color: var(--sys-tint);
}

.status-badge.success {
  background: rgba(50,215,75,0.12);
  color: #32D74B;
}

.status-badge.error {
  background: rgba(255,69,58,0.12);
  color: #FF453A;
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar {
  height: 3px;
  background: var(--sys-divider);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
  display: none;
}

.progress-bar.active {
  display: block;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sys-tint), var(--sys-tint-hover));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.9);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}

/* Footer */
.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #636366;
  padding: 10px 14px;
  margin: 0 8px 8px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.55));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.app-footer a {
  color: #636366;
  text-decoration: none;
  transition: color 0.2s;
}

.app-footer a:hover { color: var(--sys-text); }

.footer-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 12px;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.footer-left {
  font-size: 12px;
  color: #636366;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #636366;
}

.footer-right a { display: inline-flex; align-items: center; gap: 8px; }
.footer-icon { width: 16px; height: 16px; display: inline-block; object-fit: contain; }

[data-theme="dark"] .app-footer {
  background: linear-gradient(180deg, rgba(28,28,30,0.6), rgba(28,28,30,0.45));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #333; }
::-webkit-scrollbar-thumb:hover { background: var(--sys-tint); }

/* Responsive */
@media (max-width: 720px) {
  .app-container { width: 100vw; height: auto; min-height: 100vh; padding: 8px 0; gap: 8px; }
  body { height: auto; overflow: auto; }
  .glass-header { padding: 0 16px; border-radius: 14px; flex-wrap: wrap; height: auto; min-height: 50px; gap: 8px; }
  .glass-pane { border-radius: 14px; }
  .bottom-panes { flex-direction: column; }
  .meta-top-row { flex-wrap: wrap; }
  .meta-top-row .form-group { flex: 1 1 140px !important; }
  .app-footer { border-radius: 12px; padding: 8px 10px; }
  .footer-inner { justify-content: center; text-align: center; gap: 8px; }
  .footer-left { width: 100%; order: 1; }
  .footer-right { width: 100%; justify-content: center; order: 2; gap: 10px; }
  .footer-right a { font-size: 12px; }
  .header-actions { gap: 8px; }
  .btn-primary { padding: 8px 12px; font-size: 13px; }
  .mode-tabs { margin-left: 0; }
  .url-input-row { flex-direction: column; }
  .url-input-row .btn-primary { width: 100%; justify-content: center; }
  .media-embed { padding: 0; border-radius: 14px; }
  .media-embed-body { padding: 0.6rem; }
  .media-embed-video iframe { min-height: 200px; }
}

@media (max-width: 880px) {
  .bottom-panes { flex-direction: column; }
}
