/* ============================================================
   哼哼 · 练声工具列表页  —  暖阳 · 文房 (warm literary craft)
   仅由 tools.html 引用，覆盖 multipage.css 的相应样式
   字体：霞鹜文楷 (中文) + Fraunces (拉丁/序号) + PingFang (小字)
   ============================================================ */

:root {
  --font-han: "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;
  --font-display: "Fraunces", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "Noto Serif SC", ui-serif, "Songti SC", "Source Han Serif SC", serif;
  --ink-soft: color-mix(in srgb, var(--ink) 84%, transparent);
}

/* ---------- 页面基底 + 氛围 ---------- */
body[data-page="tools"] {
  background: var(--bg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.home-atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.atmos-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
}

.atmos-glow--a {
  top: -18vh;
  left: -10vw;
  width: 70vw;
  max-width: 540px;
  height: 70vw;
  max-height: 540px;
  background: radial-gradient(circle, rgba(233, 173, 84, 0.55), transparent 70%);
  opacity: 0.6;
}

.atmos-glow--b {
  top: 34vh;
  right: -22vw;
  width: 64vw;
  max-width: 500px;
  height: 64vw;
  max-height: 500px;
  background: radial-gradient(circle, rgba(214, 119, 91, 0.32), transparent 70%);
  opacity: 0.55;
}

.atmos-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.05;
  mix-blend-mode: multiply;
}

/* ---------- 容器：居中的"手机栏"，修掉桌面拉伸 ---------- */
.tools-home-shell {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 5vw, 32px) clamp(18px, 5vw, 24px) 124px;
}

/* ---------- 品牌头部 + Logo ---------- */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 0;
}

.home-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.logo-mark {
  display: block;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 6px 13px rgba(176, 84, 47, 0.24));
}

.logo-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-name {
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.logo-sub {
  margin-top: 6px;
  padding-left: 0.12em;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.44em;
  color: var(--faint);
}

.audio-practice-hint {
  display: inline-flex;
  max-width: 246px;
  align-items: flex-start;
  gap: 7px;
  margin-top: 4px;
  border: 1px solid color-mix(in srgb, var(--brass) 24%, transparent);
  border-radius: 8px;
  padding: 7px 10px 7px 9px;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
  background: rgba(255, 253, 248, 0.54);
  box-shadow: 0 8px 20px rgba(139, 93, 47, 0.08);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 520;
  line-height: 1.32;
  backdrop-filter: blur(10px);
}

.audio-practice-hint::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brass) 76%, var(--panel));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 12%, transparent);
}

.audio-practice-hint-text,
.audio-practice-hint-line {
  display: block;
}

.audio-practice-hint-line {
  white-space: nowrap;
}

/* ---------- 分区标题 ---------- */
.tool-section {
  margin-top: clamp(24px, 6vw, 32px);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px;
}

.section-kicker {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--brass);
}

.section-title {
  margin: 0;
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.section-rule {
  flex: 1;
  height: 1px;
  margin-left: 4px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

/* ---------- 卡片网格 ---------- */
.tools-home-shell .tool-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tools-home-shell .tool-card {
  --accent: var(--brass);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 152px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 9%, var(--panel)),
    var(--panel) 62%
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 10px 26px rgba(120, 92, 64, 0.1);
  transition:
    transform 0.34s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.34s ease,
    box-shadow 0.34s ease;
}

/* 顶部柔光晕 */
.tools-home-shell .tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(
    130% 78% at 16% 0%,
    color-mix(in srgb, var(--accent) 17%, transparent),
    transparent 58%
  );
}

.tools-home-shell .tool-card > * {
  position: relative;
  z-index: 1;
}

.tools-home-shell .tool-card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 20px 44px color-mix(in srgb, var(--accent) 18%, rgba(80, 60, 40, 0.12));
}

