/* =====================================================
   WanReco (ワンレコ) — Cleaned & Organized CSS (full)
   Author: STUDIO A KAY ＆ChatGPT
   Notes:
   - iOS風リキッドグラス（白基調） + 下部タブだけ透け白ガラス
   - 変数は :root を調整（--tabs-* でタブ、--glass等は共通）
   - 2025-09 cleaned: duplicated rules removed, padding bugs fixed,
     icon borders removed under tabs, unified filters, mobile tweaks
   ===================================================== */

/* ====== Design Tokens ====== */
:root {
  --bg-start: #f9fafb;
  --bg-end: #ffffff;
  --ink: #0f172a;
  --ink2: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --acc: #0ea5e9;
  --ok: #16a34a;
  --warn: #eab308;
  --bad: #ef4444;

  /* iOS Liquid Glass (common) */
  --glass: rgba(255, 255, 255, 0.65);
  --blur: 20px;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.06);
  --hairline: 1px solid rgba(255, 255, 255, 0.55);
  --hairline-dark: 1px solid rgba(15, 23, 42, 0.08);
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --press-scale: 0.97;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.025'/></svg>");
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* Bottom Tabs (light glass + blueish ink) */
  --tabs-bg: rgba(255, 255, 255, 0.65);
  --tabs-blur: 16px;
  --tabs-border: rgba(200, 200, 255, 0.22);
  --tabs-ink: rgba(220, 240, 255, 0.95);
  --tabs-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15);
  --tabs-radius: 18px;
}

/* ====== Base ====== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html,
body {
  overflow-x: hidden;
  touch-action: manipulation;
}
body {
  margin: 0;
  font: 15px/1.6 system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
    Helvetica, Arial;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* keep content above fixed bottom tabs */
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ====== Glass Helpers ====== */
.glass,
header.appbar {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(140%) blur(var(--blur));
  backdrop-filter: saturate(140%) blur(var(--blur));
  border-radius: var(--radius);
  border: var(--hairline-dark);
  box-shadow: var(--shadow-sm);
  background-image: var(--noise);
  background-blend-mode: overlay;
}
.glass::before,
header.appbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.glass::after,
header.appbar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
      120% 60% at 0% 0%,
      rgba(255, 255, 255, 0.35),
      transparent 60%
    ),
    radial-gradient(
      120% 60% at 100% 100%,
      rgba(255, 255, 255, 0.15),
      transparent 60%
    );
}

/* ====== Header ====== */
header.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 10px 14px;
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
  border-bottom: var(--hairline-dark);
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.logo-link {
  display: inline-flex;
  align-items: center;
}
.logo-img {
  height: 85px; /* ← 56px → 72px に拡大 */
  max-width: 290px; /* 横幅も少し余裕を持たせる */
  width: auto;
  display: block;
  object-fit: contain;
}
@media (max-width: 480px) {
  .logo-img {
    height: 82px; /* スマホでも少し大きく */
    max-width: 220px;
  }
}
header .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.iconbtn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), background var(--transition),
    border-color var(--transition), box-shadow var(--transition);
}
.iconbtn:active {
  transform: scale(0.96);
}
.iconbtn[aria-pressed="true"] {
  background: #e2f0fb;
}
.icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 10px;
  padding: 2px;
}

/* ====== Main Layout ====== */
main {
  min-height: 100svh;
  padding: 12px 12px 84px;
}
.blk {
  padding: 12px;
  border-radius: var(--radius);
  background: #fff;
  border: var(--hairline-dark);
  box-shadow: var(--shadow-sm);
}
.hero {
  padding: 16px;
  border-radius: var(--radius);
  border: var(--hairline-dark);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, #ffffffbb, #ffffffff);
}
.ttl {
  font-weight: 700;
}
.sub {
  color: var(--ink2);
  font-size: 12px;
}

