.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(--navy); color: var(--white); }
.counter-label { color: #b8b9bc; 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: #e8e8e9; }
.counter-reset { border-color: #797b7f; 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 #c6cbd0; 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: #eceeef; color: #8c9298; 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 #626469; }
.pomodoro-modes button { min-height: 36px; padding: 0 15px; border: 0; background: transparent; color: #c7c8ca; 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 #8e9196; background: transparent; }
.sensor-dot.active { border-color: #57d795; background: #57d795; }
.actuator-panel { min-height: 610px; padding: 36px; }
.actuator-readout { width: 100%; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; color: #c7c8ca; 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 #4e5054; 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 #d8dadd; background: #2f3134; box-shadow: inset 0 0 0 5px #242528; }
.cylinder-shell::before, .cylinder-shell::after { content: ''; position: absolute; top: -10px; width: 8px; height: 84px; background: #c8cace; }
.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(89,189,233,.42); }
.actuator-stage.valve-extend .chamber-b, .actuator-stage.valve-retract .chamber-a { background: rgba(210,212,214,.12); }
.cylinder-port { position: absolute; z-index: 4; bottom: -28px; display: grid; place-items: center; width: 42px; height: 21px; border: 1px solid #777a7f; background: #282a2d; color: #c5c7ca; 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: #59bde9; color: #8ed5f4; }
.actuator-stage.valve-extend .port-b, .actuator-stage.valve-retract .port-a { border-color: #d2d4d6; color: #ffffff; }
.piston-rod { position: absolute; z-index: 1; left: 10%; top: 112px; width: 42%; height: 10px; background: linear-gradient(#e7e8e9, #9a9da1); }
.cylinder-piston { position: absolute; z-index: 4; left: 10%; top: 88px; width: 22px; height: 58px; border: 3px solid #ffffff; background: #717479; box-shadow: 0 0 0 2px #2a2b2e; transform: translateX(-50%); }
.cylinder-piston span { position: absolute; left: 50%; top: -25px; padding: 2px 5px; background: #202124; color: #ffffff; 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 #eceeef; background: #62656a; transform: translateX(-50%); }
.limit-sensor { position: absolute; z-index: 4; top: 18px; display: flex; flex-direction: column; align-items: center; color: #96999d; font-size: 10px; font-weight: 700; transform: translateX(-50%); }
.limit-sensor::after { content: ''; width: 1px; height: 42px; margin-top: 4px; background: #6a6d71; }
.limit-sensor i { position: absolute; top: 62px; width: 12px; height: 12px; border: 2px solid #85888d; background: #292a2d; }
.sensor-s0 { left: 10%; }
.sensor-s1 { left: 48%; }
.limit-sensor.is-active { color: #8ee7b8; }
.limit-sensor.is-active::after { background: #57d795; }
.limit-sensor.is-active i { border-color: #57d795; background: #57d795; box-shadow: 0 0 12px rgba(87,215,149,.65); }
.air-line { position: absolute; z-index: 1; overflow: hidden; background: #585b60; }
.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 #bfc2c6; background: #2c2e31; }
.valve-state { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-right: 1px solid #777a7f; color: #aeb0b4; 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(89,189,233,.18); color: #a7e2fb; }
.valve-port { position: absolute; z-index: 3; display: grid; place-items: center; width: 39px; height: 17px; background: #202124; color: #d2d4d6; 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: #397f9d; }
.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: #777a7f; }
.actuator-stage.is-extending .air-a::after,
.actuator-stage.is-retracting .air-b::after,
.actuator-stage.is-moving .air-p::after { --flow-color: #59bde9; 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: #d2d4d6; opacity: .9; animation-direction: normal; }
.exhaust-symbol { position: absolute; top: 334px; display: flex; flex-direction: column; align-items: center; color: #a5a7aa; 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 #8b8e92; }
.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 #59bde9; background: #253a43; color: #9fdcf5; 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: #b9bbbe; 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: #59bde9; }
.exhaust-air { background: #d2d4d6; }
@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 #57d795; 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; }
}
