/* ==========================================================================
 * 共通設定
 * ========================================================================== */
/* 1. 画面全体 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 2. HTML・BODY */
html,
body {
  height: 100%;
  font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
  font-size: 14px;
  color: #333;
  background-color: #f5f5f5;
}

/* ==========================================================================
 * ログイン画面
 * ========================================================================== */
/* 1. ログイン画面コンテナ */
.LoginContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

/* 2. ログインフォームカード */
.LoginCard {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

/* 3. ログインタイトル */
.LoginTitle {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  color: #2c3e50;
}

/* 4. ログインサブタイトル */
.LoginSubtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 30px;
  font-size: 14px;
}

/* 5. ログインフォーム */
.LoginForm .FormGroup {
  margin-bottom: 20px;
}

/* 6. ログイン入力フォーム */
.LoginForm .InputForm {
  padding: 14px 15px;
  font-size: 15px;
}

/* 7. ログインフォームボタン */
.LoginForm .ButtonClass {
  padding: 14px 24px;
  font-size: 16px;
}

/* 8. ログインフォームボタンコンテナ */
.LoginButtonGroup {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}

/* 9. ログインアイコン */
.LoginIcon {
  font-size: 50px;
  color: #667eea;
  text-align: center;
  margin-bottom: 20px;
}

/* 10.ログイン画面レスポンシブ対応 */
@media screen and (max-width: 480px) {
  .LoginCard {
    padding: 30px 20px;
  }
  .LoginTitle {
    font-size: 24px;
  }
}

/* ==========================================================================
 * 会員登録画面
 * ========================================================================== */
/* 1. 会員登録画面コンテナ */
.RegistrationContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

/* 2. 会員登録フォームカード */
.RegistrationCard {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

/* 3. 会員登録タイトル */
.RegistrationTitle {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  color: #2c3e50;
}

/* 4. 会員登録サブタイトル */
.RegistrationSubtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 30px;
  font-size: 14px;
}

/* 5. 会員登録フォーム */
.RegistrationForm .FormGroup {
  margin-bottom: 20px;
}

/* 6. 会員登録入力フォーム */
.RegistrationForm .InputForm {
  padding: 14px 15px;
  font-size: 15px;
}

/* 7. 会員登録フォームボタン */
.RegistrationForm .ButtonClass {
  padding: 14px 24px;
  font-size: 16px;
}

/* 8. 会員登録フォームボタンコンテナ */
.RegistrationButtonGroup {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}

/* 9. 会員登録アイコン */
.RegistrationIcon {
  font-size: 50px;
  color: #667eea;
  text-align: center;
  margin-bottom: 20px;
}

/* 10. 会員登録ヒントテキスト */
.HintText {
  font-size: 12px;
  color: #7f8c8d;
  margin-top: 5px;
}

/* 11. 会員登録画面レスポンシブ対応 */
@media screen and (max-width: 480px) {
  .RegistrationCard {
    padding: 30px 20px;
  }
  .RegistrationTitle {
    font-size: 24px;
  }
}

/* ==========================================================================
 * レイアウト
 * ========================================================================== */
/* 1. ページコンテナ */
.PageContainer {
  display: flex;
  min-height: 100vh;
}

