/* =========================================================
   毎日更新記事（Webアプリ / ノウハウ / 話題・考察）用スタイル
   既存 style.css の .howto-article を土台に上書きします。
   ========================================================= */

.daily-article {
  --daily-color: #2563eb;
  --daily-soft: #eff5ff;
  --daily-line: rgba(37, 99, 235, 0.22);
}
.daily-article.daily-howto {
  --daily-color: #0f766e;
  --daily-soft: #ecfbf8;
  --daily-line: rgba(15, 118, 110, 0.22);
}
.daily-article.daily-topics {
  --daily-color: #b45309;
  --daily-soft: #fff7ea;
  --daily-line: rgba(180, 83, 9, 0.22);
}

/* ---------- メタ情報 ---------- */
.daily-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 14px;
  color: var(--muted, #6b7280);
  font-size: 0.88rem;
}
.daily-meta .daily-section {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--daily-color);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.daily-meta .daily-section:hover,
.daily-meta .daily-section:focus-visible {
  filter: brightness(0.92);
}
.daily-meta .daily-category {
  color: var(--daily-color);
  font-weight: 700;
}

.daily-article h1 {
  line-height: 1.45;
}
.daily-article h2 {
  scroll-margin-top: 80px;
  border-left: 5px solid var(--daily-color);
  padding-left: 12px;
}
.daily-article h3 {
  color: var(--daily-color);
}

/* ---------- 目次 ---------- */
.daily-toc {
  margin: 22px 0 30px;
  padding: 16px 20px 12px;
  border: 1px solid var(--daily-line);
  border-radius: 12px;
  background: var(--daily-soft);
}
.daily-toc-title {
  margin: 0 0 6px !important;
  font-weight: 700;
}
.daily-toc ol {
  margin: 0;
  padding-left: 1.4em;
}
.daily-toc li {
  margin: 4px 0;
  line-height: 1.6;
}
.daily-toc a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--daily-line);
  text-underline-offset: 3px;
}
.daily-toc a:hover {
  color: var(--daily-color);
}

