:root {
    color-scheme: light;
    --hero-img:    url("hero.png");
    --page:        #f7f8fa;
    --surface:     #ffffff;
    --ink:         #0b0b0b;
    --ink-2:       #52514e;
    --muted:       #898781;
    --hairline:    #e6e5df;
    --grid:        #eeede8;
    --accent:      #2a78d6;
    --accent-soft: #eaf2fc;
    --aqua:        #1baf7a;
    --violet:      #4a3aa7;
    --red:         #e34948;
    --yellow:      #eda100;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(11,11,11,.04), 0 4px 16px rgba(11,11,11,.05);
  }
  * { margin:0; padding:0; box-sizing:border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    background: var(--page);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
    font-size: 14px; line-height: 1.6;
  }
  a { color: inherit; text-decoration: none; }

  .wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px 80px; }

  header.site { padding: 24px 0 0; }
  .hero {
    position: relative; overflow: hidden;
    border-radius: 20px; border: 1px solid var(--hairline);
    background: linear-gradient(105deg, #ffffff 0%, #f2f7fd 55%, #e8f4f1 100%);
    box-shadow: var(--shadow);
    padding: 46px 44px 40px;
  }
  .hero::before {
    content: ""; position: absolute; inset: 0;
    background-image: var(--hero-img);
    background-size: cover; background-position: center right;
    opacity: .9;
  }
  .hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.88) 42%, rgba(255,255,255,.30) 75%, rgba(255,255,255,.05) 100%);
  }
  .hero > * { position: relative; z-index: 1; }
  .eyebrow {
    font-size: 12px; font-weight: 700; letter-spacing: .14em;
    color: var(--accent); text-transform: uppercase;
  }
  h1 { font-size: 30px; font-weight: 800; letter-spacing: .01em; margin-top: 6px; }
  .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 8px; max-width: 640px; }
  @media (max-width: 720px) {
    .hero { padding: 28px 22px 24px; }
    .hero::after { background: linear-gradient(90deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.85) 60%, rgba(255,255,255,.55) 100%); }
  }
  .sync-row { display:flex; align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap; }
  .sync-badge {
    display:inline-flex; align-items:center; gap:6px;
    font-size: 12px; color: var(--ink-2);
    background: var(--surface); border: 1px solid var(--hairline);
    border-radius: 999px; padding: 4px 12px;
  }
  .sync-dot { width:7px; height:7px; border-radius:50%; background: var(--aqua); }
  .sync-dot.offline { background: var(--yellow); }
  .sync-btn {
    font-size: 12px; font-weight:600; color: var(--accent);
    background: var(--accent-soft); border:none; border-radius: 999px;
    padding: 5px 14px; cursor: pointer; font-family: inherit;
  }
  .sync-btn:hover { filter: brightness(.97); }
  .sheet-link { font-size:12px; color: var(--muted); }
  .sheet-link:hover { color: var(--accent); }

  nav.tabs {
    display: flex; gap: 6px; margin: 26px 0 18px; flex-wrap: wrap;
    border-bottom: 1px solid var(--hairline);
  }
  .tab {
    font-size: 14px; font-weight: 600; color: var(--ink-2);
    padding: 9px 16px 11px; cursor: pointer; border: none; background: none;
    border-bottom: 2.5px solid transparent; margin-bottom: -1px;
    font-family: inherit; white-space: nowrap;
  }
  .tab:hover { color: var(--ink); }
  .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

  .controls { display: flex; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; align-items: center; }
  .seg {
    display: inline-flex; background: var(--surface); border: 1px solid var(--hairline);
    border-radius: 10px; overflow: hidden;
  }
  .seg button {
    font-size: 13px; font-weight: 600; padding: 7px 16px; border: none;
    background: none; color: var(--ink-2); cursor: pointer; font-family: inherit;
  }
  .seg button.on { background: var(--accent); color: #fff; }
  select, input[type="search"] {
    font-size: 13px; font-family: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--hairline);
    border-radius: 10px; padding: 7px 12px; outline: none;
  }
  select { max-width: 230px; text-overflow: ellipsis; }
  input[type="search"] { min-width: 180px; flex: 1 1 180px; max-width: 320px; }
  input[type="search"]:focus, select:focus { border-color: var(--accent); }

  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
  .tile {
    background: var(--surface); border: 1px solid var(--hairline);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  }
  .tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
  .tile .v { font-size: 24px; font-weight: 700; margin-top: 2px; letter-spacing:.01em; }
  .tile .v .unit { font-size: 14px; font-weight: 600; }
  .tile .d { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

  .card {
    background: var(--surface); border: 1px solid var(--hairline);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  }
  .card + .card { margin-top: 18px; }
  .card h2 { font-size: 15px; font-weight: 700; padding: 16px 20px 0; }
  .card .note { font-size: 12px; color: var(--muted); padding: 2px 20px 0; }
  .legend-aqua { color: var(--aqua); }

  table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .table-scroll { overflow-x: auto; }
  thead th {
    text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600;
    padding: 14px 12px 10px; border-bottom: 1px solid var(--hairline);
    white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1;
  }
  thead th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
  tbody td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: #fafbfd; }

  td.rank { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; width: 40px; }
  .medal {
    display: inline-flex; width: 28px; height: 28px; border-radius: 50%;
    align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 13px;
    box-shadow: 0 1px 3px rgba(11,11,11,.25);
  }
  .medal.m1 { background: linear-gradient(150deg, #f9d976, #d99a06); }
  .medal.m2 { background: linear-gradient(150deg, #d7dde4, #97a2ae); }
  .medal.m3 { background: linear-gradient(150deg, #e3a878, #ad6a35); }
  tr.podium td { background: #fffdf6; }
  tr.podium .vtitle { font-size: 14.5px; }
  .thumb {
    width: 104px; height: 58px; object-fit: cover; border-radius: 8px;
    background: var(--grid); display: block;
  }
  .thumb.s { width: 58px; height: 74px; }
  .vtitle { font-weight: 600; line-height: 1.45; max-width: 460px; }
  .vtitle a:hover { color: var(--accent); }
  .vmeta { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 400; }
  .chip {
    display: inline-block; font-size: 11px; font-weight: 600;
    border-radius: 999px; padding: 2px 10px; white-space: nowrap;
  }
  .chip.c1 { background: #eaf2fc; color: #1c5cab; }
  .chip.c2 { background: #e7f6ef; color: #0e7a52; }
  .chip.c3 { background: #f1eefc; color: #4a3aa7; }
  .chip.c4 { background: #fdeeee; color: #b03030; }
  .chip.c6 { background: #fdf3e7; color: #a35f14; }
  .chip.c0 { background: #f2f1ec; color: #52514e; }
  .views { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .subtle { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
  .ch-link:hover { color: var(--accent); text-decoration: underline; }
  .wrapcell { white-space: normal; font-size: 11.5px; }

  .bars { padding: 8px 20px 20px; }
  .bar-row { display: grid; grid-template-columns: 220px 1fr 60px; gap: 10px; align-items: center; padding: 4px 0; }
  .bar-label { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
  .bar-track { height: 18px; display: flex; align-items: center; }
  .bar-fill { height: 14px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
  .bar-fill.alt { background: var(--aqua); margin-left: 2px; }
  .bar-val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

  tr.group td {
    background: #f4f6f9; font-size: 12px; font-weight: 700; color: var(--ink-2);
    padding: 8px 12px; border-bottom: 1px solid var(--hairline);
  }
  .bar-label a:hover { color: var(--accent); text-decoration: underline; }
  .ch-name { font-weight: 600; }
  .ch-handle { font-size: 11.5px; color: var(--muted); }
  .empty { padding: 40px; text-align: center; color: var(--muted); }
  footer { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
  footer a { color: var(--accent); }

  @media (max-width: 720px) {
    h1 { font-size: 20px; }
    .vtitle { max-width: 52vw; }
    .thumb { width: 76px; height: 43px; }
    .bar-row { grid-template-columns: 130px 1fr 48px; }
    .hide-m { display: none; }
  }

/* ---- 言語スイッチャー（JP/EN/ES 共通） ---- */
.langswitch {
  position: absolute; top: 18px; right: 20px; z-index: 3;
  display: inline-flex; gap: 2px; padding: 3px;
  background: rgba(255,255,255,.82); border: 1px solid var(--hairline);
  border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.langswitch a {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-2); padding: 5px 12px; border-radius: 999px;
  line-height: 1; display: inline-flex; align-items: center;
}
.langswitch a:hover { color: var(--ink); background: var(--accent-soft); }
.langswitch a.on { background: var(--accent); color: #fff; }
@media (max-width: 720px) {
  .langswitch { top: 10px; right: 10px; }
  .langswitch a { padding: 5px 9px; font-size: 11px; }
  .hero { padding-top: 46px; }
}

/* ---- 原題ツールチップ（日本語訳タイトルにカーソルを乗せたとき） ---- */
.vtitle a.has-orig { cursor: pointer; }
.origtip {
  position: fixed; top: 0; left: 0; z-index: 90;
  max-width: min(460px, 82vw);
  background: #1c1b19; color: #fff;
  font-size: 12.5px; line-height: 1.5; font-weight: 500;
  padding: 8px 12px; border-radius: 9px;
  box-shadow: 0 6px 24px rgba(11,11,11,.28);
  pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .09s ease;
  white-space: normal; overflow-wrap: anywhere;
}
.origtip.on { opacity: 1; visibility: visible; }
/* タッチ環境ではホバーが無いので出さない */
@media (hover: none) { .origtip { display: none; } }

/* 日本語タイトルは任意の文字で折り返せるため min-content 幅が極端に小さくなり、
   列がつぶれてしまう。英語版と違って明示的に下限幅を与える必要がある。 */
.vtitle { min-width: 260px; }
@media (max-width: 720px) {
  .vtitle { min-width: 150px; max-width: 52vw; }
}
