:root {
  --paper: #f3efe6;
  --ink: #172033;
  --muted: #5e6772;
  --line: #e3dbcf;
  --accent: #c2412d;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.top,
.kk-legacy-top {
  z-index: 60;
}

.app-more { display: none; position: relative; flex: none; }
.app-more summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  touch-action: manipulation;
}
.app-more summary::-webkit-details-marker { display: none; }
.app-more summary:focus-visible,
.kk-tabs a:focus-visible,
.app-sheet a:focus-visible {
  outline: 2px solid #1b3f73;
  outline-offset: 2px;
}
.kk-legacy-top .app-more summary {
  color: #f6f1e8;
  background: transparent;
  border-color: rgba(246, 241, 232, 0.4);
}
.app-sheet {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: min(260px, calc(100vw - 24px));
  padding: 6px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(23, 32, 51, 0.16);
}
.app-sheet a,
.kk-legacy-top .app-sheet a,
.top .app-sheet a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  color: #172033;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}
.app-sheet a:active { background: #f3efe6; }

.kk-tabs {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  margin: 0;
  gap: 2px;
  padding:
    4px
    calc(6px + env(safe-area-inset-right, 0px))
    calc(4px + env(safe-area-inset-bottom, 0px))
    calc(6px + env(safe-area-inset-left, 0px));
  background: rgba(243, 239, 230, 0.97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(23, 32, 51, 0.06);
  backdrop-filter: blur(12px);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
}
.kk-tabs a {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 500;
  touch-action: manipulation;
}
.kk-tabs svg { width: 22px; height: 22px; display: block; flex: none; }
.kk-tabs a[aria-current="page"] {
  color: var(--ink);
  background: #fff;
  font-weight: 650;
}
.kk-tabs a[data-tab="call"] { color: var(--accent); font-weight: 650; }
.kk-tabs a:active { background: rgba(255, 255, 255, 0.75); }

body.kk-typing .kk-tabs {
  transform: translateY(120%);
  pointer-events: none;
}

img, video, canvas { max-width: 100%; }
input, select, textarea {
  font-size: 16px !important;
  max-width: 100%;
}
p, li, h1, h2, h3, td, figcaption, .kk-geo, .kk-press, .kk-cite {
  overflow-wrap: anywhere;
}

@media (max-width: 800px), (hover: none) and (pointer: coarse) and (max-width: 1100px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.kk-typing {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .top,
  .kk-legacy-top {
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .top nav,
  .kk-legacy-top nav,
  .top .phone,
  .kk-legacy-top .phone { display: none; }
  .app-more { display: block; margin-left: auto; }
  .kk-tabs { display: flex; }
  .logo, .kk-legacy-top .brand { flex: none; }
  .kk-geo,
  .kk-press,
  .kk-cite,
  .kk-press-strip {
    max-width: none !important;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .kk-geo h1,
  .kk-press h1 {
    font-size: clamp(22px, 6.4vw, 30px) !important;
  }
  article.kk-geo { overflow-x: auto; }
  article.kk-geo table { min-width: 680px; }
}

@media (max-width: 800px) and (max-height: 520px), (hover: none) and (pointer: coarse) and (max-height: 520px) {
  .kk-tabs a {
    min-height: 44px;
    flex-direction: row;
    gap: 6px;
    font-size: 13px;
  }
  .kk-tabs svg { width: 18px; height: 18px; }
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 360px) {
  .kk-tabs a { font-size: 11px; }
  .logo, .kk-legacy-top .brand { font-size: 17px; }
}

@media print {
  .kk-tabs, .app-more { display: none !important; }
  body { padding-bottom: 0 !important; }
}