/* 徽章图标 */
.card-medallion {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: auto; /* 把文字推到底部 */
  border-radius: 15px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  background: radial-gradient(
    120% 120% at 30% 22%,
    color-mix(in srgb, var(--accent) 24%, #fff),
    color-mix(in srgb, var(--accent) 8%, var(--panel))
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 6px 14px color-mix(in srgb, var(--accent) 20%, transparent);
}

.card-medallion svg {
  width: 25px;
  height: 25px;
  display: block;
}

.card-text {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.tools-home-shell .tool-name {
  font-family: var(--font-han);
  font-weight: 700;
  font-size: 18.5px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.tools-home-shell .tool-desc {
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* 跨两列的特征卡（练声挑战最后一张横向铺开，避免落单留空） */
.tools-home-shell .tool-card--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  min-height: 0;
  padding: 16px 18px;
}

.tool-card--wide .card-medallion {
  margin-bottom: 0;
  margin-right: 16px;
}

.tool-card--wide .card-text {
  flex: 1;
  margin-top: 0;
}

/* 每个工具的强调色 */
.tool-card[data-accent="brass"] { --accent: #cf842a; }
.tool-card[data-accent="rust"]  { --accent: #cf6a4f; }
.tool-card[data-accent="gold"]  { --accent: #c2941f; }
.tool-card[data-accent="coral"] { --accent: #d2745a; }
.tool-card[data-accent="green"] { --accent: #6f9568; }
.tool-card[data-accent="lake"]  { --accent: #5f918f; }
.tool-card[data-accent="rose"]  { --accent: #b96a7d; }

/* ---------- 游客声型弹窗 ---------- */
.guest-profile-dialog[hidden] {
  display: none;
}

.guest-profile-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
}

.guest-profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 25, 15, 0.34);
  backdrop-filter: blur(8px);
}

.guest-profile-panel {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  border: 1px solid color-mix(in srgb, var(--brass) 28%, var(--line));
  border-radius: 18px;
  padding: 24px;
  background: color-mix(in srgb, var(--panel) 94%, #fff);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.72) inset,
    0 22px 54px rgba(63, 43, 24, 0.24);
}

.guest-profile-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--brass) 18%, var(--line));
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.7);
  font-size: 20px;
  line-height: 1;
}

.guest-profile-kicker {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  color: var(--brass);
}

.guest-profile-panel h2 {
  margin: 0 34px 18px 0;
  font-family: var(--font-han);
  font-size: 24px;
  line-height: 1.25;
  color: var(--ink);
}

.guest-profile-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.guest-profile-field label,
.guest-profile-label {
  font-family: var(--font-han);
  font-weight: 700;
  color: var(--ink-soft);
}

.guest-profile-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid color-mix(in srgb, var(--brass) 24%, var(--line));
  border-radius: 10px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.78);
  font: 600 16px/1.2 var(--font-sans);
  outline: none;
}

.guest-profile-field input:focus {
  border-color: color-mix(in srgb, var(--brass) 62%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 18%, transparent);
}

.guest-profile-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.guest-profile-chip {
  min-height: 40px;
  border: 1px solid color-mix(in srgb, var(--brass) 20%, var(--line));
  border-radius: 10px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.58);
  font: 700 14px/1.2 var(--font-han);
}

.guest-profile-chip.is-active {
  color: #fff;
  border-color: color-mix(in srgb, var(--brass) 80%, var(--line));
  background: linear-gradient(135deg, #d99533, #b9632a);
  box-shadow: 0 8px 18px rgba(185, 99, 42, 0.24);
}

.guest-profile-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #b1542f;
  font-size: 12px;
  line-height: 1.45;
}

.guest-profile-submit {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #d99533, #b1542f);
  font: 800 15px/1 var(--font-han);
  box-shadow: 0 12px 26px rgba(177, 84, 47, 0.24);
}

.guest-profile-submit:disabled {
  opacity: 0.45;
  box-shadow: none;
}

body.guest-profile-open {
  overflow: hidden;
}

/* ---------- 底部导航微调（暖化 multipage 的重阴影） ---------- */
.bottom-tabs {
  border-color: color-mix(in srgb, var(--brass) 22%, var(--line-strong));
  background: rgba(250, 244, 232, 0.86);
  box-shadow: 0 14px 36px rgba(120, 80, 40, 0.22);
}

.bottom-tabs a {
  font-family: var(--font-han);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.bottom-tabs a.is-active {
  color: #fff;
  background: linear-gradient(135deg, #e0a23e, #c9742a);
  box-shadow: 0 6px 16px rgba(201, 116, 42, 0.4);
}

/* ---------- 进场动画初始态（仅 JS 接管且允许动效时隐藏） ---------- */
.js-anim .reveal {
  opacity: 0;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .js-anim .reveal {
    opacity: 1;
  }
}

@media (max-width: 420px) {
  .home-header {
    gap: 8px;
  }

  .home-logo {
    gap: 8px;
  }

  .logo-mark {
    width: 40px;
    height: 40px;
  }

  .logo-name {
    font-size: 23px;
  }

  .logo-sub {
    font-size: 8.5px;
    letter-spacing: 0.25em;
  }

  .audio-practice-hint {
    max-width: 206px;
    padding: 6px 8px 6px 7px;
    font-size: 9.5px;
    line-height: 1.28;
  }
}

/* ---------- 小屏微调 ---------- */
@media (max-width: 360px) {
  .tools-home-shell .tool-card {
    min-height: 142px;
    padding: 14px 13px 12px;
  }

  .home-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .home-logo {
    gap: 9px;
  }

  .logo-mark {
    width: 42px;
    height: 42px;
  }

  .logo-name {
    font-size: 23px;
  }

  .logo-sub {
    font-size: 9px;
    letter-spacing: 0.28em;
    white-space: nowrap;
  }

  .audio-practice-hint {
    max-width: 206px;
    margin-top: 0;
    margin-left: auto;
  }

  .guest-profile-dialog {
    padding: 14px;
  }

  .guest-profile-panel {
    padding: 21px 16px 18px;
    border-radius: 16px;
  }

  .guest-profile-panel h2 {
    font-size: 22px;
  }

  .guest-profile-chips {
    gap: 8px;
  }
}
