/* 工具页样式：只作用于 /tools/*，不修改首页 styles.css */

  /* 关键：.drop / .row2 / .btn 都设置了 display，会盖掉 hidden 属性 */
  [hidden] { display: none !important; }

  .tool-wrap { max-width: 980px; }

  /* ── 页头 ── */
  .tool-head { padding: 60px 0 26px; text-align: center; }
  .tool-head .pill { margin-bottom: 20px; }
  .tool-head h1 {
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -.9px;
    line-height: 1.2;
    margin-bottom: 10px;
  }
  .tool-head p { color: var(--muted); font-size: 15.5px; max-width: 620px; margin: 0 auto; }

  /* ── 主体两栏 ── */
  .tool-body {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 8px;
  }
  /* 两栏子项都要允许收缩，否则长文件名会把轨道顶宽、列表压到右栏底下 */
  .tool-body > * { min-width: 0; }
  .tool-body > * > * { max-width: 100%; }
  @media (max-width: 820px) {
    .tool-body { grid-template-columns: 1fr; }
  }

  /* ── 拖拽上传区 ── */
  .drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 320px;
    padding: 30px;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: var(--card);
    cursor: pointer;
    transition: border-color .18s, background .18s;
    text-align: center;
  }
  .drop:hover, .drop.over { border-color: var(--accent); background: rgba(109,141,255,.07); }
  .drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .drop svg { width: 40px; height: 40px; color: var(--muted); }
  .drop strong { font-size: 15px; font-weight: 600; }
  .drop .sub { font-size: 13px; color: var(--muted); }

  /* 选好图后：变成图片预览 */
  .drop.hasimg {
    padding: 0;
    min-height: 0;
    border-style: solid;
    border-color: var(--card-border);
    overflow: hidden;
    background: var(--stage-bg);
  }
  .drop.hasimg > svg, .drop.hasimg > strong, .drop.hasimg > .sub { display: none; }
  .drop.hasimg img { display: block; width: 100%; max-height: 560px; object-fit: contain; }
  .drop.hasimg input[type=file] { inset: 0; }

  /* 裁剪：画布舞台 */
  .crop-stage {
    position: relative;
    display: block;
    width: 100%;
    line-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: var(--stage-bg);
    touch-action: none;
    user-select: none;
  }
  .crop-stage canvas { display: block; width: 100%; height: auto; }
  .crop-box {
    position: absolute;
    border: 1px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
    cursor: move;
  }
  .crop-box::before, .crop-box::after {
    content: "";
    position: absolute; inset: 0;
    border: 1px solid var(--line-strong);
    pointer-events: none;
  }
  .crop-box::before { left: 33.33%; right: 33.33%; border-top: 0; border-bottom: 0; }
  .crop-box::after { top: 33.33%; bottom: 33.33%; border-left: 0; border-right: 0; }
  .crop-h {
    position: absolute; width: 13px; height: 13px;
    background: #fff; border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,.5);
  }
  .crop-h[data-h="nw"] { left: -6px; top: -6px; cursor: nwse-resize; }
  .crop-h[data-h="ne"] { right: -6px; top: -6px; cursor: nesw-resize; }
  .crop-h[data-h="sw"] { left: -6px; bottom: -6px; cursor: nesw-resize; }
  .crop-h[data-h="se"] { right: -6px; bottom: -6px; cursor: nwse-resize; }

  /* ── 右侧控制卡 ── */
  .ctrl {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
  }
  .ctrl h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    margin-bottom: 16px;
  }
  .field { margin-bottom: 15px; }
  .field:last-child { margin-bottom: 0; }
  .field > label {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 6px;
  }

  .tool-input, .tool-select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    color: var(--text);
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
  }
  .tool-input:focus, .tool-select:focus { outline: none; border-color: var(--accent); }
  .tool-select { cursor: pointer; }
  .tool-select option { background: var(--option-bg); color: var(--text); }

  .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .with-unit { position: relative; }
  .with-unit .unit {
    position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--muted); pointer-events: none;
  }
  .with-unit .tool-input { padding-right: 40px; }

  /* 分段控件 */
  .seg {
    display: flex; gap: 4px;
    padding: 4px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
  }
  .seg button {
    flex: 1;
    padding: 7px 4px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--muted);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
  }
  .seg button:hover { color: var(--text); }
  .seg button[aria-pressed="true"] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 600;
  }

  input[type=range] {
    width: 100%;
    accent-color: var(--accent);
    height: 20px;
    cursor: pointer;
  }

  .hint { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 7px; }
  .hint.warn { color: var(--warn); }

  .btnrow { display: grid; gap: 9px; margin-top: 16px; }
  .btn-wide { width: 100%; justify-content: center; }
  .btn[disabled] { opacity: .45; pointer-events: none; }

  /* ── 结果区 ── */
  .result {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
  }
  .result[hidden] { display: none; }
  .kvline {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 8px 0;
    font-size: 13.5px;
    border-bottom: 1px dashed var(--line);
  }
  .kvline:last-child { border-bottom: 0; }
  .kvline .k { color: var(--muted); }
  .kvline .v { font-weight: 600; }
  .kvline .v.green { color: var(--green); }

  /* ── 上传要求 ── */
  .req { padding: 34px 0 4px; }
  .req h2, .tips h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
  }
  .req dl {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 9px 18px;
    font-size: 13.5px;
    color: var(--muted);
  }
  .req dt { color: var(--text); font-weight: 600; }
  @media (max-width: 560px) { .req dl { grid-template-columns: 76px 1fr; } }

  .tips { padding: 26px 0 60px; }
  .tips ul { list-style: none; display: grid; gap: 9px; font-size: 13.5px; color: var(--muted); }
  .tips li { padding-left: 16px; position: relative; }
  .tips li::before {
    content: ""; position: absolute; left: 0; top: 9px;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent); opacity: .8;
  }

  /* ── 工具索引页 ── */
  .tool-list {
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: var(--card);
    overflow: hidden;
    margin-bottom: 0;
  }
  .tool-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--line);
    transition: background .15s;
  }
  .tool-list a:last-child { border-bottom: 0; }
  .tool-list a:hover { background: rgba(109,141,255,.08); }
  .tool-list .no {
    width: 26px; flex-shrink: 0;
    font-size: 12px; color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .tool-list .name { font-size: 15px; font-weight: 600; }
  .tool-list .desc { font-size: 13px; color: var(--muted); margin-left: auto; text-align: right; }
  .tool-list .arrow { color: var(--muted); flex-shrink: 0; }
  @media (max-width: 640px) {
    .tool-list .desc { display: none; }
  }

  .foot-note {
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
    padding-bottom: 60px;
  }
  .foot-note a { color: var(--accent); text-decoration: none; }

  /* ── PDF 工具：多文件列表 ── */
  .filelist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    min-width: 0;
  }
  .filelist li {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    font-size: 13.5px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .filelist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filelist .pg { color: var(--muted); font-size: 12.5px; flex-shrink: 0; }
  .filelist button {
    width: 26px; height: 26px; flex-shrink: 0;
    border: 1px solid var(--card-border); border-radius: 7px;
    background: var(--input-bg); color: var(--muted);
    font-size: 13px; line-height: 1; cursor: pointer;
  }
  .filelist button:hover { color: var(--text); border-color: var(--line-strong); }
  .filelist button:disabled { opacity: .35; pointer-events: none; }

  /* ── 工具分组 ── */
  .tool-group { margin-bottom: 34px; scroll-margin-top: 84px; }
  .tool-group h2 {
    font-size: 13px; font-weight: 600; letter-spacing: .3px;
    color: var(--muted);
    margin: 0 0 10px 4px;
  }
  .tool-group:last-of-type { margin-bottom: 8px; }

  /* ── 处理完成提示：绿色成功条，浮在所有面板之上 ── */
  .toast {
    z-index: 90;
    background: #16a34a;
    color: #fff;
    border: 1px solid #12863d;
    box-shadow: 0 14px 34px rgba(22, 163, 74, .38), 0 2px 8px rgba(0, 0, 0, .12);
    padding: 12px 26px;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: .2px;
    width: max-content;
    max-width: min(560px, calc(100vw - 40px));
    border-radius: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
  }
  .toast::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }

  /* ── 在线白板与思维导图工作台 ── */
  body:has(#wbShell) .tool-wrap {
    max-width: 1240px;
  }
  body.wb-lock-scroll {
    overflow: hidden;
  }
  .wb-shell {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  }
  .wb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
  }
  .wb-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    min-width: 0;
  }
  .wb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
  }
  .wb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .wb-btn {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 9px;
    gap: 6px;
  }
  .wb-btn svg {
    width: 15px;
    height: 15px;
  }
  .wb-btn .ico-exit { display: none; }
  .wb-shell.is-fullscreen .wb-btn .ico-enter { display: none; }
  .wb-shell.is-fullscreen .wb-btn .ico-exit { display: inline-block; }
  .wb-stage {
    position: relative;
    width: 100%;
    height: clamp(580px, 76vh, 860px);
    background: var(--stage-bg);
  }
  .wb-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
  }
  .wb-shell.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: 0;
  }
  .wb-shell.is-fullscreen .wb-stage {
    flex: 1;
    height: auto;
  }
  @media (max-width: 640px) {
    .wb-meta span:last-child {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .wb-stage {
      height: 72vh;
    }
  }

  /* ── 五字母猜词 ── */
  body:has(#wordleShell) .tool-wrap {
    max-width: 1080px;
  }
  body.wordle-lock-scroll {
    overflow: hidden;
  }
  .wordle-stage {
    height: clamp(620px, 78vh, 900px);
    background: var(--stage-bg);
  }
  @media (max-width: 640px) {
    .wordle-stage {
      height: clamp(560px, 76vh, 760px);
    }
  }
