/* =========================================================
   拾光小站 · Toolbox
   ========================================================= */

.page-hero {
  padding-block: 26px clamp(38px, 5vw, 60px);
  overflow: clip;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 30px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .05em;
}

.breadcrumb a {
  transition: color .2s ease;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span:nth-child(2) {
  opacity: .45;
}

.page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: end;
  gap: clamp(34px, 6vw, 80px);
}

.page-hero h1 {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5.5vw, 4.8rem);
  font-weight: 600;
  letter-spacing: -.055em;
  line-height: 1.02;
}

.page-hero h1 .marker {
  position: relative;
  display: inline-block;
  color: var(--green-deep);
  z-index: 0;
}

[data-theme="dark"] .page-hero h1 .marker {
  color: var(--green);
}

.page-hero h1 .marker::after {
  content: "";
  position: absolute;
  left: -1%;
  right: -1%;
  bottom: .12em;
  height: .22em;
  border-radius: 2px;
  background: var(--yellow);
  opacity: .7;
  transform: rotate(-1deg);
  z-index: -1;
}

.page-hero p {
  max-width: 530px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
}

.page-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 26px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
}

.page-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.page-hero-meta i {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  font-size: 8px;
  font-style: normal;
  line-height: 1;
}

.tool-readme {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-solid) 66%, transparent);
  box-shadow: var(--shadow-sm);
}

.tool-readme::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -54px;
  width: 130px;
  height: 130px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  pointer-events: none;
}

.tool-readme__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
}

.tool-readme ol {
  display: grid;
  margin-top: 12px;
  list-style: none;
}

.tool-readme li {
  display: flex;
  gap: 12px;
  padding-block: 9px;
  color: var(--ink-soft);
  font-size: 12px;
}

.tool-readme li b {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding-top: 1px;
}

.tool-readme > p {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

/* ---------------- Layout ---------------- */

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

.tool-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  box-shadow: var(--shadow-sm);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .13em;
}

.tool-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.tool-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}

.tool-search svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.tool-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.tool-search input::placeholder {
  color: var(--muted);
}

.tool-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.tool-search kbd {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.tool-search-empty {
  padding: 16px 4px 4px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.tool-nav {
  display: grid;
  gap: 1px;
  margin-top: 10px;
}

.tool-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.tool-nav-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.tool-nav-btn.is-active {
  background: var(--green-deep);
  color: #f7f1e2;
}

[data-theme="dark"] .tool-nav-btn.is-active {
  background: var(--green);
  color: #102018;
}

.tool-nav-num {
  width: 19px;
  flex: none;
  color: var(--line-strong);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .03em;
}

.tool-nav-btn.is-active .tool-nav-num {
  color: color-mix(in srgb, currentColor 50%, transparent);
}

.tool-nav-label {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.tool-nav-label b {
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.3;
}

.tool-nav-label small {
  color: inherit;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .12em;
  opacity: .48;
}

.tool-nav-arrow {
  opacity: 0;
  transform: translateX(-4px);
  font-size: 12px;
  transition: opacity .18s ease, transform .18s ease;
}

.tool-nav-btn.is-active .tool-nav-arrow {
  opacity: .7;
  transform: none;
}

.sidebar-note {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  padding: 12px 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
}

.sidebar-note__mark {
  color: var(--accent);
  font-size: 10px;
}

.sidebar-note p {
  font-size: 10px;
  line-height: 1.65;
}

kbd {
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-soft);
  font-family: var(--font-mono);
  font-size: .9em;
}

/* ---------------- Tool stage & panel ---------------- */

.tool-stage {
  min-width: 0;
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.tool-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.tool-panel.is-active {
  display: block;
  animation: panel-in .32s var(--ease) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(7px); }
}

.tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--line);
}

.tool-title {
  display: flex;
  gap: 15px;
  min-width: 0;
}

.tool-index {
  flex: none;
  padding-top: 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
}

.tool-kicker {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .12em;
}