/* 2. メインコンテンツラッパー */
.MainContentWrapper {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* ==========================================================================
 * サイドバー
 * ========================================================================== */
/* 1. サイドバー */
.Sidebar {
  width: 250px;
  background-color: #2c3e50;
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

/* 2. サイドバーヘッダー */
.SidebarHeader {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid #34495e;
}

/* 3. サイドバーヘッダーのタイトル */
.SidebarHeader h1 {
  font-size: 18px;
  font-weight: 600;
}

/* 4. サイドバーメニュー */
.SidebarMenu {
  flex: 1;
  padding: 10px 0;
}

/* 5. サイドバーメニューボタン */
.SidebarItem {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: none;
  background: none;
  color: #ecf0f1;
  width: 100%;
  text-align: left;
  font-size: 14px;
}
.SidebarItem:hover {
  background-color: #34495e;
}
.SidebarItem.Active {
  background-color: #3498db;
}

/* 6. サイドバーメニューボタンアイコン */
.SidebarItem i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

/* 7. サイドバーフッター */
.SidebarFooter {
  padding: 15px 20px;
  border-top: 1px solid #34495e;
}

/* ==========================================================================
 * メイン画面
 * ========================================================================== */
/* 1. メインコンテンツ表示エリア */
.ContentArea {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 25px;
  min-height: calc(100vh - 80px);
}

.WelcomeMessage {
  font-size: 16px;
  color: #7f8c8d;
  margin-bottom: 5px;
}

.UserIdDisplay {
  font-weight: 600;
  color: #2c3e50;
}

.ActionButtons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ProjectTable {
  margin-top: 20px;
}

.FeedbackDetailArea {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 20px;
}

.FeedbackDetailArea .FormGroup {
  margin-bottom: 0;
}

@media screen and (max-width: 768px) {
  .FeedbackDetailArea {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
 * カード・パネル
 * ========================================================================== */
.Card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

.CardSmall {
  width: 100%;
  max-width: 400px;
}

.CardMedium {
  width: 100%;
  max-width: 600px;
}

.CardLarge {
  width: 100%;
  max-width: 900px;
}

.CardTitle {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

.ContentHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ContentTitle {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
}

/* ==========================================================================
 * フォーム要素
 * ========================================================================== */
.FormGroup {
  margin-bottom: 20px;
}

.InputForm {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.InputForm:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.InputForm:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.InputForm::placeholder {
  color: #999;
}

.SelectForm {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background-color: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.SelectForm:focus {
  outline: none;
  border-color: #3498db;
}

.SelectForm:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/* プルダウンのプレースホルダー表示（未選択状態） */
.SelectForm.placeholder {
  color: #999;
}

.SelectForm option {
  color: #333;
}

.SelectForm option:first-child {
  color: #999;
}

.TextAreaForm {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  min-height: 100px;
  resize: none;
  transition: border-color 0.2s ease;
}

.TextAreaForm:focus {
  outline: none;
  border-color: #3498db;
}

.InputWithButton {
  display: flex;
  gap: 10px;
}

.InputWithButton .InputForm {
  flex: 1;
}

/* ==========================================================================
 * ボタン
 * ========================================================================== */
.ButtonClass {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ButtonClass:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.PrimaryButton {
  background-color: #3498db;
  color: #fff;
}

.PrimaryButton:hover:not(:disabled) {
  background-color: #2980b9;
}

.SecondaryButton {
  background-color: #95a5a6;
  color: #fff;
}

.SecondaryButton:hover:not(:disabled) {
  background-color: #7f8c8d;
}

.SuccessButton {
  background-color: #27ae60;
  color: #fff;
}

.SuccessButton:hover:not(:disabled) {
  background-color: #219a52;
}

.DangerButton {
  background-color: #e74c3c;
  color: #fff;
}

.DangerButton:hover:not(:disabled) {
  background-color: #c0392b;
}

.WarningButton {
  background-color: #f39c12;
  color: #fff;
}

.WarningButton:hover:not(:disabled) {
  background-color: #d68910;
}

.SaveButton {
  background-color: #27ae60;
  color: #fff;
}

.SaveButton:hover:not(:disabled) {
  background-color: #219a52;
}

.CloseButton {
  background-color: #95a5a6;
  color: #fff;
}

.CloseButton:hover:not(:disabled) {
  background-color: #7f8c8d;
}

.ClearButton {
  background-color: #f39c12;
  color: #fff;
}

.ClearButton:hover:not(:disabled) {
  background-color: #d68910;
}

.DeleteButton {
  background-color: #e74c3c;
  color: #fff;
}

.DeleteButton:hover:not(:disabled) {
  background-color: #c0392b;
}

.ButtonGroup {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.ButtonGroupCenter {
  justify-content: center;
}

.ButtonGroupRight {
  justify-content: flex-end;
}

.ButtonGroupSpaceBetween {
  justify-content: space-between;
}

.ButtonSmall {
  padding: 8px 16px;
  font-size: 12px;
}

.ButtonFull {
  width: 100%;
}

/* ==========================================================================
 * タブ
 * ========================================================================== */
.TabContainer {
  margin-bottom: 20px;
}

.TabHeader {
  display: flex;
  border-bottom: 2px solid #3498db;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.TabButton {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.TabButton:hover {
  color: #3498db;
  background-color: #f8f9fa;
}

.TabButton.Active {
  color: #3498db;
  border-bottom-color: #3498db;
  font-weight: 600;
}

.TabContent {
  display: none;
}

.TabContent.Active {
  display: block;
}

/* ==========================================================================
 * テーブル
 * ========================================================================== */
.TableContainer {
  overflow-x: auto;
  margin-top: 20px;
}

.DataTable {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.DataTable thead {
  background-color: #34495e;
  color: #fff;
}

.DataTable th {
  padding: 15px 12px;
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.DataTable tbody tr {
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease;
}

.DataTable tbody tr:hover {
  background-color: #f8f9fa;
}

.DataTable td {
  padding: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.DataTable .ActionCell {
  white-space: nowrap;
}

.CellButton {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 5px;
  transition: opacity 0.2s ease;
}

.CellButton:hover {
  opacity: 0.8;
}

.CellButtonPrimary {
  background-color: #3498db;
  color: #fff;
}

.CellButtonDanger {
  background-color: #e74c3c;
  color: #fff;
}

.CellButtonWarning {
  background-color: #f39c12;
  color: #fff;
}

.CellButtonSuccess {
  background-color: #27ae60;
  color: #fff;
}

/* ==========================================================================
 * ページネーション
 * ========================================================================== */
.PaginationContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.PaginationButton {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background-color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.PaginationButton:hover:not(:disabled) {
  background-color: #3498db;
  color: #fff;
  border-color: #3498db;
}

.PaginationButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.PaginationButton.Active {
  background-color: #3498db;
  color: #fff;
  border-color: #3498db;
}

.PaginationInfo {
  color: #666;
  font-size: 14px;
}

.RecordCount {
  margin-bottom: 10px;
  color: #666;
  font-size: 14px;
}

/* ==========================================================================
 * ダイアログ
 * ========================================================================== */
.DialogOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.DialogContainer {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
}

.DialogSmall {
  width: 90%;
  max-width: 400px;
}

.DialogMedium {
  width: 90%;
  max-width: 600px;
}

.DialogLarge {
  width: 90%;
  max-width: 800px;
}

.DialogTitle {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: center;
}

.DialogContent {
  margin-bottom: 20px;
}

.DialogButtonArea {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==========================================================================
 * カラーピッカー
 * ========================================================================== */
.ColorPickerWrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ColorPicker {
  width: 50px;
  height: 40px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.ColorPicker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.ColorPicker::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.ColorCodeInput {
  flex: 1;
  max-width: 120px;
  font-family: monospace;
}

.FormLabel {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  margin-bottom: 8px;
}

/* ==========================================================================
 * スピナー
 * ========================================================================== */
.SpinnerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.Spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: SpinnerAnimation 1s linear infinite;
}

@keyframes SpinnerAnimation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
 * 画像ボックス
 * ========================================================================== */
.ImageBox {
  width: 150px;
  height: 150px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ImageBox:hover {
  border-color: #3498db;
}

.ImageBox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ImageBoxPlaceholder {
  color: #999;
  text-align: center;
}

.ImageBoxPlaceholder i {
  font-size: 40px;
  margin-bottom: 10px;
}

/* ==========================================================================
 * チェックボックス
 * ========================================================================== */
.CheckboxWrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.CheckboxInput {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ==========================================================================
 * ユーティリティ
 * ========================================================================== */
.TextCenter {
  text-align: center;
}

.TextRight {
  text-align: right;
}

.TextLeft {
  text-align: left;
}

.MarginTop10 {
  margin-top: 10px;
}

.MarginTop20 {
  margin-top: 20px;
}

.MarginBottom10 {
  margin-bottom: 10px;
}

.MarginBottom20 {
  margin-bottom: 20px;
}

.Hidden {
  display: none !important;
}

.LinkText {
  color: #3498db;
  cursor: pointer;
  text-decoration: none;
}

.LinkText:hover {
  text-decoration: underline;
}

.ErrorText {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 5px;
}

.SuccessText {
  color: #27ae60;
  font-size: 12px;
  margin-top: 5px;
}

/* ==========================================================================
 * レスポンシブ対応
 * ========================================================================== */
@media screen and (max-width: 768px) {
  .Sidebar {
    position: fixed;
    left: -250px;
    height: 100%;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .Sidebar.Open {
    left: 0;
  }

  .SidebarMenu {
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    -webkit-overflow-scrolling: touch;
  }

  .MainContentWrapper {
    padding: 15px;
  }

  .Card {
    padding: 20px;
  }

  .CardTitle {
    font-size: 20px;
  }

  .ContentHeader {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .ButtonGroup {
    flex-wrap: wrap;
  }

  .DataTable th,
  .DataTable td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .DialogContainer {
    padding: 20px;
    margin: 10px;
  }

  .PaginationContainer {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 480px) {
  .InputForm,
  .SelectForm,
  .TextAreaForm {
    padding: 10px 12px;
    font-size: 16px;
  }

  .ButtonClass {
    padding: 10px 16px;
    font-size: 14px;
  }

  .CardSmall,
  .CardMedium,
  .CardLarge {
    max-width: 100%;
  }
}

/* ==========================================================================
 * メニュートグルボタン（モバイル用）
 * ========================================================================== */
.MenuToggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 101;
  background-color: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  height: 30px;
  width: 30px;
}

@media screen and (max-width: 768px) {
  .MenuToggle {
    display: block;
  }
}

/* ==========================================================================
 * オーバーレイ（モバイルメニュー用）
 * ========================================================================== */
.SidebarOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.SidebarOverlay.Open {
  display: block;
}


/* ==========================================================================
 * 作品管理画面
 * ========================================================================== */
/* 1. 作品タイトル */
.WorkTitle {
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 20px;
  padding: 10px 15px;
  background-color: #ecf0f1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.WorkTitle i {
  color: #3498db;
}

/* 2. サイドバーサブメニュー */
.SidebarSubMenu {
  padding-left: 20px;
  font-size: 13px;
}

.SidebarSubMenu .SidebarItem {
  padding: 10px 15px;
}

/* 3. サイドバー区切り線 */
.SidebarDivider {
  height: 1px;
  background-color: #34495e;
  margin: 10px 15px;
}

/* 4. フォーム行 */
.FormRow {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.FormRow .FormGroup {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

/* ==========================================================================
 * 相関図
 * ========================================================================== */
.RelationContainer {
  display: flex;
  gap: 20px;
  height: calc(100vh - 180px);
  min-height: 600px;
}

.RelationSidebar {
  width: 200px;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  overflow-y: auto;
}

.RelationSidebarTitle {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #2c3e50;
}

.CharacterListItem {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: grab;
  font-size: 12px;
  transition: all 0.2s ease;
}

.CharacterListItem:hover {
  background: #e3f2fd;
  border-color: #3498db;
}

.CharacterListItem.dragging {
  opacity: 0.5;
}

.RelationCanvas {
  flex: 1;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.RelationCanvasSvg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.RelationCanvasSvg line,
.RelationCanvasSvg path {
  pointer-events: stroke;
  cursor: pointer;
}

.RelationObject {
  position: absolute;
  background: #fff;
  border: 2px solid #3498db;
  border-radius: 8px;
  padding: 10px;
  cursor: move;
  min-width: 80px;
  text-align: center;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.RelationObject.selected {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.RelationObject img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 5px;
}

.RelationGroupBox {
  position: absolute;
  border: 2px dashed #9b59b6;
  border-radius: 12px;
  padding: 10px;
  background: rgba(155, 89, 182, 0.05);
  z-index: 1;
}

.RelationGroupLabel {
  position: absolute;
  top: -12px;
  left: 10px;
  background: #9b59b6;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.RelationResizeHandle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #9b59b6;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 10;
}

.RelationResizeHandle.resize-se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.RelationResizeHandle.resize-sw {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}

.RelationResizeHandle.resize-ne {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}

.RelationResizeHandle.resize-nw {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}

.RelationResizeHandle.resize-e {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.RelationResizeHandle.resize-w {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.RelationResizeHandle.resize-n {
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.RelationResizeHandle.resize-s {
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.RelationGroupBox:hover .RelationResizeHandle {
  opacity: 1;
}

.RelationGroupBox .RelationResizeHandle {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.RelationGroupBox.resizing .RelationResizeHandle {
  opacity: 1;
}

.TrashZone {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 60px;
  height: 60px;
  background: #f8f9fa;
  border: 2px dashed #e74c3c;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #e74c3c;
  font-size: 24px;
  transition: all 0.2s ease;
  z-index: 100;
}

.TrashZone.active {
  background: #fee;
  border-style: solid;
  transform: scale(1.1);
}

/* 関係性タイプ選択 */
.RelationTypeSelector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.RelationTypeOption {
  padding: 8px 16px;
  border: 2px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.RelationTypeOption:hover {
  border-color: #3498db;
}

.RelationTypeOption.selected {
  border-color: currentColor;
  background: currentColor;
  color: #fff;
}

/* 相関図モバイル対応 */
@media screen and (max-width: 768px) {
  .RelationContainer {
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  .RelationSidebar {
    width: 100%;
    height: 150px;
    overflow-y: auto;
  }

  .RelationCanvas {
    width: 100%;
    height: calc(100vh - 400px);
    min-height: 400px;
  }
}

/* ==========================================================================
 * ストーリー・プロット
 * ========================================================================== */
.StoryList {
  margin-top: 20px;
}

.StoryItem {
  display: flex;
  align-items: flex-start;
  padding: 15px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: grab;
  transition: all 0.2s ease;
}

.StoryItem:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.StoryItem.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.StoryItem.drag-over {
  border-color: #3498db;
  background: #e3f2fd;
}

.StoryNumber {
  width: 30px;
  height: 30px;
  background: #3498db;
  color: #fff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 12px;
  margin-right: 15px;
  flex-shrink: 0;
}

.StoryContent {
  flex: 1;
}

.StoryNarrator {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.StoryText {
  font-size: 14px;
  line-height: 1.6;
}

.PlotBadge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 10px;
}

.PlotBadge.ki {
  background: #e3f2fd;
  color: #1976d2;
}

.PlotBadge.sho {
  background: #e8f5e9;
  color: #388e3c;
}

.PlotBadge.ten {
  background: #fff3e0;
  color: #f57c00;
}

.PlotBadge.ketsu {
  background: #fce4ec;
  color: #c2185b;
}


/* ==========================================================================
 * カレンダー
 * ========================================================================== */
.CalendarContainer {
  margin-top: 20px;
}

.CalendarHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px;
  background-color: #3498db;
  border-radius: 8px;
  color: #fff;
}

.CalendarHeader h3 {
  margin: 0;
  font-size: 18px;
}

.CalendarNavButton {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.CalendarNavButton:hover {
  background: rgba(255, 255, 255, 0.3);
}

.CalendarGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background-color: #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.CalendarDayHeader {
  background-color: #34495e;
  color: #fff;
  text-align: center;
  padding: 10px 5px;
  font-size: 12px;
  font-weight: bold;
}

.CalendarDayHeader.Sunday {
  color: #ff6b6b;
}

.CalendarDayHeader.Saturday {
  color: #74b9ff;
}

.CalendarDay {
  background-color: #fff;
  min-height: 80px;
  padding: 5px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.CalendarDay:hover {
  background-color: #ecf0f1;
}

.CalendarDay.OtherMonth {
  background-color: #f8f9fa;
  color: #aaa;
}

.CalendarDay.Today {
  background-color: #fff9c4;
}

.CalendarDayNumber {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 5px;
}

.CalendarDay.Sunday .CalendarDayNumber {
  color: #e74c3c;
}

.CalendarDay.Saturday .CalendarDayNumber {
  color: #3498db;
}

.CalendarEvent {
  font-size: 10px;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: #fff;
  background-color: #3498db;
}

.CalendarEvent:hover {
  opacity: 0.8;
}

.CalendarMoreEvents {
  font-size: 10px;
  color: #666;
  text-align: center;
  margin-top: 2px;
}

.CalendarMoreEventsLink {
  cursor: pointer;
  color: #3498db;
  text-decoration: underline;
}

.CalendarMoreEventsLink:hover {
  color: #2980b9;
}

/* 日付スケジュール一覧 */
.DayScheduleList {
  max-height: 400px;
  overflow-y: auto;
}

.DayScheduleItem {
  padding: 12px 15px;
  margin-bottom: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.DayScheduleItem:hover {
  background: #e9ecef;
  transform: translateX(3px);
}

.DayScheduleTitle {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.DaySchedulePeriod {
  font-size: 12px;
  color: #7f8c8d;
}

/* スケジュール詳細モーダル */
.ScheduleModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.ScheduleModalContent {
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ScheduleModalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ScheduleModalHeader h3 {
  margin: 0;
  font-size: 18px;
  color: #2c3e50;
}

.ScheduleModalClose {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.ScheduleModalClose:hover {
  color: #333;
}

.ScheduleColorPicker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.ColorOption {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.ColorOption:hover {
  transform: scale(1.1);
}

.ColorOption.Selected {
  border-color: #2c3e50;
}

@media screen and (max-width: 768px) {
  .CalendarDay {
    min-height: 60px;
    padding: 3px;
  }
  .CalendarDayNumber {
    font-size: 10px;
  }
  .CalendarEvent {
    font-size: 8px;
    padding: 1px 2px;
  }
}


/* ==========================================================================
 * 年表ビジュアル表示
 * ========================================================================== */
.TimelineVisual {
  position: relative;
  padding: 20px 0;
  max-width: 900px;
  margin: 0 auto;
}

.TimelineVisual::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #3498db 0%, #9b59b6 100%);
  transform: translateX(-50%);
  border-radius: 2px;
}

.TimelineItem {
  position: relative;
  width: 50%;
  padding: 10px 30px;
  box-sizing: border-box;
}

.TimelineItem::before {
  content: '';
  position: absolute;
  top: 20px;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 4px solid #3498db;
  border-radius: 50%;
  z-index: 1;
}

.TimelineLeft {
  left: 0;
  padding-right: 40px;
  text-align: right;
}

.TimelineLeft::before {
  right: -8px;
}

.TimelineRight {
  left: 50%;
  padding-left: 40px;
  text-align: left;
}

.TimelineRight::before {
  left: -8px;
}

.TimelineContent {
  text-align: left;
  background: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #3498db;
  transition: transform 0.2s, box-shadow 0.2s;
}

.TimelineContent:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.TimelineRight .TimelineContent {
  border-left: none;
  border-right: 4px solid #9b59b6;
}

.TimelineDate {
  font-size: 12px;
  font-weight: 600;
  color: #3498db;
  margin-bottom: 5px;
}

.TimelineRight .TimelineDate {
  color: #9b59b6;
}

.TimelineTitle {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.TimelineDesc {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media screen and (max-width: 768px) {
  .TimelineVisual::before {
    left: 20px;
  }

  .TimelineItem {
    width: 100%;
    padding-left: 50px;
    padding-right: 15px;
    text-align: left;
  }

  .TimelineLeft,
  .TimelineRight {
    left: 0;
  }

  .TimelineLeft::before,
  .TimelineRight::before {
    left: 12px;
    right: auto;
  }

  .TimelineContent,
  .TimelineRight .TimelineContent {
    border-left: 4px solid #3498db;
    border-right: none;
  }

  .TimelineRight .TimelineDate {
    color: #3498db;
  }
}

/* ==========================================================================
 * 階級組織図表示（階層図形式）
 * ========================================================================== */
.ClassChart {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
}

.ClassChartGroup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  min-width: 300px;
  flex: 1;
  max-width: 100%;
}

.ClassChartGroupTitle {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #fff;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ClassChartGroupTitle i {
  font-size: 18px;
}

.ClassChartHierarchy {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* 序列ごとの行（横並び） */
.ClassChartRankRow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  width: 100%;
  position: relative;
  padding: 10px 0;
}

/* 行間の縦線 */
.ClassChartRankRow:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 20px;
  background: linear-gradient(180deg, #3498db, #9b59b6);
  border-radius: 2px;
}

/* 序列ラベル */
.ClassChartRankLabel {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #3498db;
  margin-bottom: 5px;
  padding: 3px 10px;
  background: rgba(52, 152, 219, 0.1);
  border-radius: 10px;
  display: inline-block;
}

.ClassChartItem {
  position: relative;
  cursor: pointer;
}

.ClassChartNode {
  background: #f8f9fa;
  padding: 12px 15px;
  border-radius: 8px;
  border-left: 4px solid #3498db;
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 150px;
  text-align: center;
}

.ClassChartNode:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.ClassChartRank {
  font-size: 11px;
  font-weight: 600;
  color: #3498db;
  margin-bottom: 3px;
}

.ClassChartName {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
}

.ClassChartDesc {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  line-height: 1.4;
}

@media screen and (max-width: 768px) {
  .ClassChart {
    flex-direction: column;
    padding: 10px;
  }

  .ClassChartGroup {
    max-width: 100%;
    min-width: auto;
  }
}
