:root {
  --accent: #7c3aed; --accent2: #a78bfa; --bg: #faf5ff; --card: #ffffff;
  --text: #2e1065; --muted: #71717a; --border: #e4e4e7; --ok: #16a34a; --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg); color: var(--text);
}
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; padding: env(safe-area-inset-top) 0 0;
}
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.app-header h1 { margin: 0; font-size: 1.25rem; }
.logout-btn {
  background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 0.8rem; cursor: pointer;
}
.tabs { display: flex; gap: 4px; padding: 0 8px 8px; }
.tab {
  flex: 1; border: none; background: transparent; color: rgba(255, 255, 255, 0.7);
  padding: 10px 8px; font-size: 0.9rem; font-weight: 600; border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent; cursor: pointer;
}
.tab.is-active { color: #fff; background: rgba(255, 255, 255, 0.12); border-bottom-color: #fff; }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.view { display: none; }
.view.is-active { display: block; }

.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(46, 16, 101, 0.06); }
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: 0.9rem; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.req { color: var(--danger); font-size: 0.72rem; margin-left: 4px; }
input, textarea, select {
  width: 100%; padding: 12px; font-size: 1rem; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; color: var(--text); background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%;
  padding: 14px; font-size: 1rem; font-weight: 700; border: none; border-radius: 12px; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.chip {
  display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 0.85rem; cursor: pointer; margin: 0 6px 6px 0;
}
.chip-danger { color: var(--danger); border-color: #fecaca; }

.message { margin: 8px 0 0; font-size: 0.9rem; min-height: 1.2em; }
.message.ok { color: var(--ok); }
.message.error { color: var(--danger); }

.account-item, .post-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.account-item:last-child, .post-item:last-child { border-bottom: none; }
.post-item { flex-direction: column; align-items: stretch; gap: 8px; }
.post-head { display: flex; justify-content: space-between; align-items: center; }
.post-image { max-width: 100%; border-radius: 10px; margin: 6px 0; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem;
  background: var(--bg); color: var(--accent); font-weight: 700;
}
.platform-picker { display: flex; gap: 10px; margin-bottom: 14px; }
.platform-picker label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 0.9rem;
}
.platform-picker input { width: auto; }

.media-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.media-item:last-child { border-bottom: none; }
.media-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.media-item .media-order { font-weight: 700; color: var(--accent); flex-shrink: 0; width: 1.5em; }
.media-item .media-actions { margin-left: auto; display: flex; gap: 4px; flex-shrink: 0; }
.media-item .media-actions button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 0.85rem;
}
.media-item .media-actions button:disabled { opacity: 0.35; cursor: default; }

.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-chips:empty { display: none; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg); color: var(--accent); font-weight: 600;
  border-radius: 999px; padding: 4px 10px; font-size: 0.85rem;
}
.tag-chip button {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0;
}

.preview-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.preview-strip img, .preview-strip video { height: 180px; border-radius: 10px; flex-shrink: 0; }
.hub-strip { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; }
.hub-strip img, .hub-strip video { height: 110px; border-radius: 8px; flex-shrink: 0; }
#preview-caption-text, #preview-tags { white-space: pre-wrap; }
video.post-image { max-width: 100%; max-height: 320px; }

/* 表紙レイヤーエディタ */
#editor-canvas-wrap { display: flex; justify-content: center; }
#editor-canvas {
  position: relative; width: 100%; max-width: 420px;
  background-color: #0f172a; background-size: cover; background-position: center;
  border-radius: 10px; overflow: hidden; touch-action: none; user-select: none;
}
.editor-layer {
  position: absolute; cursor: grab; line-height: 1.4; white-space: pre-wrap;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}
.editor-layer.is-selected { outline: 2px dashed var(--accent2); outline-offset: 2px; }
.editor-layer.has-scrim { background: rgba(0, 0, 0, 0.45); border-radius: 0.25em; padding: 0.35em 0.5em; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--border); cursor: pointer;
}
.color-swatch.is-active { border-color: var(--accent); }
#layer-panel { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }

.tagline { margin: 2px 0 0; font-size: 0.72rem; color: rgba(255, 255, 255, 0.85); }

/* 初回ガイドツアー（コーチマーク） */
#coach-highlight {
  position: fixed; z-index: 90; pointer-events: none;
  border: 3px solid var(--accent2); border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
  transition: all 0.25s ease;
}
#coach-tooltip {
  position: fixed; z-index: 91; background: #fff; border-radius: 14px;
  padding: 16px; max-width: 320px; width: calc(100% - 32px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
#coach-tooltip p { margin: 0 0 12px; font-size: 0.95rem; line-height: 1.7; }

/* 投稿ハブ：グループ（1コンテンツ→SNS別の配信チェックリスト） */
.hub-group { padding: 12px 0; border-bottom: 1px solid var(--border); }
.hub-group:last-child { border-bottom: none; }
.hub-platform-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px;
}
.hub-platform-row.is-posted { background: #f0fdf4; border-color: #bbf7d0; }
.hub-platform-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-platform-head .status-done { color: var(--ok); font-weight: 700; font-size: 0.85rem; }
.hub-caption { color: var(--muted); font-size: 0.88rem; white-space: pre-wrap; margin: 0; }
#hub-summary { font-size: 0.95rem; line-height: 1.7; }
#hub-summary strong { color: var(--accent); font-size: 1.2rem; }