/* ---------- 本文パーツ ---------- */
.daily-body ul,
.daily-body ol {
  padding-left: 1.4em;
}
.daily-body li {
  margin: 6px 0;
  line-height: 1.8;
}
.daily-note {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--daily-color);
  border-radius: 8px;
  background: var(--daily-soft);
  line-height: 1.8;
}
.daily-note-warn {
  border-left-color: #d97706;
  background: #fff8e6;
}
.daily-note p:last-child {
  margin-bottom: 0;
}
.daily-table-wrap {
  overflow-x: auto;
  margin: 18px 0 26px;
}
.daily-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.daily-table th,
.daily-table td {
  padding: 10px 12px;
  border: 1px solid var(--line, #e5e7eb);
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}
.daily-table th {
  background: var(--daily-soft);
}
.daily-body pre {
  overflow-x: auto;
  margin: 16px 0 24px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.86rem;
  line-height: 1.65;
}
.daily-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.daily-steps {
  counter-reset: daily-step;
  list-style: none;
  padding-left: 0 !important;
}
.daily-steps > li {
  position: relative;
  padding-left: 44px;
  margin: 14px 0;
}
.daily-steps > li::before {
  counter-increment: daily-step;
  content: counter(daily-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--daily-color);
  color: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 30px;
}
.daily-faq dt {
  margin-top: 16px;
  font-weight: 700;
}
.daily-faq dd {
  margin: 6px 0 0;
  line-height: 1.8;
}

/* ---------- 著者・関連 ---------- */
.daily-author {
  margin-top: 40px;
  padding: 18px 20px;
  border-top: 3px solid var(--daily-color);
  border-radius: 0 0 12px 12px;
  background: #f8fafc;
  font-size: 0.94rem;
}
.daily-author p {
  margin: 0 0 8px;
  line-height: 1.8;
}
.daily-author p:last-child {
  margin-bottom: 0;
}
.daily-author-name {
  font-weight: 700;
}
.daily-related {
  margin-top: 26px;
}

/* =========================================================
   Webアプリ（ツールUI）
   ========================================================= */
.tool {
  margin: 20px 0 34px;
  padding: 20px;
  border: 1px solid var(--daily-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(30, 64, 120, 0.07);
}
.tool-title {
  margin: 0 0 12px !important;
  font-weight: 700;
  font-size: 1.05rem;
}
.tool label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 700;
  font-size: 0.93rem;
}
.tool .tool-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 14px 6px 0;
  font-weight: 400;
}
.tool textarea,
.tool input[type="text"],
.tool input[type="number"],
.tool input[type="date"],
.tool input[type="color"],
.tool select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 16px; /* iOSでの自動ズーム防止 */
}
.tool input[type="color"] {
  height: 44px;
  padding: 4px;
}
.tool textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
}
.tool textarea.tool-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}
.tool input:focus-visible,
.tool textarea:focus-visible,
.tool select:focus-visible,
.tool button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}
.tool-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.tool button {
  padding: 10px 18px;
  border: 1px solid var(--daily-color);
  border-radius: 8px;
  background: var(--daily-color);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tool button.is-sub {
  background: #fff;
  color: var(--daily-color);
}
.tool button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tool-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.tool-stat {
  padding: 12px;
  border-radius: 10px;
  background: var(--daily-soft);
}
.tool-stat span {
  display: block;
  color: var(--muted, #6b7280);
  font-size: 0.82rem;
}
.tool-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.tool-output {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  line-height: 1.8;
  word-break: break-all;
}
.tool-output.is-error {
  background: #fef2f2;
  color: #b91c1c;
}
.tool-output.is-ok {
  background: #f0fdf4;
  color: #166534;
}
.tool-drop {
  display: block;
  padding: 26px 16px;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  text-align: center;
  color: var(--muted, #6b7280);
  cursor: pointer;
}
.tool-drop.is-over {
  border-color: var(--daily-color);
  background: var(--daily-soft);
}
.tool-drop input[type="file"] {
  display: block;
  margin: 10px auto 0;
  max-width: 100%;
}
.tool-list {
  list-style: none;
  padding: 0 !important;
  margin: 14px 0 0;
}
.tool-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #e5e7eb);
  font-size: 0.93rem;
}
.tool-list img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: #f1f5f9;
}
.tool-list a {
  font-weight: 700;
}
.tool-small {
  color: var(--muted, #6b7280);
  font-size: 0.85rem;
}
.tool-preview-box {
  margin-top: 14px;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--line, #e5e7eb);
}
.tool-preview-box p {
  margin: 0 0 8px;
}
.tool-badge {
  display: inline-block;
  min-width: 48px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}
.tool-badge.is-pass {
  background: #dcfce7;
  color: #166534;
}
.tool-badge.is-fail {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 640px) {
  .tool {
    padding: 16px;
  }
  .daily-toc {
    padding: 14px 16px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* =========================================================
   追加ツール用（2026年10月18日以降のWebアプリ記事）
   ========================================================= */
.tool [hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* 本文中の長いコード（パスやURL）を折り返す */
.daily-body p code,
.daily-body li code,
.daily-body td code,
.daily-body dd code {
  overflow-wrap: anywhere;
}
.tool .tool-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.tool-canvas-wrap {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  text-align: center;
}
.tool-canvas-wrap canvas,
.tool-canvas-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
}
#qr-canvas {
  width: min(320px, 100%);
  image-rendering: pixelated;
}
#cp-canvas {
  cursor: crosshair;
}

/* 入力用の表（消費税・割り勘） */
.tool-table-wrap {
  position: relative; /* 中の visually-hidden をこの枠の中に収める */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tool-table {
  width: 100%;
  min-width: 260px;
  border-collapse: collapse;
  table-layout: fixed;
}
.tool-table th:nth-child(n+2) {
  width: 21%;
}
#tx-table th:nth-child(2) {
  width: 23%;
}
#tx-table th:nth-child(3) {
  width: 14%;
}
#tx-table th:nth-child(4) {
  width: 22%;
}
.tool-table th:last-child {
  width: 40px;
}
.tool-table td {
  padding: 4px;
  vertical-align: middle;
}
.tool-table input,
.tool-table select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}
@media (max-width: 480px) {
  /* 品名は任意項目なので、狭い画面では隠して数値欄を広くする */
  #tx-table th:first-child,
  #tx-table td:first-child {
    display: none;
  }
  #tx-table th:nth-child(2) { width: 34%; }
  #tx-table th:nth-child(3) { width: 22%; }
  #tx-table th:nth-child(4) { width: 30%; }
}
/* 狭い画面で数字が隠れないよう、表の中の数値入力のスピンボタンを消す */
.tool-table input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.tool-table input[type="number"]::-webkit-outer-spin-button,
.tool-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tool .tool-table button {
  width: 100%;
  padding: 8px 0;
}