.tool-head h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.15;
}

.tool-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.tool-head > .badge {
  margin-top: 4px;
}

.tool-body {
  padding: 24px 28px 26px;
}

/* ---------------- Form primitives ---------------- */

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.field-label > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
}

.field {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field:hover {
  border-color: var(--line-strong);
}

.field:focus {
  border-color: var(--accent);
  outline: 0;
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.field::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.field--area {
  min-height: 176px;
  resize: vertical;
  line-height: 1.8;
}

.field--code {
  min-height: 250px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}

.field--output {
  background: color-mix(in srgb, var(--green-soft) 45%, var(--surface-soft));
}

.field--mono {
  font-family: var(--font-mono);
  letter-spacing: .02em;
}

.field--big {
  height: 62px;
  min-height: 62px;
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 500;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

select.field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236c776f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

[data-theme="dark"] select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2398a398' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.tool-actions--top {
  margin: 0 0 18px;
}

.tool-push {
  margin-left: auto;
}

.inline-copy {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .04em;
  line-height: 1.4;
  transition: color .2s ease, border-color .2s ease;
}

.inline-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.check-inline,
.select-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.check-inline {
  margin-left: auto;
  cursor: pointer;
}

.check-inline input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.select-inline {
  margin-left: auto;
}

.select-inline select {
  min-height: 34px;
  padding: 4px 28px 4px 10px;
  font-size: 11px;
}

/* ---------------- Text stats ---------------- */

.stat-grid {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.stat-grid--four {
  grid-template-columns: repeat(4, 1fr);
}

.stat-box {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  background: var(--surface-solid);
}

.stat-box span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .03em;
}

.stat-box b {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-box small {
  color: var(--muted);
  font-size: 8.5px;
  opacity: .7;
}

.tool-footnote {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.tool-footnote > span {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
}

/* ---------------- Split editor ---------------- */

.tool-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

.field-group {
  min-width: 0;
}

.tool-split-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 15px;
  opacity: .55;
}

.field-label .inline-copy {
  font-weight: 400;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 12px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-soft) 54%, transparent);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.5;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--line-strong);
}

.status-line.is-ok {
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
  color: var(--green);
}

.status-line.is-ok .status-dot {
  background: var(--green);
}

.status-line.is-error {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  color: var(--danger);
}

.status-line.is-error .status-dot {
  background: var(--danger);
}

/* ---------------- URL params ---------------- */

.params-block {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.params-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.params-list {
  display: grid;
  padding: 6px 14px;
}

.params-row {
  display: grid;
  grid-template-columns: minmax(90px, .38fr) minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

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

.params-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.params-row b {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.params-empty {
  padding: 10px 0;
  color: var(--muted);
  font-size: 11px;
}

/* ---------------- Time ---------------- */

.now-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 18%, rgba(239, 197, 95, .16), transparent 36%),
    var(--green-deep);
  color: #f7f1e2;
}

[data-theme="dark"] .now-card {
  background:
    radial-gradient(circle at 88% 18%, rgba(239, 197, 95, .2), transparent 36%),
    #274534;
}

.now-card__label {
  color: rgba(247, 241, 226, .55);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.now-card strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -.05em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.now-card small {
  display: block;
  margin-top: 3px;
  color: rgba(247, 241, 226, .55);
  font-size: 10px;
}

.now-card__stamp {
  display: grid;
  justify-items: end;
  gap: 3px;
  flex: none;
}

.now-card__stamp span {
  color: rgba(247, 241, 226, .5);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .08em;
}

.now-card__stamp b {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.02em;
}

.now-card__stamp .inline-copy {
  color: rgba(247, 241, 226, .55);
  border-color: rgba(247, 241, 226, .22);
}

.now-card__stamp .inline-copy:hover {
  color: var(--yellow);
  border-color: var(--yellow);
}

.convert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.convert-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 42%, transparent);
}

.convert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.convert-head span:last-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .1em;
}

