/* =========================================================
   Design tokens — palette lifted directly from the site's own
   layout.css / temp.css: blue-to-pink gradient page background,
   indigo brand, teal primary actions, coral for danger, and the
   exact amber "redirect banner" treatment reused for warnings.
   ========================================================= */
:root{
  --grad-start:  #5372F0;
  --grad-end:    #db3c81;
  --brand:       #3e4ab1;
  --brand-hover: #6b82f7;
  --accent-green:#29ec6a;
  --teal:        #00bfa5;
  --teal-dark:   #00897b;
  --coral:       #ff5252;
  --coral-dark:  #d32f2f;
  --focus:       #5c6bc0;
  --line:        #cfd8dc;
  --text-dark:   #3a3a3a;
  --text-soft:   #6b6b6b;
  --text-light:  #f3f3f3;
  --card:        #ffffff;
  --panel-tint:  #eef0fb;
  --textarea-bg: #e3f2fd;
  --toast-bg:    #333333;
  --warn-bg:     #fff3cd;
  --warn-border: #ffe69c;
  --warn-accent: #f0ad4e;
  --warn-text:   #664d03;

  --font-display: "Noto Sans Ol Chiki", Verdana, Geneva, Tahoma, sans-serif;
  --font-body:    Verdana, Geneva, Tahoma, sans-serif;
  --font-mono:    "Courier New", monospace;
  --font-ol:      "Noto Sans Ol Chiki", sans-serif;

  --radius: 10px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: linear-gradient(to right, var(--grad-start), var(--grad-end));
  background-attachment: fixed;
  color: var(--text-light);
  font-family: var(--font-body);
  line-height: 1.6;
}

/* ---------- decorative gradient divider (replaces the old pattern band) ---------- */
.sohrai-band{
  height: 6px;
  width: 100%;
  background: linear-gradient(to right, var(--grad-start), var(--grad-end));
}
.sohrai-band.thin{ height: 3px; margin: 40px 0; border-radius: 999px; opacity: 0.6; }

/* ---------- hero ---------- */
.hero{
  padding: 56px 24px 64px;
  text-align: center;
}
.hero-inner{ max-width: 760px; margin: 0 auto; }
.eyebrow{
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-green);
  margin: 0 0 18px;
}
.ol-chiki-display{
  font-family: var(--font-ol);
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  margin: 0;
  color: var(--text-light);
  line-height: 1.1;
}
.hero h2{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  margin: 6px 0 22px;
  color: var(--text-light);
}
.hero-copy{
  font-size: 1.02rem;
  color: rgba(243, 243, 243, 0.88);
  max-width: 620px;
  margin: 0 auto 30px;
}
.hero-actions{ display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn{
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 5px;
  padding: 12px 22px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.3s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: var(--teal);
  color: #ffffff;
}
.btn-primary:hover{ background: var(--teal-dark); }
.btn-ghost{
  background: transparent;
  color: var(--text-light);
  border-color: rgba(243, 243, 243, 0.4);
}
.btn-ghost:hover{ border-color: var(--accent-green); color: var(--accent-green); }
.btn-small{
  padding: 10px 16px;
  font-size: 0.85rem;
  background: var(--brand);
  color: #ffffff;
}
.btn-small:hover{ background: var(--brand-hover); }
.btn-icon-only{
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--text-dark);
  justify-content: center;
  font-size: 1.1rem;
}
.btn-icon-only:hover{ background: var(--panel-tint); border-color: var(--brand); }
.btn-icon-only:disabled{ opacity: 0.35; cursor: not-allowed; }
.btn-icon{ display: inline-block; }
.btn-edit{
  background: var(--brand);
  color: #ffffff;
  width: 100%;
  justify-content: center;
}
.btn-edit:hover{ background: var(--brand-hover); }
.btn-view{
  background: transparent;
  border-color: var(--line);
  color: var(--text-soft);
  font-size: 0.82rem;
  padding: 9px 14px;
}
.btn-view:hover{ border-color: var(--teal); color: var(--teal-dark); }

/* ---------- layout shells ---------- */
main{ max-width: 1080px; margin: 0 auto; padding: 40px 24px 20px; }
.panel{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  color: var(--text-dark);
}

