@import url('https://fonts.googleapis.com/css2?family=Hachi+Maru+Pop&family=IBM+Plex+Sans+JP:wght@300;400;500;600;700&family=Kaisei+Opti:wght@400;500;700&family=Kiwi+Maru:wght@300;400;500&family=Klee+One:wght@400;600&family=M+PLUS+Rounded+1c:wght@100;300;400;500;700;800;900&family=Zen+Kaku+Gothic+New:wght@300;400;500;700;900&family=Zen+Maru+Gothic:wght@300;400;500;700;900&family=Zen+Old+Mincho:wght@400;500;600;700;900&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Zen Maru Gothic', sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

@media (min-width: 992px) {
  .container {
    flex-direction: row;
  }
}

/* プレビューエリア */
.preview-area {
    flex: 1.5;
    margin-bottom: 20px;
    position: relative; /* 子要素の絶対配置の基準 */
}

/* 背景描画用Canvas */
#backgroundCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* height: 100%; */ /* 親要素基準ではなく aspect-ratio を使う */
    /* aspect-ratio は .schedule-canvas に依存するため削除 */
    z-index: 1;
    border-radius: 0px; /* schedule-canvasと合わせる */
}

.schedule-canvas {
    width: 100%; /* 9:16のアスペクト比のために幅を調整 */
    aspect-ratio: 9 / 16; /* デフォルトは9:16 */
    position: relative; /* schedule-contentの基準 */
    z-index: 2; /* backgroundCanvasより上 */
    /* background-size, background-position は不要 */
    background-color: transparent; /* 背景はbackgroundCanvasに任せる */
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto; /* 中央揃え */
    transition: all 0.3s ease;
}

.schedule-canvas.drag-over {
  box-shadow: 0 0 10px 5px rgba(74, 144, 226, 0.6);
  outline: 2px dashed #4a90e2;
}

.schedule-canvas.aspect-ratio-5-7 {
    aspect-ratio: 5 / 7;
}

.schedule-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 20px 40px; /* 上下パディングを20pxに減らす */
  display: flex;
  flex-direction: column;
  color: white;
  text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.9);
  background-color: rgba(0, 0, 0, 0.3); /* オーバーレイ */
  overflow: hidden; /* スクロールバーを非表示に */
  z-index: 3; /* テキストやオーバーレイが最前面 */
}

.schedule-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.schedule-period {
  font-weight: 500;
  margin-bottom: 30px;
}

.schedule-markdown-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.schedule-markdown-content * {
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

/* markdownから変換されたHTMLのスタイル */
.schedule-markdown-content h1 {
  font-weight: 700;
  margin-bottom: 10px;
}

.schedule-markdown-content h2 {
  font-weight: 500;
  margin-bottom: 30px;
}

.schedule-markdown-content ul {
  list-style-type: none;
  padding-left: 0;
}

.schedule-markdown-content li {
  margin-bottom: 15px;
  font-weight: 500;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
}

.schedule-markdown-content p {
  margin-bottom: 15px;
}

.schedule-markdown-content a:link,
.schedule-markdown-content a:visited,
.schedule-markdown-content a:hover {
  color: inherit;
  text-decoration: none;
}

/* コントロールエリア */
.control-area {
  flex: 1;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.control-section {
  margin-bottom: 30px;
}

.control-section h1 {
    font-size: 22px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #eee;
}

/* ヘッダーセクション（タイトルと説明ボタン） */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-section h1 {
    margin-bottom: 0;
    flex: 1;
}

.header-section .description {
    margin-left: 15px;
}

.control-section h2 {
  font-size: 18px;
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 2px solid #eee;
}
/* 背景画像セレクタ */
.background-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bg-thumbnail {
  width: 80px;
  height: 45px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.bg-thumbnail.selected {
  border-color: #4a90e2;
  transform: scale(1.05);
}

.bg-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* フォント設定タブ */
.font-tabs {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
}

.font-tab {
  padding: 8px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background-color: #f5f5f5;
  margin-right: 5px;
}

.font-tab.active {
  background-color: white;
  border-color: #ddd;
  border-bottom-color: white;
  font-weight: 500;
}

/* フォントサイズコントロール */
.font-size-control {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.font-settings {
  display: none;
}

.font-settings.active {
  display: block;
}

.font-size-control label {
  display: flex;
  align-items: center;
  margin-right: 10px;
  white-space: nowrap;
}

.font-size-control select,
.font-size-control input[type="number"] {
  width: auto;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-left: 5px;
}

.font-size-control input[type="number"] {
  width: 50px;
}

.font-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.font-row label {
  flex: 0 0 auto;
}

/* スケジュールエディタ */
.schedule-editor {
  width: 100%;
}

.schedule-editor textarea {
  width: 100%;
  height: 200px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
  resize: vertical;
}

/* 生成ボタン */
.generate-button {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.generate-button:hover {
    background-color: #3a80d2;
}

/* リセットボタン */
.reset-button-container {
    margin-top: 10px;
    text-align: right;
}

.reset-button {
    padding: 5px 10px;
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-button:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* フォントファミリー */
.font_Hachi_Maru_Pop {
  font-family: 'Hachi Maru Pop', cursive;
}

.font_IBM_Plex_Sans_JP {
  font-family: 'IBM Plex Sans JP', sans-serif;
}

.font_Kaisei_Opti {
  font-family: 'Kaisei Opti', serif;
}

.font_Kiwi_Maru {
  font-family: 'Kiwi Maru', serif;
}

.font_Klee_One {
  font-family: 'Klee One', cursive;
}

.font_M_PLUS_Rounded_1c {
  font-family: 'M PLUS Rounded 1c', sans-serif;
}

.font_Zen_Kaku_Gothic_New {
  font-family: 'Zen Kaku Gothic New', sans-serif;
}

.font_Zen_Maru_Gothic {
  font-family: 'Zen Maru Gothic', sans-serif;
}

.font_Zen_Old_Mincho {
  font-family: 'Zen Old Mincho', serif;
}

/* 著作権表示のスタイル */
.control-section p {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.control-section .emoji {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 4px;
  display: inline-block;
  position: relative;
  top: -1px;
}

.control-section a {
  color: #4a90e2;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.control-section a:hover {
    color: #3a80d2;
    text-decoration: underline;
}

/* 説明テキスト */
.description {
    cursor: pointer;
    position: relative;
    display: inline-block;
    color: #2c3e50;
    font-weight: 500;
    padding: 4px 10px;
    margin-right: 5px;
    border-radius: 4px;
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    border-left: 3px solid #4a90e2;
}

.description::before {
    content: "ⓘ";
    margin-right: 5px;
    font-weight: bold;
    color: #4a90e2;
}

.description:hover {
    background-color: #e9f0f8;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    color: #1a2533;
}

/* マニュアルモーダル */
.manual-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.manual-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 80%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #333;
}

.manual-text {
    margin-top: 20px;
    line-height: 1.6;
}

.manual-text h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #4a90e2;
    font-size: 18px;
}

.manual-text ol,
.manual-text ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.manual-text li {
    margin-bottom: 8px;
    font-family: sans-serif;
    font-size: 95%;
}

.manual-text p {
    margin-bottom: 15px;
    font-family: sans-serif;
    font-size: 95%;
}

.manual-text a:link,
.manual-text a:visited,
.manual-text a:hover {
  color: inherit;
  text-decoration: underline gray;
}

/* その他設定用のスタイル */
.font-settings input[type="range"] {
    width: 150px; /* スライダーの幅を調整 */
    margin-left: 5px;
    vertical-align: middle;
}

.font-settings label span {
    vertical-align: middle;
    margin-left: 5px;
}
