:root {
  --brand: #86C038;
  --brand-dark: #6ea52c;
  --brand-bg: #f0f9eb;
  --accent: #3464e0;
  --ink: #2b2f36;
  --muted: #8a919c;
  --line: #efefef;
  --card-line: #eceef2;
  --bg: #f7f8fa;
  --radius: 12px;
  --red: #e05d5d;
  --warn: #e6a23c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ===== topbar ===== */
.toolwa-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 99;
}
.toolwa-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.toolwa-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}
.toolwa-topbar-brand .logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #9cd24f, var(--brand-dark));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.toolwa-topbar-brand:hover { color: var(--brand); }
.toolwa-topbar-nav { display: flex; gap: 4px; margin-left: auto; }
.toolwa-topbar-nav > a {
  padding: 8px 14px;
  font-size: 14px;
  color: #555;
  border-radius: 8px;
}
.toolwa-topbar-nav > a:hover { color: var(--brand); background: var(--brand-bg); }
.toolwa-topbar-nav > a.on { color: var(--brand); background: var(--brand-bg); font-weight: 600; }

/* ===== home banner ===== */
.toolwa-home-banner {
  text-align: center;
  padding: 56px 16px 36px;
  background:
    radial-gradient(1200px 300px at 20% -80px, rgba(134,192,56,.10), transparent 60%),
    radial-gradient(900px 260px at 85% -60px, rgba(52,100,224,.08), transparent 60%),
    #fff;
  border-bottom: 1px solid var(--line);
}
.toolwa-home-banner h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.toolwa-home-banner h1 b { color: var(--brand); }
.toolwa-home-banner .banner-desc { color: var(--muted); font-size: 15px; margin: 12px 0 26px; }
.toolwa-home-search {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: #fff;
  border: 1px solid #dfe3ea;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(30, 40, 60, .06);
}
.toolwa-home-search input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 22px;
  font-size: 14px;
  background: transparent;
}
.toolwa-home-search button {
  border: none;
  background: var(--brand);
  color: #fff;
  padding: 0 28px;
  cursor: pointer;
  font-size: 14px;
}
.toolwa-home-search button:hover { background: var(--brand-dark); }

