/* ============================================================
   MotoHub AI — Tools hub styles
   ============================================================ */

.tool-hero { padding: 36px 0 28px; border-bottom: 1px solid var(--line-soft); }
.tool-hero h1 { font-size: clamp(32px, 4.6vw, 52px); font-weight: 900; letter-spacing: -0.025em; margin: 14px 0 12px; }
.tool-hero p { color: var(--ink-2); font-size: 18px; max-width: 60ch; margin: 0; }

.tools-layout { display: grid; grid-template-columns: 270px minmax(0,1fr); gap: 36px; align-items: start; padding: 40px 0 0; }

/* Rail */
.tool-rail { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 6px; }
.tool-rail h4 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; font-weight: 500; padding: 0 14px; }
.rail-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r); cursor: pointer;
  border: 1px solid transparent; color: var(--ink-2); font-weight: 600; font-size: 15px;
  transition: background .15s, border-color .15s, color .15s;
}
.rail-item svg { width: 19px; height: 19px; color: var(--ink-3); flex: none; }
.rail-item:hover { background: var(--panel); color: var(--ink); }
.rail-item.active { background: var(--panel-2); border-color: var(--orange); color: var(--ink); }
.rail-item.active svg { color: var(--orange-bright); }
.rail-item .rail-badge { margin-left: auto; }

/* Tool panel */
.tool-stage { min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.panel-head .pic { width: 48px; height: 48px; border-radius: var(--r); background: var(--orange-dim); display: grid; place-items: center; flex: none; }
.panel-head .pic svg { width: 26px; height: 26px; color: var(--orange-bright); }
.panel-head h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.panel-sub { color: var(--ink-3); font-size: 16px; margin: 0 0 28px; max-width: 64ch; line-height: 1.6; }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.calc-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 26px; }
.calc-card h3 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.calc-card .ch-note { color: var(--ink-4); font-size: 13px; font-family: var(--mono); margin: 0 0 22px; }

.field { margin-bottom: 22px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.field label .val { font-family: var(--mono); color: var(--orange-bright); font-size: 15px; }

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px 8px; border-radius: var(--r); cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2);
  font-family: var(--mono); font-size: 13px; font-weight: 500; transition: all .14s;
}
.seg button:hover { border-color: var(--ink-4); }
.seg button.on { background: var(--orange); color: #1a1208; border-color: var(--orange); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px; background: var(--line); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--orange); cursor: pointer; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--orange); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--orange); cursor: pointer; border: 3px solid var(--bg); }

.num-input { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-2); }
.num-input:focus-within { border-color: var(--orange); }
.num-input input { flex: 1; background: none; border: 0; outline: none; color: var(--ink); font-family: var(--mono); font-size: 22px; font-weight: 600; padding: 14px 16px; width: 100%; }
.num-input .unit { padding: 0 16px; color: var(--ink-4); font-family: var(--mono); font-size: 14px; border-left: 1px solid var(--line); align-self: stretch; display: flex; align-items: center; }
.num-input .steppers { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.num-input .steppers button { background: var(--panel-2); border: 0; color: var(--ink-2); width: 36px; flex: 1; cursor: pointer; font-size: 14px; }
.num-input .steppers button:hover { background: var(--panel); color: var(--orange-bright); }
.num-input .steppers button:first-child { border-bottom: 1px solid var(--line); }

.nominal { display: flex; justify-content: space-between; padding: 14px 0 0; border-top: 1px solid var(--line-soft); margin-top: 6px; font-size: 14px; color: var(--ink-3); }
.nominal b { font-family: var(--mono); color: var(--ink); }

/* Result */
.result { text-align: center; }
.verdict-ring { position: relative; width: 200px; height: 200px; margin: 8px auto 18px; }
.verdict-ring svg { transform: rotate(-90deg); }
.verdict-ring .vr-track { fill: none; stroke: var(--line); stroke-width: 14; }
.verdict-ring .vr-fill { fill: none; stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .5s ease, stroke .3s; }
.verdict-ring .vr-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.verdict-ring .vr-pct { font-family: var(--display); font-weight: 900; font-size: 46px; letter-spacing: -0.03em; }
.verdict-ring .vr-lab { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }

.verdict-tag { display: inline-flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-size: 24px; padding: 8px 20px; border-radius: 999px; margin-bottom: 14px; }
.verdict-msg { color: var(--ink-2); font-size: 15.5px; line-height: 1.6; max-width: 42ch; margin: 0 auto 22px; }

.scale-bar { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--green) 0%, var(--green) 33%, var(--orange) 33%, var(--orange) 66%, oklch(0.62 0.2 25) 66%); position: relative; margin: 8px 0 8px; }
.scale-needle { position: absolute; top: -6px; width: 4px; height: 24px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); transition: left .4s ease; box-shadow: 0 0 0 2px var(--bg); }
.scale-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-top: 8px; }

