:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #17202a;
  --muted: #667382;
  --line: #d8e0e8;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warning: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(18, 27, 38, 0.08);
}

:root.dark {
  color-scheme: dark;
  --bg: #111827;
  --surface: #182231;
  --surface-2: #223044;
  --ink: #eef4fb;
  --muted: #aeb9c8;
  --line: #344154;
  --accent: #2dd4bf;
  --accent-2: #60a5fa;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.brand,
.nav-links,
.result-grid,
.recent-list {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 700;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.language-control select {
  min-height: 38px;
  max-width: 180px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
}

.nav-links {
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav-links a,
.theme-toggle,
.tool-card button,
.copy-button,
.recent-list button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
}

.theme-toggle {
  width: 40px;
  cursor: pointer;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.hero {
  display: block;
}

.hero-copy,
.sidebar,
.active-tool,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.search-wrap {
  margin-top: 22px;
}

.search-wrap input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.search-wrap input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  outline: none;
}

.tool-card span,
.active-tool-header span,
.result-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 82px;
  height: var(--sidebar-frame-height, calc(100dvh - 100px));
  max-height: var(--sidebar-frame-height, calc(100dvh - 100px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  scrollbar-gutter: stable;
}

.side-block + .side-block {
  margin-top: 24px;
}

.side-block h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.side-block a,
.recent-list button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  margin-top: 8px;
  color: var(--muted);
}

.side-block a {
  min-height: 34px;
}

.recent-list {
  flex-direction: column;
  align-items: stretch;
  color: var(--muted);
  font-size: 0.92rem;
}

.recent-list button {
  padding: 8px 10px;
  cursor: pointer;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.tool-grid,
.category-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
}

.empty-state p {
  max-width: 520px;
  margin-bottom: 0;
}

.category-section {
  scroll-margin-top: 88px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.category-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-card {
  padding: 18px;
}

.tool-card.is-active {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 18px 48px color-mix(in srgb, var(--accent) 14%, transparent);
}

.tool-card.is-pinned {
  border-color: color-mix(in srgb, #f59e0b 46%, var(--line));
}

.pinned-section {
  padding: 14px;
  border: 1px solid color-mix(in srgb, #f59e0b 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, #f59e0b 7%, var(--surface));
}

.tool-card h3 {
  margin: 7px 0 8px;
  font-size: 1.12rem;
}

.tool-card p {
  min-height: 48px;
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.55;
}

.tool-card button,
.copy-button {
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

.tool-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tool-card button {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tool-card button:hover,
.tool-card.is-active button {
  color: #ffffff;
  background: var(--accent);
}

.tool-card {
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tool-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: translateY(-2px);
}

.copy-button,
.download-button,
.recent-list button,
.nav-links a,
.theme-toggle,
.reset-button {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.copy-button:hover,
.download-button:hover,
.reset-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--ink) 14%, transparent);
}

.recent-list button:hover,
.nav-links a:hover,
.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.tool-card .pin-button {
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  place-items: center;
  padding: 0;
  color: #facc15;
  border-color: color-mix(in srgb, #facc15 52%, var(--line));
  background: color-mix(in srgb, #facc15 10%, var(--surface));
  font-size: 1.22rem;
  line-height: 1;
}

.tool-card .pin-button span {
  display: inline;
  color: #facc15;
  font-size: inherit;
}

.tool-card .pin-button[aria-pressed="true"] {
  color: #eab308;
  border-color: color-mix(in srgb, #facc15 78%, var(--line));
  background: color-mix(in srgb, #facc15 18%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, #facc15 16%, transparent);
}

.tool-card .pin-button[aria-pressed="true"] span {
  color: #eab308;
}

.active-tool {
  min-width: 0;
  padding: 22px;
}

.tool-workspace.is-inline {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 8px 0 18px;
}

.tool-workspace.is-inline .active-tool {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.active-tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.share-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.share-button:hover {
  color: #ffffff;
  background: var(--accent);
  transform: translateY(-1px);
}

.active-tool-header h2 {
  margin: 5px 0 8px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.active-tool-header p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.privacy-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--muted);
  font-size: 0.92rem;
}

.privacy-note strong {
  color: var(--ink);
}

.privacy-note[data-privacy-level="local-file"],
.privacy-note[data-privacy-level="private-input"] {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tool-form label {
  display: grid;
  gap: 7px;
}

.tool-form span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.tool-form input,
.tool-form select,
.tool-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.tool-form textarea,
.tool-form label:has(textarea) {
  grid-column: 1 / -1;
}

.tool-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clear-field-button {
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.clear-field-button:hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}

.form-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.reset-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.tool-seo-content {
  margin-top: 26px;
}

.tool-seo-content h2 {
  margin-top: 26px;
  font-size: 1.25rem;
}

.tool-seo-content h3 {
  margin: 18px 0 6px;
  font-size: 1.02rem;
}

.tool-seo-content p,
.tool-seo-content li {
  color: var(--muted);
  line-height: 1.65;
}

.related-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-tools a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.related-tools a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.diff-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.diff-column h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.diff-filler {
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
  opacity: 0.5;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.status-badge.is-good {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
}

.status-badge.is-bad {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}

.json-highlighted .json-key {
  color: #7dd3fc;
}

.json-highlighted .json-string {
  color: #86efac;
}

.json-highlighted .json-number {
  color: #fbbf24;
}

.json-highlighted .json-boolean {
  color: #c4b5fd;
}

.json-highlighted .json-null {
  color: #94a3b8;
}

.growth-chart {
  margin: 16px 0;
  padding: 16px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.chart-legend-item .legend-gain {
  background: var(--accent);
}

.chart-legend-item .legend-base {
  background: var(--accent-2);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
}

.chart-bar {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.chart-bar-fill {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  overflow: hidden;
  transition: opacity 0.15s ease;
}

.chart-bar:hover .chart-bar-fill {
  opacity: 0.75;
}

.chart-bar-base {
  background: var(--accent-2);
}

.chart-bar-label {
  min-height: 16px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.strength-meter {
  margin: 0 0 14px;
}

.strength-meter-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.strength-meter-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.strength-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.tool-result {
  margin-top: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-grid div {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.result-grid strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.result-grid > div:first-child {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

.result-grid > div:first-child strong {
  color: var(--accent);
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
}

.decision-tool {
  overflow: hidden;
}

.decision-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(260px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.decision-visual {
  display: grid;
  min-height: 340px;
  place-items: center;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 18%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface-2));
}

.decision-stage {
  display: grid;
  width: 100%;
  min-height: 280px;
  gap: 14px;
  justify-items: center;
  align-content: center;
}

.decision-headline {
  display: block;
  max-width: 100%;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  transition: all 0.25s ease;
}

.decision-headline.is-final {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--ink);
  font-size: 1.12rem;
  animation: headline-pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.coin-scene {
  display: grid;
  justify-items: center;
  gap: 12px;
  perspective: 900px;
}

.coin {
  position: relative;
  width: 160px;
  height: 160px;
  transform-style: preserve-3d;
  will-change: transform;
}

.coin-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 8px solid #eab308;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff7cc, #facc15 48%, #d97706 100%);
  color: #713f12;
  backface-visibility: hidden;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 32px color-mix(in srgb, #a16207 30%, transparent);
}

.coin-face-back {
  transform: rotateX(180deg);
  background: radial-gradient(circle at 35% 28%, #fef3c7, #f59e0b 48%, #b45309 100%);
}

.coin-shadow {
  width: 120px;
  height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  filter: blur(4px);
}

.coin-stage.is-flipping .coin-shadow {
  animation: coin-shadow-squash 0.8s ease-in-out infinite alternate;
}

.dice-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, max-content));
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.die {
  display: grid;
  aspect-ratio: 1;
  min-width: 64px;
  place-items: center;
  border: 2px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--ink) 12%, transparent);
  font-size: 1.65rem;
  font-weight: 800;
}

.die.is-rolling {
  animation: dice-bounce 0.32s ease-in-out infinite alternate;
  color: var(--muted);
}

.die.is-set {
  border-color: var(--accent);
  animation: dice-settle 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.dice-more {
  display: grid;
  min-width: 64px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.roulette-wrap {
  position: relative;
  width: min(300px, 78vw);
}

.roulette-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid var(--danger);
  transform: translateX(-50%);
  transform-origin: 50% 0;
  filter: drop-shadow(0 3px 4px color-mix(in srgb, var(--ink) 30%, transparent));
}

.roulette-svg {
  display: block;
  width: 100%;
  height: auto;
}

.roulette-rotor {
  will-change: transform;
}

.roulette-label {
  fill: #ffffff;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 2px;
}

.roulette-hub {
  fill: var(--surface);
  stroke: color-mix(in srgb, var(--accent) 60%, var(--line));
  stroke-width: 4;
}

.roulette-rim {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 70%, #ffffff);
  stroke-width: 7;
}

.roulette-stage.has-result .roulette-pointer {
  animation: pointer-nudge 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.ladder-stage {
  width: 100%;
}

.ladder-scroll {
  width: 100%;
  max-width: 640px;
  padding-bottom: 4px;
  overflow-x: auto;
}

.ladder-frame {
  display: grid;
  min-width: min(100%, var(--ladder-width, 100%));
  gap: 6px;
}

.ladder-label-row {
  display: grid;
  grid-template-columns: repeat(var(--ladder-cols, 4), minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px;
}

.ladder-label-row span {
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.ladder-label-row span.is-traced {
  border-color: var(--path-color, var(--accent));
  background: color-mix(in srgb, var(--path-color, var(--accent)) 14%, var(--surface));
  color: var(--ink);
}

.ladder-board {
  width: 100%;
}

.ladder-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ladder-rail-line {
  stroke: color-mix(in srgb, var(--accent) 45%, var(--line));
  stroke-width: 5;
  stroke-linecap: round;
}

.ladder-rung-line {
  stroke: color-mix(in srgb, var(--accent) 30%, var(--line));
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ladder-rung-group.is-revealed .ladder-rung-line {
  opacity: 1;
}

.ladder-stage.is-idle .ladder-rung-line {
  opacity: 0.18;
  stroke-dasharray: 2 8;
}

.ladder-path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.ladder-path.is-tracing {
  opacity: 1;
  transition-property: stroke-dashoffset;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.decision-form {
  align-self: start;
}

.decision-action {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.decision-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

.decision-action:disabled {
  cursor: wait;
  opacity: 0.6;
}

.decision-empty {
  margin: 0;
  color: var(--muted);
}

@keyframes headline-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes coin-shadow-squash {
  from { transform: scaleX(1); opacity: 0.8; }
  to { transform: scaleX(0.6); opacity: 0.4; }
}

@keyframes dice-bounce {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-10px) rotate(5deg); }
}

@keyframes dice-settle {
  0% { transform: scale(1.25); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes pointer-nudge {
  0% { transform: translateX(-50%) rotate(-14deg); }
  60% { transform: translateX(-50%) rotate(6deg); }
  100% { transform: translateX(-50%) rotate(0); }
}


.tool-output {
  min-height: 120px;
  max-height: 360px;
  margin: 0 0 10px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  white-space: pre-wrap;
}

.data-table-wrap {
  max-width: 100%;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--ink) 2.5%, var(--surface));
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.diff-view {
  max-height: 420px;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.diff-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
}

.diff-row:last-child {
  border-bottom: 0;
}

.diff-row span {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.diff-row code {
  min-width: 0;
  padding: 9px 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.diff-added {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.diff-added span {
  color: var(--accent);
}

.diff-removed {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.diff-removed span {
  color: var(--danger);
}

.regex-preview {
  min-height: 120px;
  max-height: 320px;
  margin: 14px 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  white-space: pre-wrap;
}

.regex-preview mark {
  padding: 1px 3px;
  border-radius: 4px;
  color: var(--ink);
  background: color-mix(in srgb, var(--warning) 34%, transparent);
}

.match-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.match-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.match-row span {
  color: var(--muted);
  font-weight: 700;
}

.match-row code {
  overflow-wrap: anywhere;
}

.match-row small {
  grid-column: 2;
  color: var(--muted);
}

.muted-inline {
  color: var(--muted);
}

.markdown-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.65;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview p,
.markdown-preview ul,
.markdown-preview pre {
  margin: 0;
}

.markdown-preview ul {
  padding-left: 22px;
}

.markdown-preview code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

.markdown-preview pre {
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
}

.markdown-preview a {
  color: var(--accent-2);
  text-decoration: underline;
}

.security-note {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.security-warning {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.security-note ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.jwt-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.jwt-panels h3 {
  margin-bottom: 8px;
}

.upload-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
}

.file-field {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  min-height: 110px;
  align-content: center;
  padding: 18px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-field:hover,
.file-field.is-drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.file-field input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tool-form .file-field-title {
  color: var(--ink);
  font-weight: 800;
}

.tool-form .file-picker-button {
  padding: 10px 16px;
  border: 1px solid #053f3b;
  border-radius: 8px;
  background: #053f3b;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  box-shadow: 0 8px 18px rgba(6, 78, 73, 0.28);
  font-size: 1rem;
  font-weight: 900;
}

.file-name,
.file-field-hint {
  font-size: 0.9rem;
}

.tool-form .file-name {
  align-self: center;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tool-form .file-field-hint {
  color: color-mix(in srgb, var(--ink) 76%, var(--muted));
  font-weight: 600;
}

:root.dark .tool-form .file-picker-button {
  border-color: #5eead4;
  background: #0f766e;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.18);
}

.tool-form .check-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tool-form .check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.tool-form .check-field span {
  color: var(--ink);
}

.image-result {
  display: grid;
  gap: 14px;
}

.image-preview-wrap {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%);
  background-color: var(--surface);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.file-result {
  display: grid;
  gap: 12px;
}

.qr-result {
  display: grid;
  gap: 14px;
}

.qr-preview {
  display: grid;
  width: fit-content;
  max-width: 100%;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
}

.qr-preview svg {
  display: block;
  max-width: min(100%, 420px);
  height: auto;
}

.image-result img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  object-fit: contain;
}

.image-result img.is-pixel-art {
  image-rendering: pixelated;
}

.palette-panel {
  display: grid;
  gap: 10px;
}

.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.palette-swatch {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.download-button {
  display: inline-flex;
  width: fit-content;
  min-height: 42px;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
}

.download-button.secondary {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.download-button.is-disabled {
  pointer-events: none;
  opacity: 0.5;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.asset-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.asset-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.asset-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.asset-preview {
  display: grid;
  min-height: 130px;
  place-items: center;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.asset-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 6px;
  object-fit: contain;
}

.metadata-snippet {
  display: grid;
  gap: 8px;
}

.metadata-snippet span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metadata-snippet pre {
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.84rem;
}

.social-preview {
  display: grid;
  grid-template-columns: minmax(180px, 42%) 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.social-preview-image {
  min-height: 220px;
  background-color: var(--surface-2);
  background-position: center;
  background-size: cover;
}

.social-preview-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px;
}

.social-preview-body span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.social-preview-body strong {
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.25;
}

.social-preview-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.schema-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.schema-summary strong {
  color: var(--text);
}

.schema-summary span {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.readability-panel {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 14px;
  align-items: stretch;
}

.readability-score {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(var(--accent) var(--score), var(--line) 0) border-box;
  text-align: center;
}

.readability-score strong {
  color: var(--text);
  font-size: 2.4rem;
  line-height: 1;
}

.readability-score span {
  color: var(--muted);
  font-weight: 700;
}

.readability-advice {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.readability-advice strong {
  color: var(--text);
}

.readability-advice ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.brand-system-result {
  display: grid;
  gap: 14px;
}

.palette-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand-swatch {
  display: grid;
  min-height: 92px;
  align-content: end;
  gap: 4px;
  padding: 10px;
}

.brand-swatch span {
  font-size: 0.82rem;
  opacity: 0.86;
}

@media (max-width: 720px) {
  .palette-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.content-page {
  display: grid;
  gap: 14px;
  max-width: 820px;
  margin: 18px 0 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.content-page h2 {
  margin: 8px 0 0;
  font-size: 1.1rem;
}

.content-page p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tool-error {
  margin: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line));
  border-radius: 8px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.how-to {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.how-to h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.how-to ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  color: var(--ink);
  font-weight: 700;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .layout,
  .layout {
    grid-template-columns: 1fr;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0;
  }

  .nav-links a {
    flex: 0 0 auto;
  }

  .sidebar {
    position: static;
    order: 2;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .side-block a {
    display: inline-flex;
    width: auto;
    min-height: 36px;
    margin: 8px 8px 0 0;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
  }

  .tool-card-list,
  .tool-form,
  .decision-layout,
  .result-grid,
  .jwt-panels,
  .social-preview {
    grid-template-columns: 1fr;
  }

  .social-preview-image {
    min-height: 180px;
  }

  .schema-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .schema-summary span {
    text-align: left;
  }

  .readability-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .active-tool {
    padding: 20px;
  }

  .active-tool-header,
  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  main,
  .site-footer {
    width: min(100% - 20px, 100%);
  }

  .site-header {
    padding: 12px 10px;
  }

  .language-control span {
    display: none;
  }

  .language-control select {
    max-width: 142px;
  }

  .hero-copy,
  .active-tool,
  .tool-card,
  .sidebar {
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .data-table {
    min-width: 460px;
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 9px 10px;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid > div:first-child {
    grid-column: 1 / -1;
  }
}