/* ===== sections & cards ===== */
.site-main { padding: 26px 0 48px; }
.home-section-title {
  font-size: 19px;
  font-weight: 700;
  margin: 26px 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--brand);
}
.home-section-title small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
.toolwa-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tool-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 18px;
  height: 100%;
  color: inherit;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(52, 100, 224, .12);
}
.tool-item h3 { margin: 0 0 4px; font-size: 15.5px; color: #222; }
.tool-item p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.tool-icon {
  width: 52px; height: 52px;
  border-radius: 13px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 700;
}
.tile-kana { background: linear-gradient(135deg, #f26d6d, #d64545); }
.tile-tr   { background: linear-gradient(135deg, #9cd24f, var(--brand-dark)); }
.tile-qr   { background: linear-gradient(135deg, #5b6ee8, #3b3f63); }
.hide { display: none !important; }

/* ===== tool page ===== */
.tool-page { padding: 22px 0 60px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.page-title { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.tool-box {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 24px;
}
.panel-title { font-size: 15px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.panel-title:first-child { margin-top: 0; }
.panel-title .tip { font-weight: 400; font-size: 12px; color: var(--muted); }

/* buttons / inputs / selects */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; cursor: pointer;
  border-radius: 8px; padding: 10px 22px;
  font-size: 14px; background: var(--brand); color: #fff;
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: #fff; color: #444; border-color: #d9dde3; }
.btn.ghost:hover { background: #f5f6f8; }
.btn.blue { background: var(--accent); }
.btn.blue:hover { background: #2853c4; }
.btn.sm { padding: 6px 14px; font-size: 13px; border-radius: 7px; }
input[type=text], input[type=number], input[type=url], textarea, select {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
select { width: auto; cursor: pointer; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.msg { font-size: 13px; min-height: 20px; }
.msg.ok { color: var(--brand-dark); }
.msg.err { color: var(--red); }

/* segmented control */
.seg { display: inline-flex; background: #eef0f4; border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 7px 15px; border-radius: 7px;
  font-size: 13px; color: #555;
}
.seg button.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.14); }

/* ===== kana ===== */
.kana-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kana-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.kana-cell {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all .12s ease;
  user-select: none;
}
.kana-cell:hover { border-color: var(--brand); background: var(--brand-bg); transform: translateY(-2px); }
.kana-cell .main { font-size: 30px; font-weight: 700; line-height: 1.15; }
.kana-cell .alt { font-size: 13px; color: #b0b6bf; margin-top: 1px; }
.kana-cell .roma { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kana-cell .spk { font-size: 11px; color: var(--brand); opacity: 0; transition: opacity .12s; }
.kana-cell:hover .spk { opacity: 1; }

/* quiz */
.quiz-wrap { max-width: 660px; margin: 0 auto; }
.quiz-card {
  border: 1px dashed #cdd3dc;
  border-radius: 16px;
  padding: 30px 24px;
  text-align: center;
  background: #fdfdfd;
}
.quiz-qlabel { font-size: 13px; color: var(--muted); }
.quiz-q {
  font-size: 72px;
  font-weight: 800;
  line-height: 1.2;
  margin: 10px 0 22px;
  min-height: 92px;
}
.quiz-q .roma { font-size: 30px; font-weight: 700; }
.quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-opts button {
  border: 1px solid #d9dde3;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
  color: var(--ink);
}
.quiz-opts button:hover { border-color: var(--accent); color: var(--accent); }
.quiz-opts button.correct { background: var(--brand-bg); border-color: var(--brand); color: var(--brand-dark); }
.quiz-opts button.wrong { background: #fdecec; border-color: var(--red); color: var(--red); }
.quiz-opts button:disabled { cursor: default; }
.quiz-score { display: flex; gap: 18px; justify-content: center; margin: 16px 0; font-size: 13px; color: #555; flex-wrap: wrap; }
.quiz-score b { font-size: 17px; }
.quiz-score .right b { color: var(--brand-dark); }
.quiz-score .wrongb b { color: var(--red); }
.progress { height: 6px; background: #eef0f4; border-radius: 4px; overflow: hidden; margin: 14px 0 20px; }
.progress .fill { height: 100%; background: var(--brand); width: 0%; transition: width .3s; border-radius: 4px; }

/* ===== translate ===== */
.tr-top { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.tr-top select { min-width: 130px; }
.auto-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #555; cursor: pointer;
  margin-left: auto; padding: 4px 0 10px;
}
.auto-label input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.swap-btn { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 9px; border: 1px solid #d9dde3; background: #fff; cursor: pointer; font-size: 16px; }
.swap-btn:hover { border-color: var(--accent); color: var(--accent); }
.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .tr-grid { grid-template-columns: 1fr; } }
.tr-panel { border: 1px solid var(--card-line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.tr-panel .tr-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--card-line); background: #fafbfc;
}
.tr-panel .tr-head select { border: none; background: transparent; font-weight: 600; padding: 4px; }
.tr-panel .tr-head select:focus { box-shadow: none; }
.tr-panel textarea {
  border: none; border-radius: 0; width: 100%;
  min-height: 240px; padding: 14px;
  font-size: 15px; line-height: 1.7;
}
.tr-panel textarea:focus { box-shadow: none; }
.tr-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--card-line);
  font-size: 12px; color: var(--muted); background: #fafbfc;
}
.copy-btn, .clr-btn { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.copy-btn:hover, .clr-btn:hover { background: #eef0f4; color: var(--accent); }

/* ===== qrcode ===== */
.qr-layout { display: grid; grid-template-columns: 380px 1fr; gap: 22px; }
@media (max-width: 940px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-preview {
  border: 1px dashed #cdd3dc;
  border-radius: 14px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: #fdfdfd;
}
.qr-preview .ph { color: #b6bcc6; font-size: 13px; text-align: center; }
.qr-preview canvas { max-width: 100%; height: auto; background: #fff; }
.qr-meta { font-size: 12px; color: var(--muted); }

/* ===== footer ===== */
.toolwa-footer { background: #fff; border-top: 1px solid #e8ecf1; margin-top: 40px; }
.toolwa-footer-inner { max-width: 1200px; margin: 0 auto; padding: 30px 16px 0; }
.toolwa-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; padding-bottom: 22px; }
@media (max-width: 760px) { .toolwa-footer-grid { grid-template-columns: 1fr; gap: 18px; } }
.toolwa-footer-col-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.toolwa-footer-linklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.toolwa-footer-linklist a { color: #666; font-size: 13px; }
.toolwa-footer-linklist a:hover { color: var(--brand); }
.toolwa-footer-desc { font-size: 12.5px; color: var(--muted); max-width: 420px; }
.toolwa-footer-bottom { border-top: 1px solid #e8ecf1; padding: 14px 0; text-align: center; font-size: 12px; color: #9aa0a8; }