.input-with-button {
  display: flex;
  gap: 7px;
}

.input-with-button .field {
  min-width: 0;
}

.input-with-button .btn {
  flex: none;
  min-height: 44px;
  border-radius: 11px;
}

.result-box {
  display: grid;
  gap: 2px;
  min-height: 80px;
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
}

.result-box span {
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: .04em;
}

.result-box strong {
  font-family: var(--font-mono);
  font-size: clamp(.92rem, 1.7vw, 1.05rem);
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.result-box small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  overflow-wrap: anywhere;
}

/* ---------------- Password ---------------- */

.password-output {
  display: flex;
  align-items: stretch;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.password-field {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.3vw, 1.3rem);
  letter-spacing: .03em;
}

.password-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.password-actions .btn {
  min-height: 44px;
}

.strength-row {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) 56px;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 9.5px;
}

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

.strength-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .3s var(--ease), background .3s ease;
}

.strength-row b {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-align: right;
}

.option-grid {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: 24px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
}

.range-field .field-label strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.range {
  width: 100%;
  height: 26px;
  margin: 3px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 47px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-soft) 50%, transparent);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}

.check-option:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.check-option input {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}

.check-option span {
  display: grid;
  gap: 0;
}

.check-option b {
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.3;
}

.check-option small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.check-option--wide {
  grid-column: 1 / -1;
}

/* ---------------- Color ---------------- */

.color-layout {
  display: grid;
  grid-template-columns: minmax(180px, .72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.color-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.color-preview__sample {
  flex: 1;
  min-height: 220px;
  background: #e7653f;
  transition: background .25s ease;
}

.color-preview__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-solid);
}

.color-preview__caption span {
  color: var(--muted);
  font-size: 9px;
}

.color-preview__caption b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.color-controls {
  display: grid;
  align-content: start;
  gap: 17px;
}

.color-picker-row {
  display: flex;
  align-items: end;
  gap: 12px;
}

.color-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 44px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.color-picker input {
  width: 34px;
  height: 32px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.color-picker input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker input::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

.color-hex-field {
  flex: 1;
}

.color-values {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.color-value {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-solid);
}

.color-value:last-child {
  border-bottom: 0;
}

.color-value > span {
  width: 27px;
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
}

.color-value b {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.color-shades {
  display: grid;
  gap: 7px;
}

.shade-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.shade {
  position: relative;
  height: 46px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 7px;
  background: var(--shade);
  transition: transform .18s ease;
}

.shade:hover {
  transform: translateY(-2px);
}

.shade button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--shade-text);
  font-family: var(--font-mono);
  font-size: 7px;
  opacity: 0;
  transition: opacity .18s ease;
}

.shade:hover button,
.shade button:focus-visible {
  opacity: 1;
}

/* ---------------- Units ---------------- */

.unit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.unit-toolbar .select-inline {
  margin-left: 0;
}

.unit-toolbar .select-inline > span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.unit-toolbar .select-inline select {
  min-width: 132px;
  min-height: 38px;
  font-size: 12px;
}

.unit-note {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .04em;
}

.unit-converter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.unit-side {
  display: grid;
}

.unit-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 7px;
}

.unit-input-wrap select {
  min-height: 62px;
  height: 62px;
  font-size: 12px;
}

.unit-converter .field--big {
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
}

.swap-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 62px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 16px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.swap-button:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface-solid);
}

.unit-result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 11px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* ---------------- Calculator ---------------- */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr);
  gap: 18px;
  align-items: stretch;
}

.calc-shell {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-soft) 60%, transparent);
}

.calc-screen {
  position: relative;
  min-height: 144px;
  padding: 14px 18px 16px;
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(circle at 88% 12%, rgba(239, 197, 95, .13), transparent 38%),
    var(--green-deep);
  color: #f7f1e2;
}

[data-theme="dark"] .calc-screen {
  background:
    radial-gradient(circle at 88% 12%, rgba(239, 197, 95, .16), transparent 38%),
    #274534;
}

