/* usesuno.com — shared tool page shell (downloader / parser pattern) */

.tool-page main {
  padding-bottom: 64px;
  position: relative;
}

.tool-page main::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 92vw);
  height: 460px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.05), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.tool-shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.tool-shell--wide {
  max-width: 940px;
}

/* —— Stage (title block) —— */
.tool-stage {
  text-align: center;
  padding: 36px 0 24px;
}

.tool-stage.is-compact {
  padding: 8px 0 20px;
  text-align: left;
}

.tool-stage.is-left {
  text-align: left;
  padding: 28px 0 22px;
}

.tool-stage.is-left .sub {
  margin-left: 0;
}

.tool-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.tool-kicker svg {
  width: 12px;
  height: 12px;
}

.tool-stage h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
}

.tool-stage.is-compact h1,
.tool-stage.is-left h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
}

.tool-stage.is-compact h1 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.tool-stage .sub {
  margin: 0 auto 22px;
  max-width: 48ch;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.tool-stage.is-compact .sub {
  display: none;
}

.tool-stage-note {
  margin: 0 auto 20px;
  max-width: 52ch;
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.tool-stage.is-left .tool-stage-note {
  margin-left: 0;
}

.tool-stage.is-left .tool-form-hint {
  margin-left: 0;
  max-width: 52ch;
}

/* —— Input shell —— */
.tool-form {
  position: relative;
}

.tool-input-wrap {
  background: rgba(20, 20, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.tool-input-wrap:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05), 0 12px 36px rgba(0, 0, 0, 0.4);
}

.tool-input-wrap textarea,
.tool-input-wrap input[type="text"],
.tool-input-wrap input[type="search"],
.tool-input-wrap input[type="url"] {
  width: 100%;
  padding: 18px 20px 10px;
  background: transparent;
  color: var(--text-main);
  border: none;
  border-radius: 18px 18px 0 0;
  font: 0.95rem/1.5 var(--mono);
  outline: none;
  resize: none;
  min-height: 72px;
  box-sizing: border-box;
  display: block;
}

.tool-input-wrap input[type="text"],
.tool-input-wrap input[type="search"],
.tool-input-wrap input[type="url"] {
  min-height: 0;
  padding: 18px 20px;
  border-radius: 18px 18px 0 0;
}

.tool-input-wrap textarea::placeholder,
.tool-input-wrap input::placeholder {
  color: var(--text-dim);
  font-family: var(--font);
  letter-spacing: 0;
}

.tool-input-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
  flex-wrap: wrap;
}

.tool-input-bar--split {
  justify-content: space-between;
}

.tool-form-hint {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.tool-stage .tool-form-hint {
  margin-left: auto;
  margin-right: auto;
  max-width: 52ch;
  text-align: center;
}

.tool-form-hint.err {
  color: #ffa0a0;
}

.tool-form-hint.ok {
  color: #9ef5b2;
}

/* —— Buttons —— */
.tool-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: #fafafa;
  color: #09090b;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.15s ease;
}

.tool-btn-primary:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.tool-btn-primary:active {
  transform: scale(0.985);
}

.tool-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tool-btn-primary .ic {
  width: 16px;
  height: 16px;
}

.tool-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tool-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.tool-btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* —— Editor card (textarea tools) —— */
.tool-card {
  background: rgba(20, 20, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
  gap: 8px;
}

.tool-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

.tool-card-body textarea {
  width: 100%;
  box-sizing: border-box;
  display: block;
  min-height: 280px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  color: var(--text-main);
  font: 0.9rem/1.7 var(--mono);
}

.tool-card-body textarea::placeholder {
  color: var(--text-dim);
  font-family: var(--font);
}

.tool-card-body textarea[readonly] {
  color: var(--text-muted);
}

.tool-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
}

.tool-card-foot .tool-spacer {
  flex: 1;
}

.tool-spacer {
  flex: 1;
}

.tool-char-count {
  font-size: 0.74rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.tool-char-count.warn {
  color: #ffb4b4;
}

/* —— Chips / toggles —— */
.tool-chip {
  display: inline-block;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--mono);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.tool-chip:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.20);
}

.tool-chip.is-on {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.36);
  color: #fff;
}

