.tools-page { min-height: 100vh; display: flex; flex-direction: column; }
.tools-main { flex: 1; }
.tools-hero { padding: 82px 0 74px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tools-hero h1 { font-size: clamp(48px, 6vw, 76px); }
.tools-hero .lead { margin-top: 18px; }
.tools-content { background: var(--white); }
.counter-tool { display: grid; grid-template-columns: .85fr 1.15fr; border: 1px solid var(--line); }
.stopwatch-tool, .pomodoro-tool, .actuator-tool { margin-top: 32px; }
.counter-description { padding: 48px; }
.counter-description h2 { font-size: clamp(30px, 3vw, 42px); line-height: 1.2; letter-spacing: -.03em; font-weight: 600; }
.counter-description > p:last-child { margin-top: 20px; color: var(--muted); }
.counter-panel { min-height: 360px; padding: 48px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--blue-deep); color: var(--white); }
.counter-label { color: var(--blue-muted); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.counter-value { margin: 12px 0 28px; font-size: clamp(76px, 10vw, 120px); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stopwatch-value { font-size: clamp(54px, 7vw, 88px); letter-spacing: -.04em; }
.counter-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.counter-increment { background: var(--white); color: var(--navy); }
.counter-increment:hover { background: var(--surface); }
.counter-reset { border-color: var(--muted); color: var(--white); }
.counter-reset:hover { border-color: var(--white); }
.counter-actions button:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

.pomodoro-sessions { margin-top: 30px !important; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }
.pomodoro-sessions strong { color: var(--ink); font-size: 20px; }
.pomodoro-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.pomodoro-settings > label:not(.sound-setting) { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
.duration-input { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.duration-input input { width: 58px; height: 34px; padding: 0 7px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font: 600 14px var(--font); }
.duration-input input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.duration-input input:disabled { background: var(--surface); color: var(--muted); cursor: not-allowed; }
.sound-setting { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; cursor: pointer; }
.sound-setting input { width: 17px; height: 17px; accent-color: var(--navy); }
.pomodoro-panel { position: relative; padding-top: 96px; }
.pomodoro-modes { position: absolute; top: 32px; display: flex; padding: 4px; border: 1px solid var(--muted); }
.pomodoro-modes button { min-height: 36px; padding: 0 15px; border: 0; background: transparent; color: var(--neutral-muted); font: 600 12px var(--font); cursor: pointer; }
.pomodoro-modes button[aria-pressed="true"] { background: var(--white); color: var(--navy); }
.pomodoro-modes button:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.pomodoro-value { margin-top: 16px; }

.actuator-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.actuator-legend span { display: flex; align-items: center; gap: 9px; }
.sensor-dot { width: 10px; height: 10px; border: 1px solid var(--muted); background: transparent; }
.sensor-dot.active { border-color: var(--blue-light); background: var(--blue-light); }
.actuator-panel { min-height: 610px; padding: 36px; }
.actuator-readout { width: 100%; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; color: var(--neutral-muted); font-size: 12px; }
.actuator-readout strong { color: var(--white); font-weight: 600; font-variant-numeric: tabular-nums; }
.actuator-stage { position: relative; width: 100%; max-width: 680px; height: 374px; overflow: hidden; border-block: 1px solid var(--graphite); background-image: linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 28px 28px; }
.cylinder-shell { position: absolute; z-index: 2; left: 8%; top: 82px; width: 44%; height: 70px; border: 3px solid var(--line); background: var(--graphite); box-shadow: inset 0 0 0 5px var(--ink); }
.cylinder-shell::before, .cylinder-shell::after { content: ''; position: absolute; top: -10px; width: 8px; height: 84px; background: var(--neutral-muted); }
.cylinder-shell::before { left: -7px; }
.cylinder-shell::after { right: -7px; }
.cylinder-chamber { position: absolute; z-index: 0; top: 5px; bottom: 5px; transition: width .08s linear, left .08s linear, background .2s ease; }
.chamber-a { left: 5px; width: 5%; }
.chamber-b { right: 5px; width: 90%; }
.actuator-stage.valve-extend .chamber-a, .actuator-stage.valve-retract .chamber-b { background: rgba(75,134,180,.42); }
.actuator-stage.valve-extend .chamber-b, .actuator-stage.valve-retract .chamber-a { background: rgba(211,220,226,.12); }
.cylinder-port { position: absolute; z-index: 4; bottom: -28px; display: grid; place-items: center; width: 42px; height: 21px; border: 1px solid var(--muted); background: var(--ink); color: var(--line); font-size: 9px; font-weight: 700; }
.port-a { left: 7px; }
.port-b { right: 7px; }
.actuator-stage.valve-extend .port-a, .actuator-stage.valve-retract .port-b { border-color: var(--blue-light); color: var(--blue-muted); }
.actuator-stage.valve-extend .port-b, .actuator-stage.valve-retract .port-a { border-color: var(--line); color: var(--white); }
.piston-rod { position: absolute; z-index: 1; left: 10%; top: 112px; width: 42%; height: 10px; background: linear-gradient(var(--surface), var(--muted)); }
.cylinder-piston { position: absolute; z-index: 4; left: 10%; top: 88px; width: 22px; height: 58px; border: 3px solid var(--white); background: var(--muted); box-shadow: 0 0 0 2px var(--ink); transform: translateX(-50%); }
.cylinder-piston span { position: absolute; left: 50%; top: -25px; padding: 2px 5px; background: var(--ink); color: var(--white); font-size: 9px; font-style: normal; font-weight: 700; white-space: nowrap; transform: translateX(-50%); }
.rod-end { position: absolute; z-index: 3; left: 52%; top: 98px; width: 18px; height: 38px; border: 2px solid var(--surface); background: var(--muted); transform: translateX(-50%); }
.limit-sensor { position: absolute; z-index: 4; top: 18px; display: flex; flex-direction: column; align-items: center; color: var(--neutral-muted); font-size: 10px; font-weight: 700; transform: translateX(-50%); }
.limit-sensor::after { content: ''; width: 1px; height: 42px; margin-top: 4px; background: var(--muted); }
.limit-sensor i { position: absolute; top: 62px; width: 12px; height: 12px; border: 2px solid var(--muted); background: var(--ink); }
.sensor-s0 { left: 10%; }
.sensor-s1 { left: 48%; }
.limit-sensor.is-active { color: var(--blue-muted); }
.limit-sensor.is-active::after { background: var(--blue-light); }
.limit-sensor.is-active i { border-color: var(--blue-light); background: var(--blue-light); box-shadow: 0 0 12px rgba(75,134,180,.65); }
.air-line { position: absolute; z-index: 1; overflow: hidden; background: var(--muted); }
.air-line::after { content: ''; position: absolute; inset: 0; opacity: 0; background: repeating-linear-gradient(90deg, transparent 0 5px, var(--flow-color) 5px 12px, transparent 12px 18px); background-size: 18px 100%; animation: air-flow-horizontal .42s linear infinite; }
.air-a-vertical, .air-b-vertical { top: 180px; width: 4px; height: 43px; }
.air-a-vertical { left: 12%; }
.air-b-vertical { left: 48%; }
.air-a-horizontal, .air-b-horizontal { top: 220px; height: 4px; }
.air-a-horizontal { left: 12%; width: 21%; }
.air-b-horizontal { left: 48%; width: 14%; }
.air-a-vertical::after, .air-b-vertical::after, .air-p::after, .air-r::after, .air-s::after { background: repeating-linear-gradient(180deg, transparent 0 5px, var(--flow-color) 5px 12px, transparent 12px 18px); background-size: 100% 18px; animation-name: air-flow-vertical; }
.directional-valve { position: absolute; z-index: 3; left: 30%; top: 212px; width: 34%; height: 62px; display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--neutral-muted); background: var(--graphite); }
.valve-state { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-right: 1px solid var(--muted); color: var(--neutral-muted); font-size: 9px; font-weight: 700; transition: background .18s ease, color .18s ease; }
.valve-state:last-of-type { border-right: 0; }
.actuator-stage.valve-retract .valve-state-retract, .actuator-stage.valve-extend .valve-state-extend { background: rgba(47,111,159,.18); color: var(--blue-soft); }
.valve-port { position: absolute; z-index: 3; display: grid; place-items: center; width: 39px; height: 17px; background: var(--ink); color: var(--line); font-size: 8px; font-weight: 700; white-space: nowrap; }
.valve-a { left: 7%; top: -18px; }
.valve-b { right: 7%; top: -18px; }
.valve-r { left: 4%; bottom: -18px; }
.valve-p { left: 50%; bottom: -18px; transform: translateX(-50%); }
.valve-s { right: 4%; bottom: -18px; }
.air-p, .air-r, .air-s { top: 274px; width: 4px; height: 62px; }
.air-r { left: 34.5%; }
.air-p { left: 47%; }
.air-s { left: 59.5%; }
.actuator-stage.valve-extend .air-a, .actuator-stage.valve-retract .air-b, .actuator-stage .air-p { background: var(--blue); }
.actuator-stage.valve-extend .air-b, .actuator-stage.valve-retract .air-a, .actuator-stage.valve-extend .air-s, .actuator-stage.valve-retract .air-r { background: var(--muted); }
.actuator-stage.is-extending .air-a::after,
.actuator-stage.is-retracting .air-b::after,
.actuator-stage.is-moving .air-p::after { --flow-color: var(--blue-light); opacity: 1; animation-direction: reverse; }
.actuator-stage.is-extending .air-b::after,
.actuator-stage.is-retracting .air-a::after,
.actuator-stage.is-extending .air-s::after,
.actuator-stage.is-retracting .air-r::after { --flow-color: var(--line); opacity: .9; animation-direction: normal; }
.exhaust-symbol { position: absolute; top: 334px; display: flex; flex-direction: column; align-items: center; color: var(--neutral-muted); font-size: 8px; text-transform: uppercase; transform: translateX(-50%); }
.exhaust-symbol i { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid var(--muted); }
.exhaust-r { left: 34.5%; }
.exhaust-s { left: 59.5%; }
.air-source { position: absolute; left: 47%; top: 332px; min-width: 112px; height: 34px; padding: 4px 8px; border: 1px solid var(--blue-light); background: var(--blue-deep); color: var(--blue-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 8px; line-height: 1.2; transform: translateX(-50%); }
.air-source strong { font-size: 9px; }
.air-flow-key { width: 100%; display: flex; justify-content: center; gap: 24px; margin-top: 12px; color: var(--neutral-muted); font-size: 11px; }
.air-flow-key span { display: flex; align-items: center; gap: 7px; }
.air-flow-key i { width: 18px; height: 4px; }
.pressure-air { background: var(--blue-light); }
.exhaust-air { background: var(--line); }
@keyframes air-flow-horizontal { to { background-position: 18px 0; } }
@keyframes air-flow-vertical { to { background-position: 0 18px; } }
.actuator-actions { margin-top: 24px; }
.actuator-actions button:disabled { opacity: .4; cursor: not-allowed; }
.actuator-actions button[aria-pressed="true"] { outline: 2px solid var(--blue-light); outline-offset: 3px; }

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

@media (max-width: 600px) {
    .tools-hero { padding: 56px 0; }
    .counter-description, .counter-panel { padding: 30px 24px; }
    .counter-panel { min-height: 310px; }
    .pomodoro-panel { padding-top: 92px; }
    .pomodoro-modes { top: 28px; }
    .pomodoro-settings { grid-template-columns: 1fr; }
    .sound-setting { grid-column: auto; }
    .actuator-panel { min-height: 600px; padding: 28px 20px; }
    .actuator-readout { align-items: flex-start; flex-direction: column; gap: 4px; }
    .actuator-stage { height: 366px; }
    .directional-valve { left: 22%; width: 56%; }
    .air-a-horizontal { width: 16%; }
    .air-b-horizontal { width: 27%; }
    .air-r, .exhaust-r { left: 25%; }
    .air-p, .air-source { left: 50%; }
    .air-s, .exhaust-s { left: 75%; }
    .air-flow-key { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .air-line::after { animation: none; }
    .cylinder-chamber, .valve-state { transition: none; }
}