.tip-box { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px 18px; margin-top: 22px; display: flex; gap: 12px; }
.tip-box svg { width: 18px; height: 18px; color: var(--cyan); flex: none; margin-top: 2px; }
.tip-box p { margin: 0; font-size: 14px; color: var(--ink-3); line-height: 1.55; }

/* ---------- AI Diagnostic ---------- */
.ai-grid { display: grid; grid-template-columns: 380px minmax(0,1fr); gap: 22px; align-items: start; }
.ai-input { display: flex; flex-direction: column; }
.ai-input .field label { margin-bottom: 8px; }
.ai-input input[type="text"], .ai-input textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); font-family: var(--body); font-size: 15px; padding: 13px 15px; outline: none; resize: vertical;
}
.ai-input input[type="text"]:focus, .ai-input textarea:focus { border-color: var(--orange); }
.ai-input textarea { min-height: 110px; line-height: 1.5; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }
.ai-chips .chip { font-size: 12px; padding: 6px 11px; }

.ai-out { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 26px; min-height: 360px; }
.ai-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 320px; color: var(--ink-4); }
.ai-empty svg { width: 44px; height: 44px; margin-bottom: 16px; color: var(--ink-4); }
.ai-empty h3 { font-size: 20px; font-weight: 700; color: var(--ink-2); margin: 0 0 8px; }
.ai-empty p { max-width: 38ch; font-size: 14.5px; margin: 0; }

.ai-loading { display: flex; align-items: center; gap: 14px; color: var(--ink-2); font-size: 15px; padding: 30px 4px; }
.ai-spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-summary { font-size: 15px; color: var(--ink-2); line-height: 1.6; margin: 0 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.cause { border: 1px solid var(--line-soft); border-radius: var(--r); padding: 18px 20px; margin-bottom: 14px; background: var(--bg-2); }
.cause-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cause-head .rank { font-family: var(--display); font-weight: 900; font-size: 22px; color: var(--ink-4); width: 26px; flex: none; }
.cause-head h4 { font-size: 18px; font-weight: 700; margin: 0; flex: 1; min-width: 0; overflow-wrap: break-word; }
.lk { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 5px; font-weight: 600; flex: none; }
.lk.high { background: oklch(0.62 0.2 25 / 0.16); color: oklch(0.74 0.18 30); }
.lk.medium { background: var(--orange-dim); color: var(--orange-bright); }
.lk.low { background: var(--cyan-dim); color: var(--cyan); }
.cause p { margin: 0 0 12px; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.cause .checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cause .checks li { display: flex; gap: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.cause .checks svg { width: 15px; height: 15px; color: var(--orange-bright); flex: none; margin-top: 3px; }
.ai-safety { display: flex; gap: 12px; background: oklch(0.62 0.2 25 / 0.1); border: 1px solid oklch(0.62 0.2 25 / 0.3); border-radius: var(--r); padding: 16px 18px; margin-top: 18px; }
.ai-safety svg { width: 18px; height: 18px; color: oklch(0.74 0.18 30); flex: none; margin-top: 2px; }
.ai-safety p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.ai-disclaimer { font-family: var(--mono); font-size: 11px; color: var(--ink-4); margin-top: 18px; line-height: 1.5; }

.placeholder-tool { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 60px 40px; text-align: center; }
.placeholder-tool svg { width: 40px; height: 40px; color: var(--ink-4); margin-bottom: 16px; }
.placeholder-tool h3 { font-size: 24px; font-weight: 800; margin: 0 0 10px; }
.placeholder-tool p { color: var(--ink-3); max-width: 44ch; margin: 0 auto 20px; }

@media (max-width: 1080px) {
  .ai-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .tools-layout { grid-template-columns: 1fr; }
  .ai-grid { grid-template-columns: 1fr; }
  .tool-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .tool-rail h4 { width: 100%; }
  .rail-item { flex: 1; min-width: 150px; }
  .calc-grid { grid-template-columns: 1fr; }
}
