/* =========================================================
   SuDeveloper - Free online tools (home section, /tools/, tool pages)
   ========================================================= */

/* ---------- Tool cards ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tool-card {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s, border-color .25s;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #c9dbff; }
.tool-ic {
  flex: none; width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; font-size: 1.25rem; box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}
.tool-ic.big { width: 64px; height: 64px; border-radius: 18px; font-size: 1.7rem; }
.tool-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tool-txt b { font-size: .98rem; line-height: 1.3; }
.tool-txt small { font-size: .78rem; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.tool-go { color: var(--primary); font-size: .85rem; opacity: 0; transform: translateX(-6px); transition: .25s; }
.tool-card:hover .tool-go { opacity: 1; transform: none; }
.tool-card[hidden] { display: none; }

/* ---------- Home section ---------- */
.tools-home { padding-top: 50px; padding-bottom: 30px; }
.tools-kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600;
  color: #7c3aed; background: #f1e9ff; padding: 4px 12px; border-radius: 999px; margin-bottom: 8px;
}

/* Home "Magic Tools": big cards, 2 per row on every screen */
.magic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.magic-card {
  --c1: #a78bfa; --c2: #7c3aed;
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.magic-card::before {
  content: ""; position: absolute; right: -50px; top: -50px; width: 160px; height: 160px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2)); opacity: .08; transition: transform .45s ease, opacity .3s;
}
.magic-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: transparent; }
.magic-card:hover::before { transform: scale(1.7); opacity: .13; }
.magic-ic {
  position: relative; flex: none; width: 68px; height: 68px; border-radius: 20px;
  display: grid; place-items: center; color: #fff; font-size: 1.7rem;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 14px 26px -10px var(--c2);
  transition: transform .35s ease;
}
.magic-ic::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%);
}
.magic-card:hover .magic-ic { transform: rotate(-8deg) scale(1.06); }
.magic-txt { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.magic-txt b { font-size: 1.06rem; line-height: 1.3; }
.magic-txt small { font-size: .84rem; color: var(--muted); line-height: 1.45; }
.magic-txt em {
  margin-top: 4px; font-style: normal; font-weight: 600; font-size: .82rem; color: var(--c2);
  display: inline-flex; align-items: center; gap: 6px;
}
.magic-txt em i { font-size: .75rem; transition: transform .25s; }
.magic-card:hover .magic-txt em i { transform: translateX(4px); }
.g-indigo { --c1: #818cf8; --c2: #4f46e5; }
.g-cyan   { --c1: #22d3ee; --c2: #0284c7; }
.g-rose   { --c1: #fb7185; --c2: #e11d48; }
.g-violet { --c1: #c084fc; --c2: #7c3aed; }
.g-sun    { --c1: #fbbf24; --c2: #ea580c; }
.g-teal   { --c1: #2dd4bf; --c2: #0f766e; }

/* ---------- /tools/ page ---------- */
.tools-search {
  display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 24px auto 0;
  background: #fff; border: 1px solid #d3dbe8; border-radius: 999px; padding: 4px 6px 4px 20px;
  box-shadow: var(--shadow);
}
.tools-search i { color: var(--muted); }
.tools-search input { border: 0; padding: 10px 6px; background: transparent; }
.tools-search input:focus { outline: none; }
.tools-list { padding-top: 40px; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 40px; }
.tool-chips a {
  display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500;
  background: var(--bg-soft); border: 1px solid var(--border); padding: 7px 14px; border-radius: 999px; transition: .2s;
}
.tool-chips a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tool-chips i { color: var(--primary); }
.tool-chips a:hover i { color: #fff; }
.tool-cat { margin-bottom: 44px; scroll-margin-top: 96px; }
.tool-cat[hidden] { display: none; }
.tool-cat-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tool-cat-ic { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.15rem; }
.tool-cat-head h2 { font-size: 1.35rem; line-height: 1.2; }
.tool-cat-head h2 small { font-size: .75rem; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 2px 10px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.tool-cat-head p { color: var(--muted); font-size: .88rem; }
.tools-empty { text-align: center; color: var(--muted); padding: 30px 0; }
.ct-pink, .ct-orange, .ct-green, .ct-blue, .ct-purple { color: #fff; }

/* ---------- One tool page ---------- */
.tool-hero { background: linear-gradient(180deg, #eef5ff 0%, #f7faff 100%); padding: 30px 0 36px; }
.tool-title { display: flex; align-items: center; gap: 18px; }
.tool-title h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.2; }
.tool-title p { color: var(--muted); }
.tool-main { padding: 30px 0 60px; }
.tool-box {
  background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 28px; min-height: 160px;
}
.tool-loading { color: var(--muted); text-align: center; padding: 40px 0; }
.tool-privacy { font-size: .82rem; color: var(--muted); margin: 14px 4px 0; display: flex; gap: 8px; align-items: center; }
.tool-privacy i { color: #16a34a; }
.tool-more { margin-top: 50px; }
.tool-more h2 { font-size: 1.35rem; margin-bottom: 18px; }
.tool-more .btn { margin-top: 22px; }

/* ---------- Tool UI kit (used by tools.js) ---------- */
.t-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.t-row > * { flex: 1 1 160px; }
.t-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.t-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.t-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.t-field > span, .t-label { font-weight: 600; font-size: .86rem; }
.t-field small, .t-hint { font-size: .78rem; color: var(--muted); }
.tool-box input[type="text"], .tool-box input[type="number"], .tool-box input[type="password"],
.tool-box input[type="date"], .tool-box input[type="datetime-local"], .tool-box input[type="time"],
.tool-box input[type="url"], .tool-box input[type="email"], .tool-box input[type="tel"],
.tool-box select, .tool-box textarea {
  width: 100%; font: inherit; font-size: .95rem; padding: 11px 14px; border: 1px solid #d3dbe8;
  border-radius: 10px; background: #fff; color: var(--text);
}
.tool-box textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.tool-box textarea.mono, .tool-box .mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: .88rem; }
.tool-box select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.tool-box input[type="color"] { width: 100%; height: 46px; border: 1px solid #d3dbe8; border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.tool-box input[type="range"] { width: 100%; accent-color: var(--primary); }
.t-check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; margin: 0 18px 10px 0; }
.t-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.t-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; }
.t-btns .btn { padding: 10px 18px; }
.btn-light { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--primary-soft); color: var(--primary); }
.btn-light.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-red { background: #ef4444; color: #fff; }
.btn-red:hover { background: #dc2626; }

.t-tabs { display: flex; flex-wrap: wrap; gap: 6px; background: var(--bg-soft); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.t-tabs button {
  flex: 1 1 auto; border: 0; background: transparent; font: inherit; font-size: .86rem; font-weight: 600;
  padding: 9px 14px; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.t-tabs button.on { background: #fff; color: var(--primary); box-shadow: 0 3px 10px rgba(20, 50, 110, .1); }

.t-out {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  word-break: break-word; white-space: pre-wrap;
}
.t-big { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; color: var(--primary); line-height: 1.15; }
.t-err { color: #dc2626; font-size: .88rem; font-weight: 500; }
.t-ok { color: #16a34a; font-size: .88rem; font-weight: 500; }
.t-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.t-stat { background: var(--bg-soft); border-radius: 12px; padding: 14px; text-align: center; }
.t-stat b { display: block; font-size: 1.5rem; color: var(--primary); line-height: 1.2; word-break: break-all; }
.t-stat span { font-size: .78rem; color: var(--muted); }
.t-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.t-chips button {
  border: 1px solid var(--border); background: #fff; font: inherit; font-size: .82rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.t-chips button:hover, .t-chips button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.t-list { display: grid; gap: 8px; }
.t-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-soft); border-radius: 10px; padding: 10px 14px;
}
.t-item code, .t-item .mono { word-break: break-all; }
.t-item .t-copy { flex: none; }
.t-copy { border: 0; background: var(--primary-soft); color: var(--primary); font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.t-copy:hover { background: var(--primary); color: #fff; }
.t-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t-table th, .t-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; }
.t-table th { background: var(--bg-soft); font-weight: 600; }
.t-meter { height: 10px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin: 8px 0; }
.t-meter i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .3s, background .3s; }
.t-center { text-align: center; }
.t-muted { color: var(--muted); font-size: .88rem; }
.t-hr { border: 0; border-top: 1px dashed var(--border); margin: 22px 0; }

/* Calculator */
.calc { max-width: 420px; margin-inline: auto; }
.calc-screen { background: #0f172a; color: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; text-align: right; }
.calc-expr { min-height: 24px; font-size: .95rem; color: #94a3b8; word-break: break-all; }
.calc-val { font-size: 2rem; font-weight: 700; word-break: break-all; line-height: 1.2; }
.calc-mode { float: left; font-size: .72rem; color: #60a5fa; font-weight: 600; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.calc-keys button {
  border: 0; border-radius: 10px; padding: 14px 4px; font: inherit; font-weight: 600; font-size: .95rem;
  background: var(--bg-soft); color: var(--text); cursor: pointer; transition: transform .1s, background .2s;
}
.calc-keys button:active { transform: scale(.95); }
.calc-keys .fn { background: #e8f0ff; color: var(--primary); font-size: .85rem; }
.calc-keys .op { background: #dbe8ff; color: var(--primary); font-size: 1.1rem; }
.calc-keys .eq { background: var(--primary); color: #fff; }
.calc-keys .clr { background: #ffe1e3; color: #dc2626; }

/* Color light */
.light-stage {
  height: 300px; border-radius: 18px; display: grid; place-items: center; color: rgba(255, 255, 255, .85);
  font-weight: 600; cursor: pointer; transition: background .25s; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  user-select: none;
}
.light-stage:fullscreen { border-radius: 0; height: 100vh; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border), 0 4px 10px rgba(0, 0, 0, .12); cursor: pointer; }

/* Mind reading */
.mind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; max-height: 360px; overflow: auto; padding: 4px; }
.mind-grid span { background: var(--bg-soft); border-radius: 8px; padding: 6px 4px; text-align: center; font-size: .82rem; }
.mind-grid span b { display: block; font-size: 1.35rem; line-height: 1.2; color: #4338ca; }
.crystal {
  width: 170px; height: 170px; margin: 10px auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5f3ff, #a78bfa 45%, #4c1d95 100%);
  display: grid; place-items: center; font-size: 4rem; color: #fff; text-shadow: 0 0 20px #fff;
  box-shadow: 0 0 40px rgba(124, 58, 237, .45);
}
.crystal.spin { animation: crystal 1.6s ease-in-out; }
@keyframes crystal { 0% { filter: blur(0); transform: scale(1); } 50% { filter: blur(6px); transform: scale(1.08) rotate(8deg); } 100% { filter: blur(0); transform: scale(1); } }

/* Love story */
.love-card { background: linear-gradient(135deg, #fff1f5, #ffe4ef); border: 1px solid #fecdd9; border-radius: 16px; padding: 22px; }
.love-names { text-align: center; font-size: 1.4rem; font-weight: 700; color: #be185d; }
.love-percent { text-align: center; font-size: 3rem; font-weight: 800; color: #e11d48; line-height: 1.1; margin: 6px 0 14px; }
.love-card p { color: #4a2633; line-height: 1.75; margin-bottom: 10px; }

/* Coin */
.coin-wrap { perspective: 800px; display: grid; place-items: center; margin: 10px 0 20px; }
.coin { width: 160px; height: 160px; position: relative; transform-style: preserve-3d; transition: transform 1.6s cubic-bezier(.2, .7, .2, 1); }
.coin span {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden;
  font-weight: 800; font-size: 1.3rem; line-height: 1.3; text-align: center; color: #7a4b00; border: 6px solid #e0a800;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #fbbf24 55%, #d97706 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .35), 0 12px 25px rgba(0, 0, 0, .2);
}
.coin span.tails { transform: rotateY(180deg); }

/* Diff */
.diff { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.diff div { padding: 3px 12px; white-space: pre-wrap; word-break: break-word; }
.diff .add { background: #dcfce7; color: #14532d; }
.diff .del { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; text-decoration-color: rgba(127, 29, 29, .35); }
.diff .same { color: var(--muted); }

/* Regex */
.rx-out mark { background: #fde68a; border-radius: 3px; padding: 0 1px; }

/* Notes */
.notes { display: grid; grid-template-columns: 240px 1fr; gap: 18px; }
.notes-list { display: grid; gap: 8px; align-content: start; max-height: 420px; overflow: auto; }
.notes-list button {
  text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: .85rem; cursor: pointer;
}
.notes-list button.on { border-color: var(--primary); background: var(--primary-soft); }
.notes-list button small { display: block; color: var(--muted); font-size: .72rem; }
.notes textarea { min-height: 320px; }

/* Stopwatch / timers */
.t-clock { font-size: clamp(2.6rem, 9vw, 4.4rem); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 10px 0 18px; color: var(--text); }
.t-clock small { font-size: .45em; color: var(--muted); }

@media (max-width: 960px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tool-box { padding: 18px 14px; border-radius: 16px; }
  .t-grid2, .t-grid3 { grid-template-columns: 1fr; }
  .notes { grid-template-columns: 1fr; }
  .notes-list { max-height: 180px; }
  .tool-title { align-items: flex-start; }
  .tool-ic.big { width: 52px; height: 52px; font-size: 1.35rem; }
  .light-stage { height: 220px; }
  .calc-keys button { padding: 13px 2px; }

  /* Magic Tools: still 2 per row, card stacks vertically */
  .magic-grid { gap: 12px; }
  .magic-card { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 14px; border-radius: 16px; }
  .magic-ic { width: 52px; height: 52px; border-radius: 15px; font-size: 1.3rem; }
  .magic-txt b { font-size: .92rem; }
  .magic-txt small {
    font-size: .76rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .magic-card, .magic-card::before, .magic-ic, .magic-txt em i { transition: none; }
}