/* ====== Grid & Cards ====== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.card {
  position: relative;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  border: var(--hairline-dark);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}
.card:hover {
  transform: translateY(-2px);
}
.card .img {
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #94a3b8;
  font-size: 12px;
}
.card .body {
  padding: 10px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #334155;
}

/* ====== Buttons & Inputs ====== */
.btn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition), background var(--transition),
    border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8),
    0 6px 16px rgba(15, 23, 42, 0.06);
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
}
.btn-lg {
  padding: 12px 16px;
  font-size: 16px;
}
.btn.fav {
  padding: 4px 8px;
  font-size: 12px;
}

.input-lg {
  width: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  font-size: 17px;
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: saturate(130%) blur(14px);
  backdrop-filter: saturate(130%) blur(14px);
}

/* ====== Select / Dropdown ====== */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.select {
  display: block;
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}
.select:hover {
  border-color: rgba(15, 23, 42, 0.22);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}
.select:active {
  transform: scale(0.99);
}
.select select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 16px 48px 16px 16px;
  border: 0;
  background: transparent;
  font-size: 17px;
  line-height: 1.3;
  color: #0f172a;
  border-radius: 14px;
}
.select:focus-within {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.select .select-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  pointer-events: none;
  background: var(--chev) no-repeat center/20px;
  opacity: 0.9;
}
@supports (selector(:has(*))) {
  .select:has(select:focus) {
    border-color: #60a5fa;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.15);
  }
}

/* ====== Ripple-ish press ====== */
.pressable {
  position: relative;
  overflow: hidden;
}
.pressable::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(14, 165, 233, 0.25);
  width: 10px;
  height: 10px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s ease, opacity 0.8s ease;
}
.pressable.is-pressed::after {
  transform: scale(18);
  opacity: 1;
}

/* ====== Bottom Tabs (Light Glass) ====== */
nav.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--tabs-bg);
  -webkit-backdrop-filter: saturate(160%) blur(var(--tabs-blur));
  backdrop-filter: saturate(160%) blur(var(--tabs-blur));
  border-top: 1px solid var(--tabs-border);
  box-shadow: var(--tabs-shadow);
  color: var(--tabs-ink);
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
nav.tabs.hide {
  transform: translateY(120%);
  opacity: 0.85;
}
nav.tabs button {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 6px;
  border-radius: 14px;
  color: var(--tabs-ink);
  background: transparent;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  box-shadow: none;
  border: 0;
  cursor: pointer;
}
nav.tabs .icon-slot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
}
nav.tabs .icon-slot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  transform: translateZ(0);
  pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(180, 210, 255, 0.6));
}
nav.tabs button.active {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 6px 16px rgba(0, 0, 0, 0.22);
}
nav.tabs button.pressable.is-pressed {
  transform: translateY(1px) scale(0.98);
  transition: transform 120ms ease;
}
@media (max-width: 360px) {
  nav.tabs .icon-slot {
    width: 24px;
    height: 24px;
  }
  nav.tabs button {
    min-height: 48px;
  }
}

/* ====== Detail ====== */
.detail-hero {
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .detail-hero {
    grid-template-columns: 1fr;
  }
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.kpi {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list .item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 10px;
}
.tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
}
.compare {
  overflow: auto;
}
.compare table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
  width: 100%;
}
.compare th,
.compare td {
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 8px;
  background: #fff;
  font-size: 13px;
}
.compare th {
  background: #f8fafc;
  position: sticky;
  top: 0;
}
.compare .diff {
  background: #fff7ed;
}

/* ====== Page enter animation ====== */
.page-enter {
  opacity: 0;
  transform: translateY(8px);
}
.page-enter.page-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition), transform var(--transition);
}
@media (prefers-reduced-motion: reduce) {
  .page-enter,
  .page-enter.page-in {
    transition: none;
    transform: none;
  }
  .card:hover {
    transform: none;
  }
  nav.tabs,
  .btn {
    transition: none;
  }
}