/* 差分表示 */
.tool-diff {
  margin-top: 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
}
.tool-diff:empty {
  display: none;
}
.tool-diff .tool-output {
  margin: 0;
  border-radius: 0;
  font-family: inherit;
}
.d-line {
  display: flex;
  min-width: max-content;
}
.d-no {
  flex: 0 0 3.2em;
  padding: 0 6px;
  text-align: right;
  color: #94a3b8;
  user-select: none;
}
.d-sign {
  flex: 0 0 1.4em;
  text-align: center;
  user-select: none;
}
.d-text {
  padding-right: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.d-add {
  background: #ecfdf3;
}
.d-add .d-sign {
  color: #15803d;
}
.d-del {
  background: #fef2f2;
}
.d-del .d-sign {
  color: #b91c1c;
}
.d-line ins {
  background: #bbf7d0;
  text-decoration: none;
  border-radius: 2px;
}
.d-line del {
  background: #fecaca;
  text-decoration: none;
  border-radius: 2px;
}

/* 正規表現 */
.tool-highlight {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-all;
}
.tool-highlight mark {
  padding: 1px 0;
  background: #fde68a;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #f59e0b inset;
}
.tool-highlight mark.is-empty {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  vertical-align: middle;
  background: #f59e0b;
}
.tool-details {
  margin-top: 12px;
}
.tool-details summary {
  cursor: pointer;
  font-weight: 700;
}

/* OGPプレビュー */
.tool-card-preview {
  max-width: 520px;
  border: 1px solid #d0d7de;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.tool-card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1.91 / 1;
  background: #e2e8f0 center / cover no-repeat;
  color: #64748b;
  font-size: 0.9rem;
}
.tool-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.tool-card-body strong,
.tool-card-body span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-card-domain {
  color: #64748b;
  font-size: 0.8rem;
}
.tool-card-preview.is-small {
  display: flex;
}
.tool-card-preview.is-small .tool-card-image {
  flex: 0 0 120px;
  aspect-ratio: 1 / 1;
}

/* カラーパレット */
.tool-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  list-style: none;
  padding: 0 !important;
  margin: 14px 0 0;
}
.tool-swatches li {
  margin: 0;
}
.tool .tool-swatch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 96px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 400;
  text-align: left;
}
.tool-swatch strong {
  font-size: 1rem;
}
.tool-chip {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.2em;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* 抽選 */
.tool-result-big {
  min-height: 3em;
  font-size: 1.15rem;
}
.tool-result-list {
  margin: 0;
  padding-left: 1.6em;
}
.tool-result-list li {
  margin: 2px 0;
  font-weight: 700;
}
.tool-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  font-size: 1rem;
}
.tool-groups > div {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
}

/* =========================================================
   研いだ米の計算機（rinsed-rice-calculator）
   ========================================================= */
.rc-field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.rc-field legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 700;
}
.rc-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.rc-chips label,
.rc-drain label {
  position: relative;
  display: block;
  margin: 0 !important;
  font-weight: 400 !important;
  cursor: pointer;
}
.rc-chips input,
.rc-drain input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.rc-chips span {
  display: block;
  padding: 10px 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
}
.rc-drain {
  display: grid;
  gap: 8px;
}
.rc-drain span {
  display: block;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  line-height: 1.5;
}
.rc-drain small {
  display: block;
  color: var(--muted, #6b7280);
  font-size: 0.84rem;
}
.rc-chips input:checked + span,
.rc-drain input:checked + span {
  border-color: var(--daily-color);
  background: var(--daily-soft);
  box-shadow: 0 0 0 1px var(--daily-color) inset;
}
.rc-chips input:checked + span {
  color: var(--daily-color);
}
.rc-chips input:focus-visible + span,
.rc-drain input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}
.rc-field .tool-inline-label {
  margin-top: 12px;
}
.rc-result {
  margin-top: 6px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fafc;
  line-height: 1.8;
}
.rc-result.is-ok {
  background: #f0fdf4;
}
.rc-result.is-warn {
  background: #fffbeb;
}
.rc-result p {
  margin: 0 0 8px;
}
.rc-result .rc-head {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.5;
}
.rc-result .rc-head b {
  color: #166534;
  font-size: 1.45em;
  white-space: nowrap;
}
.rc-result .tool-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.rc-result .tool-stat {
  padding: 8px 10px;
  background: #fff;
}
.rc-result .tool-stat span {
  font-size: 0.75rem;
  line-height: 1.4;
}
.rc-result .tool-stat strong {
  font-size: 1rem;
  white-space: nowrap;
}
.rc-result .rc-basis {
  margin-bottom: 10px;
}
.rc-result .rc-next {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(22, 101, 52, 0.18);
}
.rc-wait {
  color: var(--muted, #6b7280);
}
