* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #5aaea6;
    --primary-dark: #378d84;
    --primary-soft: #edf8f6;
    --ink: #17211f;
    --muted: #74807d;
    --bg: #f7faf8;
    --surface: #ffffff;
    --border: #e1e9e6;
    --danger: #c87578;
    --shadow: 0 14px 35px rgba(35, 62, 58, .07);
}

html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }

nav {
    display: flex;
    align-items: center;
    height: 66px;
    padding: 0 clamp(18px, 5vw, 64px);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.logo { color: var(--ink); font-size: 20px; font-weight: 760; letter-spacing: -.04em; text-decoration: none; }
.nav-back { display: inline-flex; align-items: center; gap: 8px; margin-left: 28px; color: var(--muted); font-size: 13px; text-decoration: none; transition: color .18s ease; }
.nav-back:hover { color: var(--primary-dark); }
.nav-right { display: none; }

.tool-hero {
    max-width: 860px;
    margin: 0 auto;
    padding: 66px 28px 40px;
    text-align: center;
}
.tool-icon-big {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    border: 1px solid #cfe6e1;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 22px;
}
.tool-hero h1 { margin-bottom: 12px; font-size: clamp(32px, 5vw, 48px); font-weight: 760; letter-spacing: -.06em; }
.tool-hero p { max-width: 570px; margin: 0 auto; color: var(--muted); font-size: 15px; line-height: 1.65; }

.tool-area { width: min(920px, 100%); margin: 0 auto; padding: 0 28px 72px; }
.drop-zone {
    padding: 68px 30px;
    border: 1px dashed #b9d4cf;
    border-radius: 18px;
    background: var(--surface);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: #fbfffe; box-shadow: var(--shadow); }
.drop-zone-icon { margin-bottom: 17px; color: var(--primary-dark); font-size: 32px; }
.drop-zone h3 { margin-bottom: 8px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.drop-zone p { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.btn-select, .btn-compress, .btn-download, .btn-again, .btn-remove { cursor: pointer; font-family: inherit; }
.btn-select { padding: 11px 20px; border: 1px solid var(--primary-dark); border-radius: 9px; background: var(--primary-dark); color: #fff; font-size: 13px; font-weight: 650; transition: background .18s ease; }
.btn-select:hover { background: #2f7f77; }
#fileInput { display: none; }

.file-preview, .result-area { display: none; padding: 26px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 14px rgba(35,62,58,.035); }
.file-preview.visible, .result-area.visible { display: block; }
.file-info { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.file-type-icon { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 46px; border-radius: 11px; background: #fcf1f1; color: var(--danger); font-size: 21px; }
.file-details { min-width: 0; flex: 1; }
.file-name { overflow: hidden; margin-bottom: 3px; font-size: 15px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 12px; }
.btn-remove { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--muted); }
.btn-remove:hover { border-color: var(--danger); color: var(--danger); background: #fff8f8; }

.options-title { margin-bottom: 12px; font-size: 14px; font-weight: 700; }
.compression-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 24px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: #f1f6f4; }
.compression-option { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 10px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-family: inherit; transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.compression-option-name { font-size: 12px; font-weight: 700; line-height: 1.1; }
.compression-option small { font-size: 10px; line-height: 1.15; }
.compression-option:hover { color: var(--ink); background: rgba(255,255,255,.75); }
.compression-option.is-selected { border-color: #b7d8d2; background: var(--surface); color: var(--primary-dark); box-shadow: 0 2px 7px rgba(35,62,58,.08); }
.compression-option:focus-visible { outline: 3px solid rgba(90,174,166,.28); outline-offset: 2px; }

.btn-compress { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 14px; border: 0; border-radius: 10px; background: var(--primary-dark); color: #fff; font-size: 14px; font-weight: 700; transition: background .18s ease, opacity .18s ease; }
.btn-compress:hover { background: #2f7f77; }
.btn-compress:disabled { opacity: .55; cursor: not-allowed; }
.privacy-note { margin-top: 15px; color: var(--muted); font-size: 12px; text-align: center; }

.progress-area { display: none; margin-bottom: 20px; }
.progress-area.visible { display: block; }
.progress-bar-wrap { height: 6px; margin-bottom: 8px; overflow: hidden; border-radius: 4px; background: #e8efed; }
.progress-bar { width: 0; height: 100%; border-radius: 4px; background: var(--primary); transition: width .3s ease; }
.progress-label { color: var(--muted); font-size: 12px; text-align: center; }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-box { padding: 14px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); text-align: center; }
.stat-box-label { margin-bottom: 5px; color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.stat-box-value { font-size: 21px; font-weight: 760; }
.stat-box-value.green { color: var(--primary-dark); }
.result-actions { display: flex; gap: 10px; }
.btn-download { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
.btn-download:hover { background: #293936; }
.btn-again { padding: 13px 17px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; }
.btn-again:hover { background: var(--bg); }

.how-section { width: min(920px, 100%); margin: 0 auto; padding: 0 28px 76px; }
.how-section h2 { margin-bottom: 20px; font-size: 21px; font-weight: 750; letter-spacing: -.03em; text-align: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { padding: 20px 16px; border-top: 2px solid #cfe6e1; background: transparent; text-align: center; }
.step-num { width: 28px; height: 28px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 760; }
.step-title { margin-bottom: 5px; font-size: 13px; font-weight: 700; }
.step-desc { color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 680px) {
    nav { height: 60px; padding: 0 16px; }
    .nav-back { margin-left: 16px; }
    .tool-hero { padding: 48px 20px 32px; }
    .tool-hero h1 { font-size: 34px; }
    .tool-area, .how-section { padding-right: 16px; padding-left: 16px; }
    .drop-zone { padding: 48px 20px; }
    .compression-levels, .steps { grid-template-columns: 1fr; }
    .compression-levels { gap: 5px; }
    .compression-option { flex-direction: row; justify-content: space-between; padding: 10px 12px; text-align: left; }
    .compression-option small { text-align: right; }
    .result-stats { gap: 7px; }
    .stat-box { padding: 12px 5px; }
    .result-actions { flex-direction: column; }
    .btn-again { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
