/* =========================================================
   大きい漢字、見やすい漢字 — 共通スタイル
   外部フォント不使用。端末の明朝体・ゴシック体を利用します。
   JavaScriptが参照するid・class・data属性は変更していません。
   ========================================================= */

:root {
  color-scheme: light;

  /* 色（コントラスト比は白地・紙色地の両方で確認済み） */
  --paper: #f7f6f1;        /* ページ背景 */
  --surface: #ffffff;      /* 入力パネル・文字枠 */
  --ink: #1d2623;          /* 本文・漢字 */
  --muted: #4c5752;        /* 補足文（白地で約7.5:1） */
  --line: #d6d3c9;         /* 区切り線・装飾的な枠 */
  --line-strong: #77817c;  /* 入力欄・押せる枠（白地で3:1以上） */
  --green: #24584a;        /* 主ボタン・選択状態 */
  --green-ink: #1f4d41;    /* リンク・強調文字 */
  --green-soft: #e5eee8;   /* 選択中の背景 */
  --focus: #b45309;        /* フォーカス枠 */
  --red: #bd4439;          /* コツ・比較の丸（JS側と同じ色） */
  --tip-bg: #fbf0ec;
  --tip-line: #e0b2a8;
  --notice-bg: #fff7e6;
  --notice-line: #d6ae63;
  --pending: #774c10;
  --grid-line: #c3ccc6;    /* 補助線 */

  /* 書体 */
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "BIZ UDPMincho", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --display: var(--serif);

  /* 寸法 */
  --radius: 10px;
  --radius-lg: 14px;
  --tap: 48px;
  --page: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  line-break: strict;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

button, input { font: inherit; color: inherit; }
button, a, input, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: var(--tap); }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
.compare-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a { color: var(--green-ink); text-underline-offset: 4px; }

input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--green);
  cursor: pointer;
}

/* ---------- ヘッダー ---------- */

.site-header {
  max-width: calc(var(--page) + 48px);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .04em;
  line-height: 1.4;
}

.brand-title { word-break: keep-all; }

.prototype {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 2px 10px;
}

/* ---------- メイン ---------- */

main {
  max-width: calc(var(--page) + 48px);
  margin: 0 auto;
  padding: 20px 24px 8px;
}

/* 入力パネル：入力欄と候補を一つの面にまとめる */
.search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px 24px;
}

label#input-title span { display: inline-block; }

label#input-title {
  display: block;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#reading {
  flex: 1;
  min-width: 0;
  height: 62px;
  padding: 0 16px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 26px;
  color: var(--ink);
}

#reading::placeholder { color: #67716c; font-size: 22px; }
#reading:focus-visible { border-color: var(--green); outline-offset: 2px; }