.calc-screen__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  color: rgba(247, 241, 226, .42);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .13em;
}

.calc-screen__top .inline-copy {
  color: rgba(247, 241, 226, .55);
  border-color: rgba(247, 241, 226, .25);
}

.calc-screen__top .inline-copy:hover {
  color: var(--yellow);
  border-color: var(--yellow);
}

.calc-expression {
  min-height: 22px;
  margin-top: 16px;
  color: rgba(247, 241, 226, .62);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  text-align: right;
  overflow-wrap: anywhere;
}

.calc-result {
  min-height: 48px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: 1.15;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.calc-result.is-error {
  color: var(--yellow);
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  letter-spacing: 0;
}

.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.calc-key {
  display: grid;
  place-items: center;
  height: 53px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}

.calc-key:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.calc-key:active {
  transform: scale(.97);
}

.calc-key--operator {
  border-color: color-mix(in srgb, var(--green) 18%, var(--line));
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 20px;
}

.calc-key--operator:hover {
  background: color-mix(in srgb, var(--green-soft) 72%, var(--green));
}

.calc-key--fn {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 15px;
}

.calc-key--equals {
  border-color: transparent;
  background: var(--accent);
  color: #fffaf2;
  font-size: 21px;
}

.calc-key--equals:hover {
  background: var(--accent-deep);
  color: #fffaf2;
}

.calc-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.calc-help kbd {
  margin-inline: 1px;
}

.calc-history {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
}

.calc-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .1em;
}

.calc-history__list {
  display: grid;
  align-content: start;
  gap: 4px;
  flex: 1;
  max-height: 320px;
  overflow-y: auto;
  padding-block: 8px;
  scrollbar-width: thin;
}

.calc-history__item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  text-align: right;
  transition: background .18s ease, border-color .18s ease;
}

.calc-history__item:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.calc-history__item small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.calc-history__item b {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.calc-history__empty {
  padding: 18px 4px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.calc-history__note {
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.65;
}

/* ---------------- Notepad ---------------- */

.notepad-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.notepad-title-field {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.notepad-title-field > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.notepad-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.notepad-status {
  padding-right: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .03em;
}

.notepad-status.is-saved {
  color: var(--green);
}

.notepad-body {
  min-height: 360px;
  margin-top: 14px;
  padding: 17px 18px;
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.95;
}

.notepad-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .03em;
}

/* ---------------- CTA ---------------- */

.tool-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 20%, color-mix(in srgb, var(--yellow) 20%, transparent), transparent 38%),
    color-mix(in srgb, var(--surface-solid) 72%, transparent);
}

.tool-cta h2 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.15;
}

.tool-cta p {
  max-width: 540px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.tool-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: none;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
  .tools-layout {
    grid-template-columns: 226px minmax(0, 1fr);
  }

  .tool-sidebar {
    padding: 13px;
  }

  .tool-head,
  .tool-body {
    padding-inline: 22px;
  }

  .option-grid {
    gap: 18px;
  }
}

