/* ==================== ページ全体 ==================== */
body { font-family: sans-serif; max-width: 600px; margin: 10px auto; padding: 0 15px; color: #333; background-color: #f7f9fa; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { flex: 1; font-size: 20px; text-align: center; color: #2c3e50; }
#languageSelect { padding: 3px 6px; font-size: 12px; }
.site-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 8px 0; padding: 8px 4px; border-top: 1px solid #c6def2; border-bottom: 1px solid #c6def2; font-size: 14px; line-height: 1.5; }
.site-nav a { color: #06c; }
.site-nav a:visited { color: #551a8b; }
.site-nav a[aria-current="page"] { color: #344054; font-weight: bold; text-decoration: none; }

/* ==================== サービスの説明 ==================== */
.about-section { margin: 0 0 8px; padding: 10px 4px 4px; border-top: 1px solid #c6def2; border-bottom: 1px solid #c6def2; color: #475467; font-size: 12px; line-height: 1.6; }
.about-section h2 { margin: 0 0 5px; font-size: 15px; color: #344054; }
.about-section p { margin: 4px 0; }
.about-section ol { margin: 5px 0; padding-left: 20px; }
.about-section li { margin: 2px 0; }
.about-section h3 { margin: 8px 0 3px; font-size: 13px; color: #344054; }
.about-section dl { margin: 4px 0; }
.about-section dt { margin-top: 5px; font-weight: bold; color: #344054; }
.about-section dd { margin: 1px 0 0 8px; }
.reference-list { margin: 5px 0; padding-left: 20px; }
.reference-list li { margin: 5px 0; overflow-wrap: anywhere; }
.about-note { color: #667085; font-size: 11px; }
.home-intro { padding: 16px 12px 12px; font-size: 15px; line-height: 1.8; }
.home-intro h2 { margin-bottom: 8px; font-size: 20px; }
.home-intro h3 { margin-top: 14px; font-size: 16px; }
.home-intro li { margin: 4px 0; }
.home-intro .about-note { font-size: 13px; }
.intro-links { margin-top: 12px !important; }
#converter { scroll-margin-top: 12px; }

/* ==================== 入力パネル ==================== */
.control-panel { background: #fff; padding: 6px 15px 6px; border: 1px solid #c6def2; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 8px; }
.option-group { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 6px; font-size: 12px; font-weight: bold; }
.option-group.radio-group { display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 8px; align-items: start; }
.option-group.radio-group label { display: flex; align-items: flex-start; gap: 4px; }

/* チェックボックスのラベルを入力とテキストで中央揃えにする（radio-group には影響しない） */
.option-group:not(.radio-group) > label { display: flex; align-items: center; gap: 8px; }
.option-group.radio-group label input[type="radio"] {
  flex: 0 0 auto; appearance: none; -webkit-appearance: none; margin: 2px 0 0;
  width: 14px; height: 14px; box-sizing: border-box; border: 2px solid #999; border-radius: 50%; position: relative;
}
.option-group.radio-group label input[type="radio"]:checked { border-color: #3498db; }
.option-group.radio-group label input[type="radio"]:checked::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 6px; height: 6px; border-radius: 50%; background: #3498db;
}
.option-break { display: none; }
@media (max-width: 432px) {
  .option-group.radio-group { grid-template-columns: 140px minmax(0, 1fr); column-gap: 16px; }
  .option-group.radio-group label span { white-space: nowrap; }
  html[lang="en"] .option-break { display: block; }
}
textarea { display: block; width: 100%; height: 48px; font-size: 11px; padding: 1px 6px 6px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 6px; font-family: inherit; }
#inputText:focus { outline: none; border-width: 2px; border-color: #ccc; }
#inputText::placeholder { font-size: 12px; }
.example-action { display: flex; margin-top: 3px; }

/* ==================== かなカナ表示／母字表示パネル ==================== */
.result-section { background: #fff; padding: 0px 15px 9px; border: 1px solid #c6def2; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.label { font-size: 12px; color: #7f8c8d; margin-top: 3px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
.editable-area { width: 100%; height: 48px; font-size: 11px; padding: 1px 6px 6px; box-sizing: border-box; border: 1px solid #3498db; border-radius: 4px; background: #f4f9ff;}
.editable-area:focus { outline: none; border-width: 2px; border-color: #3498db; }

/* 母字表示エリア */
.display-area { max-width: 100%; box-sizing: border-box; font-size: 12px; font-weight: bold; min-height: 30px; word-break: break-all; white-space: pre-wrap; margin-top: 3px; padding: 1px 6px 6px; background: #fdf2e9; border: 1px solid #e67e22; border-radius: 4px; color: #d35400; line-height: 1.2; }
.display-area .small-char { font-size: 0.7em; vertical-align: baseline; display: inline-block; }
.jigen-width-control { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: #7f8c8d; font-size: 11px; }
.jigen-width-control input { width: 90px; height: 12px; margin: 0; appearance: none; background: transparent; cursor: pointer; }
.jigen-width-control input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #f4c59e; }
.jigen-width-control input::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -3px; appearance: none; border: 1px solid #c65e0a; border-radius: 50%; background: #e67e22; }
.jigen-width-control output { min-width: 32px; }

/* アクションボタン群 */
.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn { border: none; padding: 1px 6px; font-size: 11px; font-weight: bold; border-radius: 4px; cursor: pointer; transition: background 0.2s; display: inline-flex; align-items: center; gap: 4px; }
.btn-x { background: #000; color: #fff; }
.btn-x:hover { background: #333; }
.btn-copy { background: #e0e0e0; color: #333; }
.btn-copy:hover { background: #d0d0d0; }
.btn-kana-img { background: #3498db; color: #fff; }
.btn-kana-img:hover { background: #217dbb; }
.btn-jigen-img { background: #e67e22; color: #fff; }
.btn-jigen-img:hover { background: #d35400; }

/* ==================== Yahoo!ニュースパネル ==================== */
.news-section { background: #fff; padding: 8px 15px 8px; border: 1px solid #c6def2; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 6px; }
.news-section h2 { font-size: 16px; margin: 0 0 5px; color: #2c3e50; }
.news-section h2 a { color: #06c; }
.news-list { margin: 0; padding-left: 24px; list-style-type: disc; }
.news-list li::marker { font-size: 0.30em; }
.news-list li { margin: 0; line-height: 1.2; }
.news-new { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 8px; background: #ffad00; color: #fff; font-size: 10px; font-weight: bold; line-height: 1.2; vertical-align: 2px; }
.news-list a { color: #06c; font-size: 14px; text-decoration: none; }
.news-list a:visited { color: #551a8b; }
.news-list a:hover { color: #004b99; text-decoration: underline; }
.news-original { display: block; color: #7f8c8d; font-size: 11px; line-height: 1.1; }
.news-original-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; line-height: 1.1; }
.news-original-row .news-original { flex: 0 0 auto; min-width: 169px; margin: 0; }
.news-copy { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 2px 7px; border: 0; border-radius: 999px; background: #7f8c8d; color: #fff; font-size: 10px; line-height: 1; cursor: pointer; }
.news-copy:hover { background: #555; }
.news-status { margin: 0; color: #7f8c8d; font-size: 13px; }
.news-toggle { margin-top: 4px; padding: 3px 8px; border: 1px solid #c6def2; border-radius: 3px; background: #fff; color: #06c; font-size: 11px; cursor: pointer; }
.news-toggle:hover { background: #f0f7ff; }

/* ひらがなの由来 */
.hiragana-origin-section { margin-top: 12px; padding: 10px 4px 4px; border-top: 1px solid #c6def2; color: #667085; font-size: 11px; line-height: 1.5; }
.hiragana-origin-section h2 { margin: 0 0 6px; font-size: 13px; color: #344054; }
.origin-content { display: flex; align-items: flex-start; gap: 10px; }
.hiragana-origin-preview { display: block; flex: 1 1 0; min-width: 0; box-sizing: border-box; padding: 0; border: 1px solid #c6def2; border-radius: 4px; background: #fff; cursor: zoom-in; }
.hiragana-origin-preview img { display: block; width: 100%; max-width: none; height: auto; }
.origin-table-wrap { min-width: 0; flex: 1 1 0; }
.origin-table-actions { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 4px; }
.origin-table-copy { flex: 0 1 auto; min-width: 0; padding: 3px 4px; border: 1px solid #c6def2; border-radius: 4px; background: #fff; color: #344054; font-size: 11px; line-height: 1; white-space: nowrap; cursor: pointer; }
.origin-table-copy .label-short { display: none; }
.origin-table-copy:hover { background: #f2f4f7; }
.origin-table { width: calc(100% + 2px); border-collapse: collapse; table-layout: fixed; direction: rtl; text-align: center; color: #344054; font-size: 13px; }
.origin-table td { padding: 3px 0; border: 1px solid #c6def2; direction: ltr; }
.origin-table .origin-kanji { display: block; font-weight: bold; }
.origin-table .origin-kana { display: block; color: #667085; font-size: 11px; }
.image-attribution { margin: 4px 0 0; }
.hiragana-origin-section a { color: #06c; }
.hiragana-origin-section a:visited { color: #551a8b; }

.image-dialog { width: min(92vw, 760px); max-height: 92vh; padding: 0; border: 0; background: transparent; }
.image-dialog::backdrop { background: rgba(16, 24, 40, 0.72); }
.image-dialog-content { max-height: 92vh; overflow: auto; padding: 12px; border-radius: 6px; background: #fff; box-sizing: border-box; }
.image-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.image-dialog-header h2 { margin: 0; font-size: 16px; color: #344054; }
.image-dialog-close { width: 28px; height: 28px; padding: 0; border: 1px solid #98a2b3; border-radius: 4px; background: #fff; color: #344054; font-size: 22px; line-height: 1; cursor: pointer; }
.image-dialog-close:hover { background: #f2f4f7; }
.image-dialog-content > img { display: block; width: 100%; height: auto; }

@media (max-width: 420px) {
  .origin-content { gap: 6px; }
  .origin-table { font-size: 11px; }
  .origin-table td { padding: 2px 0; }
  .origin-table .origin-kana { font-size: 9px; }
  .origin-table-copy .label-full { display: none; }
  .origin-table-copy .label-short { display: inline; }
}

/* フッター */
.site-footer { margin-top: 12px; padding: 10px 4px 4px; border-top: 1px solid #c6def2; color: #667085; font-size: 11px; line-height: 1.5; }
.site-footer h2 { margin: 0 0 4px; font-size: 13px; color: #344054; }
.site-footer p { margin: 3px 0; }
.site-footer > p:last-child { text-align: center; }
.site-footer a { color: #06c; }
.site-footer a:visited { color: #551a8b; }

@media (min-width: 768px) {
  body { max-width: 540px; }
  textarea { font-size: 16px; }
  .editable-area,
  .display-area { font-size: 16px; }
}
