/* =============================================
   FAREAST CUP — Shared Stylesheet
   fedcup/ subpages
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #e8e4dd;
  font-family: 'Noto Serif JP','Yu Mincho','游明朝','YuMincho','Hiragino Mincho Pro',serif;
  font-weight: 400;
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.7;
}
a { color: #1a5fa0; text-decoration: none; }
a:hover { color: #c0392b; }
img { border: none; display: block; }

/* ===== SITE WRAPPER ===== */
.site {
  width: 966px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 48px rgba(0,0,0,0.16);
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid #e8e0d5;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 24px;
}
.navbar-logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  margin-right: 32px;
  flex-shrink: 0;
}
.logo-far  { font-family: Georgia,'Times New Roman',serif; font-style:italic; font-size:26px; font-weight:bold; color:#c0392b; line-height:1; }
.logo-east { font-family: Georgia,'Times New Roman',serif; font-style:italic; font-size:26px; font-weight:bold; color:#1a1a1a; line-height:1; }
.logo-cup  { font-family:'Arial Black',Arial,sans-serif; font-size:13px; font-weight:900; color:#777; letter-spacing:3px; line-height:1; }
.nav-items { display:flex; list-style:none; height:58px; }
.nav-items li a {
  display:flex; align-items:center; height:58px; padding:0 18px;
  font-size:12px; font-weight:600; color:#555; letter-spacing:0.5px;
  border-bottom:3px solid transparent; transition:color 0.15s,border-color 0.15s;
}
.nav-items li a:hover { color:#c0392b; border-bottom-color:#c0392b; }
.navbar-right { margin-left:auto; font-size:10px; color:#aaa; text-align:right; line-height:1.7; flex-shrink:0; }
.navbar-right strong { color:#555; font-size:11px; display:block; }

/* ===== RED STRIPE ===== */
.stripe { height:4px; background:linear-gradient(90deg,#c0392b 0%,#e74c3c 40%,#f39c12 80%,#f9ca24 100%); }

/* ===== BODY LAYOUT (with sidebar) ===== */
.body-layout { display:flex; align-items:flex-start; }
.sidebar { width:188px; flex-shrink:0; border-right:1px solid #ede7df; min-height:600px; }
.side-head { background:#1a1a1a; color:#fff; font-size:9px; font-weight:700; letter-spacing:3px; text-align:center; padding:13px 0; }
.side-group { background:#c0392b; color:#fff; font-size:9px; font-weight:700; letter-spacing:2px; text-align:center; padding:6px 0; margin-top:1px; text-transform:uppercase; }
.side-link { display:block; padding:10px 10px 10px 20px; font-size:11px; color:#444; background:#fff; border-bottom:1px solid #f2ede8; position:relative; transition:all 0.1s; text-decoration:none; }
.side-link::before { content:'›'; position:absolute; left:9px; color:#c0392b; font-size:15px; line-height:1.4; }
.side-link:hover { background:#fdf5f4; color:#c0392b; padding-left:24px; }
.main-col { flex:1; padding:28px 28px 48px; min-width:0; }

/* ===== FULL-WIDTH MAIN (no sidebar, for result pages) ===== */
.main-full { padding:28px 32px 48px; }

/* ===== SECTION TITLE ===== */
.sec-title {
  font-size:10px; font-weight:700; color:#c0392b; letter-spacing:4px;
  text-transform:uppercase; border-bottom:2px solid #c0392b;
  padding-bottom:8px; margin-bottom:16px;
  display:flex; align-items:center; gap:8px;
}
.sec-title::before { content:''; width:8px; height:8px; background:#c0392b; border-radius:50%; flex-shrink:0; }

/* ===== YEAR LINK LIST ===== */
.year-list { list-style:none; border:1px solid #ede7df; border-radius:6px; overflow:hidden; }
.year-list li { border-bottom:1px solid #f2ede8; }
.year-list li:last-child { border-bottom:none; }
.year-list li a {
  display:flex; align-items:center; padding:10px 16px 10px 30px;
  font-size:12px; color:#444; position:relative; transition:background 0.1s; text-decoration:none;
}
.year-list li a::before { content:'›'; position:absolute; left:14px; color:#c0392b; font-size:15px; line-height:1.4; }
.year-list li a:hover { background:#fdf5f4; color:#c0392b; }

/* ===== ENTRY FRAME ===== */
.entry-header-bar {
  display:flex; align-items:center; gap:10px; background:#1a1a1a; color:#fff;
  padding:10px 16px; border-radius:6px 6px 0 0; font-size:11px; font-weight:700; letter-spacing:1.5px;
}
.entry-dot { width:8px; height:8px; background:#c0392b; border-radius:50%; flex-shrink:0; }
.entry-frame { border:1px solid #ddd; border-top:none; border-radius:0 0 6px 6px; overflow:hidden; }
.entry-frame iframe { display:block; background:#fff; }

/* ===== VENUE PAGE ===== */
.venue-title { font-size:20px; font-weight:bold; color:#1a1a1a; margin-bottom:6px; padding-bottom:10px; border-bottom:2px solid #c0392b; }
.venue-addr { font-size:12px; color:#666; margin:12px 0 16px; }
.map-wrap { border:1px solid #ddd; border-radius:8px; overflow:hidden; margin-top:8px; }
.map-wrap iframe { display:block; width:100%; height:500px; border:none; }

/* ===== RESULT PAGES ===== */

/* Back link */
.res-back {
  display:inline-flex; align-items:center; gap:6px; font-size:11px; color:#777;
  margin-bottom:24px; padding:8px 16px; border:1px solid #ddd; border-radius:20px;
  transition:all 0.2s; text-decoration:none; background:#f9f6f2;
}
.res-back:hover { background:#fdf5f4; color:#c0392b; border-color:#c0392b; padding-left:20px; }

/* Page title */
.main-full > h2 {
  font-size:18px; font-weight:800; color:#1a1a1a;
  padding:0 0 14px; border-bottom:3px solid #c0392b; margin-bottom:28px;
  letter-spacing:0.5px;
}

/* Suppress <br> between tables */
.main-full > br { display:none; }

/* =====================================================
   RESULT TABLE — staggered fade-in
   ===================================================== */
@keyframes fadeSlideUp {
  from { opacity:0; transform:translateY(18px); }
  to   { opacity:1; transform:translateY(0); }
}
.main-full > table {
  width:100% !important;
  table-layout:fixed;
  border-collapse:collapse;
  border:none !important;
  margin-bottom:44px;
  border-radius:12px;
  overflow:hidden;
  box-shadow:0 6px 28px rgba(0,0,0,0.11);
  animation:fadeSlideUp 0.5s ease both;
}
.main-full > table:nth-of-type(1) { animation-delay:0.05s; }
.main-full > table:nth-of-type(2) { animation-delay:0.18s; }
.main-full > table:nth-of-type(3) { animation-delay:0.31s; }
.main-full > table:nth-of-type(4) { animation-delay:0.44s; }

/* ── Row 1: Category header ─────────────────── */
/* Class-based only — no :first-child fallback (bleeds into nested tables) */
tr.res-cat-row > td {
  background: linear-gradient(90deg, #111 0%, #2a2a2a 100%) !important;
  color:#fff !important;
  padding:16px 22px !important;
  border:none !important;
  font-size:13px;
  font-weight:700;
  letter-spacing:5px;
  text-transform:uppercase;
}
tr.res-cat-row .style1, tr.res-cat-row span {
  color:#f9ca24 !important;
  font-weight:800;
}

/* ── Row 2: Photo cells ─────────────────────── */
tr.res-photo-row > td,
.main-full > table tr:nth-child(2) td {
  padding:0 !important;
  border:none !important;
  border-right:3px solid #fff !important;
  height:auto !important;
  overflow:hidden;
  position:relative;
}
tr.res-photo-row > td:last-child,
.main-full > table tr:nth-child(2) td:last-child { border-right:none !important; }

/* Gold / Silver / Bronze top accent bar */
tr.res-photo-row > td:nth-child(1),
.main-full > table tr:nth-child(2) td:nth-child(1) { border-top:6px solid #f9ca24 !important; }
tr.res-photo-row > td:nth-child(2),
.main-full > table tr:nth-child(2) td:nth-child(2) { border-top:6px solid #b8b8b8 !important; }
tr.res-photo-row > td:nth-child(3),
.main-full > table tr:nth-child(2) td:nth-child(3) { border-top:6px solid #cd7f32 !important; }

/* Zoom on hover */
tr.res-photo-row td > div,
.main-full > table tr:nth-child(2) td > div { line-height:0; overflow:hidden; }
tr.res-photo-row td img,
.main-full > table tr:nth-child(2) td img {
  width:100% !important;
  height:auto !important;
  display:block !important;
  transition:transform 0.4s ease, filter 0.4s ease;
}
tr.res-photo-row td a:hover img,
.main-full > table tr:nth-child(2) td a:hover img {
  transform:scale(1.08);
  filter:brightness(1.06) saturate(1.1);
}

/* ── Row 3: Ranking cells ───────────────────── */
/* NOTE: emoji & labels are injected into HTML by fix_result_rows.py */
/* display:flex is on the inner div, NOT on <td> (td flex breaks table layout) */
td.res-rank-cell {
  border:none !important;
  border-right:3px solid #fff !important;
  height:auto !important;
  padding:0 !important;
  vertical-align:middle;
}
td.res-rank-cell:last-child { border-right:none !important; }
td.res-rank-cell.gold   { background:linear-gradient(180deg,#fff8e1 0%,#ffe082 100%); }
td.res-rank-cell.silver { background:linear-gradient(180deg,#f2f2f2 0%,#dcdcdc 100%); }
td.res-rank-cell.bronze { background:linear-gradient(180deg,#fbe9e7 0%,#ffccbc 100%); }
.res-rank-inner {
  display:flex; align-items:center; justify-content:center; gap:6px;
  padding:12px 4px;
}
.res-rank-medal { font-size:22px; line-height:1; }
.res-rank-label { font-size:11px; font-weight:800; letter-spacing:2px; text-transform:uppercase; }
td.res-rank-cell.gold   .res-rank-label { color:#8b6914; }
td.res-rank-cell.silver .res-rank-label { color:#555; }
td.res-rank-cell.bronze .res-rank-label { color:#6d4c41; }

/* ── Row 3/4: Name cells ─────────────────────── */
td.res-name-cell {
  background:#fdfaf8;
  border:none !important;
  border-right:3px solid #fff !important;
  border-top:1px solid #f0e8e0 !important;
  padding:16px 8px !important;
  text-align:center;
  vertical-align:middle;
}
td.res-name-cell:last-child { border-right:none !important; }
.res-name-block {
  display:flex; flex-direction:column; align-items:center; gap:6px;
}
.res-player {
  font-size:13px; font-weight:700; color:#1a1a1a; line-height:1.4;
  letter-spacing:0.5px;
}
.res-team {
  display:inline-block;
  font-size:10px; font-weight:600; color:#c0392b;
  background:rgba(192,57,43,0.09);
  padding:2px 10px; border-radius:10px; letter-spacing:0.5px;
}

/* ── Doubles: 2-partner display ─────────────── */
.res-name-block.res-doubles { gap:10px; }
.res-partner {
  display:flex; flex-direction:column; align-items:center; gap:4px;
  width:100%;
  padding-bottom:8px;
  border-bottom:1px dashed #e0d8d0;
}
.res-partner:last-child { border-bottom:none; padding-bottom:0; }

/* Legacy class compatibility */
.style1 { color:#1a5fa0; font-weight:bold; }
.style2 { color:#c0392b; }
.style4 { color:#1a5fa0; font-weight:bold; }

/* ===== FOOTER ===== */
.site-footer { background:#1a1a1a; color:#666; text-align:center; padding:20px; font-size:11px; letter-spacing:0.5px; }

/* ハンバーガーは使わない */
.hamburger { display: none !important; }

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 640px) {
  html { overflow-x: hidden; }
  .site { max-width: 100%; min-width: 0; }

  /* Navbar: ナビ常時表示、ロゴ下に折り返し */
  .navbar { flex-wrap: wrap; min-height: auto; height: auto; padding: 10px 12px 0; }
  .navbar-right { display: none; }
  .nav-items {
    display: flex !important;
    width: 100%; height: auto;
    flex-direction: row;
    border-top: 1px solid #f0ebe5;
    margin: 0 -12px;
    padding: 0;
  }
  .nav-items li { flex: 1; }
  .nav-items li a {
    display: flex; align-items: center; justify-content: center;
    text-align: center; height: 44px; padding: 0 4px;
    font-size: 13px; font-weight: 700; letter-spacing: 0;
    border-bottom: none; border-right: 1px solid #f0ebe5;
    white-space: nowrap;
  }
  .nav-items li:last-child a { border-right: none; }

  /* Body layout: サイドバー非表示、メインフル幅 */
  .body-layout { display: block; }
  .sidebar { display: none; }

  /* Main column */
  .main-col { padding: 18px 14px 40px; width: 100%; }
  .main-full { padding: 18px 14px 40px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Entry frame (iframe): 横スクロール */
  .entry-frame { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }

  /* Section title */
  .sec-title { font-size: 11px; }

  /* Year list */
  .year-list li a { font-size: 15px; padding: 13px 14px 13px 30px; }

  /* Result pages */
  .res-back { font-size: 14px; padding: 10px 18px; }
  .main-full > h2 { font-size: 16px; }

  /* Venue map */
  .map-wrap iframe { height: 320px; }
}

@media (max-width: 400px) {
  .nav-items li a { font-size: 11px; }
}