@media (max-width: 900px) {
  .page-hero-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .tool-readme {
    display: none;
  }

  .tools-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tool-sidebar {
    position: static;
    padding: 14px;
  }

  .sidebar-head,
  .sidebar-note {
    display: none;
  }

  .tool-search {
    max-width: 100%;
  }

  .tool-nav {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .tool-nav-btn {
    flex: none;
    width: auto;
    padding: 8px 11px;
    border: 1px solid var(--line);
    white-space: nowrap;
  }

  .tool-nav-num,
  .tool-nav-arrow {
    display: none;
  }

  .tool-nav-label {
    display: block;
  }

  .tool-nav-label small {
    display: none;
  }

  .tool-head {
    padding: 22px 22px 18px;
  }

  .tool-body {
    padding: 20px 22px 22px;
  }

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

  .tool-split-arrow {
    height: 20px;
    transform: rotate(90deg);
  }

  .field--code {
    min-height: 200px;
  }

  .color-layout {
    grid-template-columns: 1fr;
  }

  .color-preview {
    min-height: 0;
  }

  .color-preview__sample {
    min-height: 150px;
  }

  .color-controls {
    gap: 14px;
  }

  .tool-cta {
    display: grid;
    gap: 22px;
  }
}

@media (max-width: 700px) {
  .page-hero {
    padding-top: 18px;
  }

  .page-hero h1 {
    font-size: clamp(2.7rem, 11vw, 3.8rem);
  }

  .page-hero p {
    font-size: 13.5px;
  }

  .tool-head {
    display: grid;
    gap: 12px;
  }

  .tool-head > .badge {
    justify-self: start;
    margin-top: 0;
  }

  .stat-grid--four {
    grid-template-columns: 1fr 1fr;
  }

  .convert-grid {
    grid-template-columns: 1fr;
  }

  .password-output {
    display: grid;
  }

  .password-actions {
    justify-content: stretch;
  }

  .password-actions .btn {
    flex: 1;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .now-card {
    display: grid;
    gap: 14px;
  }

  .now-card__stamp {
    justify-items: start;
  }

  .unit-converter {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .swap-button {
    justify-self: center;
    width: 100%;
    height: 38px;
  }

  .unit-input-wrap {
    grid-template-columns: minmax(0, 1fr) 110px;
  }

  .unit-result-line {
    display: grid;
    gap: 8px;
  }

  .unit-toolbar {
    display: grid;
    gap: 8px;
  }

  .unit-note {
    order: -1;
  }

  .tool-cta__actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .tool-body,
  .tool-head {
    padding-inline: 15px;
  }

  .tool-head h2 {
    font-size: 1.55rem;
  }

  .tool-head p {
    font-size: 11px;
  }

  .tool-actions {
    gap: 6px;
  }

  .tool-actions .btn {
    flex: 1 1 auto;
    padding-inline: 10px;
    font-size: 11px;
  }

  .tool-actions .check-inline,
  .tool-actions .select-inline {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .field--area {
    min-height: 150px;
  }

  .stat-box {
    padding: 13px;
  }

  .stat-box b {
    font-size: 1.2rem;
  }

  .color-picker-row {
    display: grid;
  }

  .color-picker {
    justify-content: center;
  }

  .color-value {
    display: grid;
    grid-template-columns: 28px 1fr auto;
  }

  .color-value .inline-copy {
    justify-self: end;
  }

  .password-field {
    font-size: .9rem;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .check-option--wide {
    grid-column: auto;
  }

  .tool-cta {
    padding: 22px 18px;
  }

  .tool-cta__actions {
    display: grid;
  }

  .unit-input-wrap {
    grid-template-columns: 1fr;
  }

  .unit-input-wrap select {
    height: 46px;
    min-height: 46px;
  }
}

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

  .calc-history {
    min-height: 0;
  }

  .calc-history__list {
    max-height: 220px;
  }
}

@media (max-width: 700px) {
  .notepad-toolbar {
    display: grid;
  }

  .notepad-title-field {
    min-width: 0;
  }

  .notepad-actions {
    justify-content: flex-start;
  }

  .notepad-status {
    width: 100%;
    padding-bottom: 3px;
  }

  .notepad-body {
    min-height: 300px;
    margin-top: 12px;
  }

  .calc-help {
    display: grid;
    gap: 7px;
  }
}

@media (max-width: 480px) {
  .calc-shell {
    padding: 9px;
  }

  .calc-screen {
    padding: 12px 13px 14px;
  }

  .calc-keypad {
    gap: 5px;
  }

  .calc-key {
    height: 47px;
    border-radius: 7px;
    font-size: 15px;
  }

  .calc-key--operator {
    font-size: 18px;
  }

  .calc-key--equals {
    font-size: 19px;
  }

  .calc-history {
    padding: 14px;
  }

  .notepad-foot {
    display: grid;
    gap: 5px;
  }
}