.tool-chip.is-exclude {
  background: rgba(255, 90, 90, 0.16);
  border-color: rgba(255, 120, 120, 0.45);
  color: #ffd9d9;
}

.tool-chipbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tool-chipbar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin-right: 4px;
}

/* —— Option panel (cleaner etc.) —— */
.tool-optpanel {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.12);
}

.tool-optpanel-head {
  padding: 10px 14px 0;
}

.tool-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px 12px;
}

.tool-toggle {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.tool-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.tool-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tool-toggle span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tool-toggle:hover span {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-main);
}

.tool-toggle:has(input:checked) span {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tool-toggle:has(input:checked) span::before {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
}

.tool-toggle:has(input:focus-visible) span {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.tool-budget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.tool-budget-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.tool-budget-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tool-budget-field:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.38);
}

.tool-budget-field input {
  width: 56px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}

.tool-budget-field input::-webkit-outer-spin-button,
.tool-budget-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tool-budget-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

@media (max-width: 620px) {
  .tool-toggle-grid {
    grid-template-columns: 1fr;
  }
}

/* Legacy option bar (keep for other pages if needed) */
.tool-optbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.tool-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.tool-opt input {
  accent-color: #fff;
}

.tool-budget {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.tool-budget input {
  width: 70px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--mono);
  font-size: 0.8rem;
}

@media (max-width: 620px) {
  .tool-budget {
    margin-left: 0;
    width: 100%;
  }
}

/* —— Panel / stats —— */
.tool-panel {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.tool-panel-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.tool-card + .tool-card,
.tool-card + .tool-stats,
.tool-stats + .tool-card,
.tool-stats + .tool-panel,
.tool-card + .tool-panel {
  margin-top: 18px;
}

.tool-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tool-stats strong {
  color: var(--text-main);
  font-weight: 600;
}

.tool-stats .removed {
  color: #ffb4b4;
}

/* —— Sticky output (exclude etc.) —— */
.tool-out-sticky {
  position: sticky;
  top: calc(var(--nav-h) + 8px);
  z-index: 5;
  margin-bottom: 22px;
}

/* —— Help / SEO block —— */
.tool-help {
  margin-top: 40px;
  padding: 24px 26px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.tool-help h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #fff;
}

.tool-help h2:not(:first-child) {
  margin-top: 22px;
}

.tool-help h3 {
  margin: 18px 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.tool-help p {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 68ch;
}

.tool-help .faq-section {
  margin-top: 22px;
  padding: 0;
}

.tool-help .faq-section > h2 {
  margin-bottom: 12px;
}

.tool-hidden {
  display: none !important;
}

/* —— Two-column layout (timing etc.) —— */
.tool-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.tool-grid--equal {
  grid-template-columns: 1fr 1fr;
}

.tool-grid .tool-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.tool-grid .tool-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tool-grid .tool-card-body textarea {
  flex: 1;
  min-height: 240px;
}

.tool-grid > .tool-card + .tool-card {
  margin-top: 0;
}

.tool-grid + .tool-stats {
  margin-top: 14px;
  justify-content: center;
}

@media (max-width: 760px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-grid .tool-card-body textarea {
    min-height: 200px;
  }
}

/* —— Table (batch) —— */
.tool-table-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(18, 18, 24, 0.5);
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.tool-table th,
.tool-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.tool-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
}

.tool-table td {
  color: var(--text-muted);
}

.tool-table td.title {
  color: var(--text-main);
  font-weight: 600;
}

.tool-table tr.is-err td {
  color: #ffb4b4;
}

.tool-table-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.tool-export-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-card .tool-table-wrap {
  margin-top: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.tool-card .tool-table-wrap + .tool-export-bar,
.tool-card-foot.tool-export-bar {
  margin-top: 0;
}

.tool-result-count {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.tool-table tr.is-pending td {
  color: var(--text-dim);
}

.tool-table tr.is-pending td.title,
.tool-table tr.is-pending .bt-skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: toolSkelShimmer 1.4s ease-in-out infinite;
  color: transparent !important;
  border-radius: 6px;
  min-height: 14px;
}

@keyframes toolSkelShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
