:root{
  --paper:#ffffff;
  --ink:#111111;
  --muted:#444444;
  --line:#c9c9c9;
  --soft:#f4f4f4;
  --ok:#0a7a2f;
  --ng:#b00020;
}
*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
.wrap{ max-width: 980px; margin: 28px auto; padding: 0 16px; }
.card{ background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 18px 18px 22px; }
h1{
  font-size: 20px; margin: 0 0 10px;
  padding-bottom: 10px; border-bottom: 2px solid var(--ink);
  letter-spacing: .02em;
}
h2{ font-size: 14px; margin: 14px 0 10px; color: var(--ink); font-weight: 700; }
.row{ display:flex; gap:12px; flex-wrap: wrap; align-items: flex-end; }
label{ display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], select{
  width: 260px; max-width: 100%;
  padding: 10px 12px; border-radius: 4px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); outline: none;
}
select{ width: 240px; }
input:focus, select:focus{
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}
button{
  padding: 9px 14px; border-radius: 4px;
  border: 1px solid var(--ink); background: #fff; color: var(--ink);
  cursor:pointer; font-weight: 700;
}
button:hover{ background: var(--soft); }
button:disabled{ opacity:.5; cursor:not-allowed; border-color: var(--line); color: var(--muted); }
.pill{ display:flex; gap:10px; flex-wrap: wrap; }
.stat{
  border: 1px solid var(--line); background: #fff;
  border-radius: 4px; padding: 6px 10px;
  font-size: 12px; color: var(--ink);
}
.big{ font-size: 18px; font-weight: 800; }
.kana{ font-size: 22px; line-height: 1.7; margin: 10px 0 8px; word-break: break-word; }
.romajiLine{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 18px; line-height: 1.8;
  padding: 12px; border-radius: 4px;
  border: 1px solid var(--line); background: #fff;
  word-break: break-word;
}
.ok{ color: var(--ok); }
.ng{ color: var(--ng); }
.hint{ color: var(--muted); font-size: 12px; margin-top: 10px; }
.divider{ height: 1px; background: var(--line); margin: 14px 0; }
.hidden{ display:none; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.toast{ margin-top: 10px; font-size: 12px; color: var(--muted); }
.resultBox{ background:#fff; border:1px solid var(--line); border-radius: 4px; padding: 12px; }
.resultBox pre{ margin:0; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.mt12{ margin-top:12px; }
.m0{ margin:0; }
.mb8{ margin-bottom:8px; }
.muted{ color: var(--muted); }
@media (max-width: 640px){
  input[type="text"], select{ width: 100%; }
}
@media print{
  body{ background:#fff; }
  .wrap{ margin:0; padding:0; }
  .card{ border:none; padding:0; }
  button{ display:none !important; }
}


/* v6b: classroom minimal UI (non-breaking hides) */
#btnReload, #btnDemoFill { display: none !important; }

/* hide the status pill block on setup (読み込み状態/課題数/ファイル) */
#screen-setup .pill.mt12 { display: none !important; }

/* hide "②タイピング" heading */
#screen-typing > h2 { display: none !important; }

/* hide the long explanatory hint under the toast on typing screen */
#screen-typing .toast + p.hint { display: none !important; }


/* v7: result page refinements */

/* 結果ページ：全指標のフォントサイズを統一（時間サイズに合わせる） */
#screen-result .stat.big{
  font-size: 12px;
  font-weight: 700;
}

/* Googleフォーム説明文を非表示 */
#screen-result .resultBox .hint{
  display: none !important;
}


/* v8: hide entire Google Form helper block */
#screen-result .resultBox{
  display: none !important;
}


/* v9: result font normal weight */
#screen-result .stat,
#screen-result .stat.big{
  font-weight: 400;
}


/* v13: history table */
.historyBox{
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}
.tableWrap{
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.historyTable{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
}
.historyTable th, .historyTable td{
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.historyTable thead th{
  border-top: none;
  background: var(--soft);
  font-weight: 700;
}
@media print{
  /* setup/typingは印刷しない */
  #screen-setup, #screen-typing{ display:none !important; }
  #screen-result{ display:block !important; }

  /* 操作ボタンは印刷しない */
  #btnBack, #btnRetrySame, #btnPrintHistory, #btnClearHistory{ display:none !important; }

  /* resultBox（JSONなど）は印刷しない */
  #screen-result .resultBox{ display:none !important; }

  /* 用紙に収める */
  .wrap{ margin:0; max-width:none; padding:0; }
  .card{ border:none; padding:0; }
}


/* v14: clean history view (table only) */
.historyBox .row,
.historyBox .hint{
  display:none !important;
}


/* v16: setup screen should not show navigation buttons */
#screen-setup #btnBack,
#screen-setup #btnRetrySame{
  display: none !important;
}


/* v16c: safety - hide result-only controls unless result screen is visible */
[data-role="result-only"]{ display:none !important; }
#screen-result:not(.hidden) [data-role="result-only"]{ display:inline-block !important; }