.primary {
  height: 62px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.primary:hover { background: #1b4539; }

/* 候補（入力欄の直下） */
.results { margin-top: 22px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  flex-wrap: wrap;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.section-heading > span {
  font-size: 15px;
  color: var(--muted);
}

#search-status,
.hint {
  margin: 4px 0 14px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}

#search-status:empty { display: none; }

.candidates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.candidate {
  position: relative;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 16px 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.candidate:hover { background: #f6f8f6; }

.candidate .word {
  font-family: var(--display);
  font-size: clamp(34px, 4.6vw, 42px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.candidate .meaning {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

/* 選択状態は色・枠の太さ・文字ラベルの3つで示す */
.candidate[aria-pressed="true"] {
  border: 3px solid var(--green);
  padding: 14px 8px 12px;
  background: var(--green-soft);
}

.candidate[aria-pressed="true"]::after {
  content: "選択中";
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 8px 1px;
  border-radius: 0 0 6px 0;
  background: var(--green);
  color: #fff;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.more-candidates {
  grid-column: 1 / -1;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 17px;
  font-weight: 600;
}

.more-candidates:hover { background: #eeede6; }

/* 季節の言葉 */
.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}

.examples > span {
  width: 100%;
  font-weight: 600;
}

.examples button {
  min-height: 44px;
  padding: 4px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
}

.examples button:hover { background: var(--green-soft); }

/* ---------- 選んだ言葉の1文字ずつ表示 ---------- */

.selected-section { margin-top: 28px; }

#selected-reading {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.selected-section .section-heading:has(#selected-reading:empty) { display: none; }
.selected-section .hint { margin-top: 2px; }

.characters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.character {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  font-family: var(--display);
  font-size: clamp(60px, 19vw, 150px);
  line-height: 1;
  color: var(--ink);
}

.character:hover { border-color: var(--green); }

.character::after {
  content: "拡大";
  position: absolute;
  right: 6px;
  bottom: 5px;
  font: 600 13px/1.4 var(--sans);
  color: var(--muted);
}

/* 1〜2文字の言葉は列を減らし、拡大を開かなくても大きく見えるようにする */
@supports (container-type: inline-size) {
  .characters { container-type: inline-size; }
  .character { font-size: clamp(60px, 22cqw, 150px); }
  .characters:has(> .character:first-child:nth-last-child(2)) {
    grid-template-columns: repeat(2, minmax(0, 320px));
  }
  .characters:has(> .character:first-child:nth-last-child(2)) .character {
    font-size: clamp(60px, 34cqw, 224px);
  }
  .characters:has(> .character:only-child) {
    grid-template-columns: minmax(0, 420px);
  }
  .characters:has(> .character:only-child) .character {
    font-size: min(70cqw, 294px);
  }
}

/* 補助線：十字の点線（硬筆の練習用紙に近い見え方） */
.writing-grid {
  background-image:
    repeating-linear-gradient(to bottom, var(--grid-line) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(to right, var(--grid-line) 0 6px, transparent 6px 12px);
  background-size: 1px 100%, 100% 1px;
  background-position: center center, center center;
  background-repeat: no-repeat;
}

body.no-grid .writing-grid { background-image: none; }

/* 書体・補助線 */
.display-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 16px;
  font-size: 16px;
  color: var(--muted);
}

.display-options > span { font-weight: 600; margin-right: 2px; }

.font-option {
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
}

/* 選択中は塗り＋チェック記号＋太字 */
.font-option.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.font-option.active::before { content: "✓ "; }

.grid-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-left: auto;
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}

/* 画面をつけたままにする */
.keep-screen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  margin: 4px 0 0;
  font-size: 17px;
}

.keep-screen label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  cursor: pointer;
}

.keep-screen span {
  font-size: 15px;
  color: var(--green-ink);
  font-weight: 600;
}

.keep-screen span:empty { display: none; }
.keep-screen label:has(input:disabled) { color: var(--muted); cursor: not-allowed; }

/* 比較への入口：検索より控えめな枠線ボタン */
.compare-entry {
  width: 100%;
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
}

.compare-entry:hover { background: var(--surface); }

.compare-entry span {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  color: var(--green-ink);
}

.privacy {
  text-wrap: pretty;
  margin: 28px 0 36px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
}

/* ---------- フッター ---------- */

footer,
.info-footer {
  max-width: calc(var(--page) + 48px);
  margin: 0 auto;
  padding: 18px 24px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}

.info-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 22px;
}

.info-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--green-ink);
}

/* ---------- ダイアログ共通 ---------- */

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 16px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}

dialog::backdrop { background: rgba(21, 33, 29, .72); }

body:has(dialog[open]) { overflow: hidden; }

.zoom-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 17px;
  font-weight: 700;
}

.zoom-top button,
.zoom-nav button {
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

.zoom-top button:hover,
.zoom-nav button:not(:disabled):hover { background: var(--green-soft); }

/* ---------- 1文字拡大画面 ---------- */

.zoom-keep {
  margin: 4px 0 0;
  font-size: 16px;
}

#zoom-character {
  height: min(56dvh, 520px);
  margin: 10px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  font-family: var(--display);
  font-size: min(64vw, 46dvh, 430px);
  line-height: 1;
  overflow: hidden;
}

#zoom-character svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