/* ====== Floating Back Button ====== */
.fab-back {
  position: fixed;
  left: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 35;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms;
}
.fab-back:active {
  transform: scale(0.96);
}
.fab-back .icon-slot {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* ====== Home spacing fix ====== */
#home #homeBreeds {
  margin-top: 20px;
}

/* ====== Mobile adjustments ====== */
@media (max-width: 640px) {
  .btn {
    padding: 12px 16px;
    font-size: 16px;
  }
  .input-lg {
    padding: 14px 16px;
    font-size: 17px;
  }
}
@media (max-width: 480px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
  }
  .filter-grid > * {
    min-width: 0;
  }
  .filter-grid .input-lg {
    font-size: 14px !important;
    padding: 10px 12px !important;
    min-height: 40px !important;
    line-height: 1.25 !important;
  }
  .filter-grid .select select {
    font-size: 14px !important;
    padding: 10px 34px 10px 12px !important;
    min-height: 40px !important;
    line-height: 1.25 !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .filter-grid .select .select-arrow {
    width: 16px !important;
    height: 16px !important;
    right: 8px !important;
    background-size: 16px 16px !important;
  }
  .blk .btn,
  .filter-grid + .btn,
  #runMatch.btn {
    font-size: 14px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    line-height: 1.2 !important;
  }
}
@media (max-width: 360px) {
  .filter-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .filter-grid .select select,
  .filter-grid .input-lg {
    font-size: 13.5px !important;
    min-height: 38px !important;
    padding: 9px 32px 9px 10px !important;
  }
  nav.tabs .icon-slot {
    width: 24px;
    height: 24px;
  }
  nav.tabs button {
    min-height: 48px;
  }
}
/* ===== WanReco Intro Loader (lightweight) ===== */
:root {
  /* 見た目のつまみ */
  --intro-bg: rgba(255, 255, 255, 0.75);
  --intro-blur: 24px;
  --intro-border: rgba(200, 210, 255, 0.28);
  --intro-shadow: 0 30px 60px rgba(15, 23, 42, 0.12);

  /* ロゴの表示サイズ（横長 1000x500 想定） */
  --intro-logo-wide: 320px; /* PC目安 */
  --intro-logo-wide-sm: 220px; /* モバイル目安 */

  /* 時間（軽め） */
  --intro-fade: 600ms;
  --intro-in: 700ms;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  -webkit-backdrop-filter: saturate(140%) blur(var(--intro-blur));
  backdrop-filter: saturate(140%) blur(var(--intro-blur));
  transition: opacity var(--intro-fade) ease,
    visibility var(--intro-fade) step-end;
}
.intro__glass {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--intro-border);
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: var(--intro-shadow);
  position: relative;
  overflow: hidden;
}
.intro__glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.intro__logo {
  display: block;
  width: var(--intro-logo-wide);
  height: auto;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  animation: introLogoIn var(--intro-in) cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes introLogoIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 下に走る柔らかいきらめきライン（軽い演出） */
.intro__sparkle {
  height: 2px;
  width: 66%;
  margin: 10px auto 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(220, 240, 255, 0.85),
    transparent
  );
  filter: blur(0.2px);
  position: relative;
}
.intro__sparkle::after {
  content: "";
  position: absolute;
  left: -25%;
  top: -6px;
  bottom: -6px;
  width: 50%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.9),
    transparent
  );
  transform: translateX(0);
  animation: introWipe 1200ms ease-out 120ms forwards;
}
@keyframes introWipe {
  to {
    transform: translateX(200%);
    opacity: 0;
  }
}

/* フェードアウト */
.intro.intro-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 端末幅でロゴサイズを微調整 */
@media (max-width: 480px) {
  .intro__logo {
    width: var(--intro-logo-wide-sm);
  }
}

/* アニメーションを好まない設定への配慮 */
@media (prefers-reduced-motion: reduce) {
  .intro,
  .intro__logo,
  .intro__sparkle::after {
    animation: none !important;
    transition: none !important;
  }
}