/* ---------- controls ---------- */
.controls{
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 800px){ .controls{ grid-template-columns: 1fr; } }

.control-group label{
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 10px;
}
.search-row{ display: flex; gap: 8px; }
#searchInput{
  flex: 1;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  font-family: var(--font-ol), var(--font-body);
  font-size: 1rem;
  color: var(--text-dark);
}
#searchInput:focus{ outline: none; border-color: var(--focus); box-shadow: 0 0 5px rgba(92, 107, 192, 0.3); }

.threshold-row{ display: flex; align-items: center; gap: 12px; }
#weakMax{ flex: 1; accent-color: var(--brand); }
.pill{
  background: var(--panel-tint);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.hint{ font-size: 0.8rem; color: var(--text-soft); margin: 10px 0 0; }
.refresh-group .btn{ width: 100%; justify-content: center; }

.search-results{
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.search-hit{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fafbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
.search-hit .word{ font-family: var(--font-ol); font-size: 1.15rem; }
.search-hit .status{ font-size: 0.72rem; font-family: var(--font-mono); color: var(--text-soft); }

/* ---------- stats ---------- */
.stats{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}
.stat-card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}
.stat-num{
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--text-dark);
}
.stat-danger .stat-num{ color: var(--coral); }
.stat-warn .stat-num{ color: var(--warn-accent); }
.stat-label{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

/* ---------- results sections ---------- */
.section-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.section-tag{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}
.tag-danger{ background: var(--coral); color: #ffffff; }
.tag-warn{ background: var(--warn-accent); color: #ffffff; }
.section-head h3{
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 8px 0 4px;
  color: var(--text-light);
}
.section-sub{ margin: 0; color: rgba(243, 243, 243, 0.8); font-size: 0.92rem; max-width: 50ch; }

.pager{ display: flex; align-items: center; gap: 10px; }
.pager-label{ font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-light); }

.card-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.empty-state{
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dark);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

/* ---------- word card ---------- */
.word-card{
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.word-card::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--coral);
}
.word-card.weak::before{ background: var(--warn-accent); }
.word-card:hover{ transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }

.word-card .word{
  font-family: var(--font-ol);
  font-size: 1.7rem;
  color: var(--text-dark);
  word-break: break-word;
}
.word-card .meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-soft);
}
.link-count{
  font-weight: 700;
  color: var(--coral);
}
.weak .link-count{ color: var(--warn-accent); }
.card-actions{ display: flex; gap: 8px; margin-top: 4px; }

/* ---------- how-to ---------- */
.howto summary{
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
}
.howto ol{ padding-left: 20px; }
.howto li{ margin-bottom: 8px; }
.howto code, .howto kbd{
  font-family: var(--font-mono);
  background: var(--panel-tint);
  color: var(--brand);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
}

/* ---------- footer ---------- */
.site-footer{
  text-align: center;
  padding: 0 24px 50px;
  color: rgba(243, 243, 243, 0.85);
  font-size: 0.85rem;
  max-width: 720px;
  margin: 0 auto;
}
.site-footer a{ color: var(--text-light); text-decoration: underline; }

/* ---------- copy dialog ---------- */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 44, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay[hidden]{ display: none; }
.modal-box{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  color: var(--text-dark);
}
.modal-box h4{
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 1.3rem;
  color: var(--brand);
}
.modal-sub{ font-size: 0.85rem; color: var(--text-soft); margin: 0 0 14px; }
#copyModalText{
  width: 100%;
  min-height: 200px;
  font-family: var(--font-ol), var(--font-mono);
  font-size: 0.95rem;
  padding: 12px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--textarea-bg);
  color: var(--text-dark);
  resize: vertical;
}
.modal-actions{ display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- toasts ---------- */
.toast-stack{
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
  max-width: 320px;
}
.toast{
  background: var(--toast-bg);
  color: #ffffff;
  border-left: 4px solid var(--teal);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.86rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}
.toast.error{ border-left-color: var(--coral); }
.toast.success{ border-left-color: var(--accent-green); }
@keyframes toast-in{
  from{ opacity: 0; transform: translateY(-20px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ---------- focus visibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- spinner ---------- */
.spin{ animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin{ to{ transform: rotate(360deg); } }