#zoom-dialog:has(#writing-tip-panel:not([hidden])) #zoom-character {
  height: min(44dvh, 440px);
}

.writing-tip-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 0 12px;
}

.writing-tip-controls button {
  min-height: var(--tap);
  padding: 0 18px;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--surface);
  color: #9b3027;
  font-size: 17px;
  font-weight: 700;
}

.writing-tip-controls button[aria-expanded="true"] { background: var(--tip-bg); }

.writing-tip-controls button:disabled {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: default;
}

.writing-tip-controls span {
  font-size: 15px;
  color: var(--muted);
}

#writing-tip-panel {
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--tip-line);
  border-radius: var(--radius);
  background: var(--tip-bg);
}

#writing-tip-text {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.75;
}

#writing-tip-panel small {
  font-size: 14px;
  color: var(--muted);
}

.zoom-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.zoom-nav button { min-height: 52px; }
.zoom-nav button:disabled { opacity: .4; cursor: default; }

#zoom-position {
  min-width: 4em;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

/* ---------- 比較画面 ---------- */

#compare-dialog { width: min(1040px, calc(100vw - 32px)); }

#compare-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.5;
}

.compare-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.compare-groups button {
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--serif);
  font-size: 21px;
}

.compare-groups button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.compare-groups button[aria-pressed="true"]::before {
  content: "✓ ";
  font-family: var(--sans);
  font-size: 17px;
}

#compare-description { color: var(--ink); margin: 6px 0 4px; }

.compare-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin: 0 0 8px;
  font-size: 17px;
}

.compare-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  cursor: pointer;
}

.compare-scroll-hint {
  display: none;
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--muted);
}

.compare-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  padding-bottom: 4px;
}

#compare-cards {
  display: grid;
  grid-template-columns: repeat(var(--compare-count, 4), minmax(0, 1fr));
  gap: 12px;
}

.compare-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.compare-card svg {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.compare-card figcaption {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.7;
}

.hide-marks .compare-mark { display: none; }

.larger-comparison #compare-cards { grid-template-columns: repeat(var(--compare-count, 4), 360px); }
.larger-comparison .compare-scroll-hint { display: block; }

#compare-dialog > .hint { margin: 12px 0 0; font-size: 15px; }

.compare-name-note {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}

/* ---------- 運営情報ページ ---------- */

.info-page {
  max-width: calc(var(--page) + 48px);
  padding-top: 16px;
  padding-bottom: 48px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: 17px;
  font-weight: 600;
}

.info-page h1 {
  margin: 10px 0 18px;
  font-size: clamp(27px, 5vw, 34px);
  line-height: 1.45;
  letter-spacing: .03em;
}

.info-page h2 {
  margin: 36px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 21px;
  line-height: 1.55;
}

.info-page p,
.info-page li { line-height: 1.95; }
.info-page p { margin: 10px 0; }
.info-page ul { padding-left: 1.4em; }
.info-page li { margin: 6px 0; }

.page-lead { font-size: 18px; }
.policy-date { font-size: 15px; color: var(--muted); }

.draft-notice,
.contact-status {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: var(--radius);
}

.draft-notice {
  border: 1px solid var(--notice-line);
  background: var(--notice-bg);
}

.draft-notice p { margin: 4px 0 0; }

.contact-status {
  border: 1px solid var(--line);
  background: var(--surface);
}

.contact-status h2 { margin-top: 0; padding-top: 0; border-top: 0; }

.pending-value { color: var(--pending); font-weight: 600; }

.operator-details { margin: 20px 0 0; }
.operator-details dt { margin-top: 16px; font-weight: 700; }
.operator-details dd { margin: 4px 0 0; }

/* ---------- 印刷文字と手書きの比較記事 ---------- */

.handwriting-entry { margin: 14px 0 0; }
.handwriting-entry a { display: inline-flex; align-items: center; min-height: var(--tap); }
.handwriting-page .source-marker { font-size: 14px; white-space: nowrap; }
.glyph-comparison {
  margin: 22px 0 16px;
  padding: 18px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.glyph-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.glyph-example { min-width: 0; text-align: center; }
.glyph-label { display: block; color: var(--green-ink); font-size: 16px; font-weight: 700; }
.glyph-example img { display: block; width: 100%; max-width: 220px; height: auto; margin: 4px auto; }
.glyph-detail { display: block; font-size: 14px; line-height: 1.65; }
.glyph-comparison figcaption { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.8; }
.handwriting-page .figure-source { color: var(--muted); font-size: 14px; line-height: 1.8; }
.reference-link { display: inline-flex; flex-direction: column; justify-content: center; min-height: var(--tap); padding: 8px 0; }
.reference-link span { color: var(--muted); font-size: 14px; }
.article-sources { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.article-sources .sources-label { font-weight: 700; color: var(--ink); }
.article-sources li { margin-bottom: 14px; }
.article-sources li:target { background: var(--green-soft); outline: 4px solid var(--green-soft); }
.article-return { margin-top: 24px; }

/* ---------- 画面幅別 ---------- */

@media (min-width: 701px) {
  .characters { gap: 16px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .site-header { padding: 10px 16px; }
  .brand { font-size: 18px; letter-spacing: .02em; }
  main { padding: 14px 14px 4px; }
  .search-panel { padding: 18px 16px 18px; border-radius: 12px; }
  .candidates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .candidate { min-height: 100px; }
  .candidate .word { font-size: 34px; }
  .characters { gap: 8px; }
  .character { border-radius: 8px; }
  .character::after { right: 4px; bottom: 2px; font-size: 12px; }
  .display-options .grid-toggle { margin-left: 0; }
  .info-page { padding-left: 18px; padding-right: 18px; }
  .info-page h2 { font-size: 20px; }
  footer, .info-footer { padding: 16px 16px 24px; }

  /* 拡大・比較はスマホでは全画面にして文字を最大化 */
  dialog,
  #compare-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 10px 14px 16px;
    border: 0;
    border-radius: 0;
  }

  #zoom-dialog[open] { display: flex; flex-direction: column; }
  #zoom-character {
    flex: 1 0 auto;
    height: auto;
    min-height: min(78vw, calc(100dvh - 300px));
    font-size: min(78vw, calc(100dvh - 340px));
  }
  #zoom-dialog:has(#writing-tip-panel:not([hidden])) #zoom-character {
    height: auto;
    min-height: min(74vw, calc(100dvh - 430px));
    font-size: min(74vw, calc(100dvh - 450px));
  }
  .zoom-nav { margin-top: auto; }

  #compare-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #compare-cards[data-group="nabe"] .compare-card:first-child {
    grid-column: 1 / -1;
    width: calc(50% - 4px);
    justify-self: center;
  }
  /* 邊・邉を上段に並べ、辺は下段で参照用に（DOM順は維持） */
  #compare-cards[data-group="nabe"] .compare-card:first-child { order: 1; }
  .compare-card figcaption { padding: 8px 10px 10px; font-size: 14px; }
  .compare-groups button { font-size: 19px; padding: 0 14px; }
  .larger-comparison #compare-cards { grid-template-columns: repeat(var(--compare-count, 4), min(280px, 80vw)); }
  .larger-comparison #compare-cards[data-group="nabe"] .compare-card:first-child {
    grid-column: auto;
    width: auto;
    justify-self: stretch;
    order: 0;
  }
  .privacy { text-align: left; }
}

/* 狭いスマホ（320〜430px）では入力とボタンを縦に並べる */
@media (max-width: 440px) {
  .input-row { flex-direction: column; }
  #reading { flex: none; width: 100%; height: 60px; }
  .primary { width: 100%; height: 56px; }
  .compare-entry span { font-size: 16px; }
}

@media (max-width: 359px) {
  .brand { font-size: 17px; }
  .prototype { font-size: 13px; padding: 1px 8px; }
  .candidate .word { font-size: 30px; }
  .zoom-top button, .zoom-nav button { padding: 0 12px; }
  .display-options > span { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .15s, border-color .15s; }
}
