/* ================================================
   ひなたのうみ — 共通スタイル
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=DM+Serif+Display:ital@0;1&display=swap');
@import './variables.css';

/* ── リセット & ベース ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  color: var(--c-ink-800);
  background: var(--c-body);
  padding-top: var(--h-header);
  overflow-x: hidden;
  /* 日本語禁則処理（句読点・括弧が行頭行末に来ない）— 全画面幅で有効 */
  line-break: strict;
}

/* 日本語テキストを含む主要要素に文節改行を適用 */
h1, h2, h3, h4, h5, h6,
p, li, dt, dd, figcaption,
.post-title, .post-body,
.card-title, .card-title-goods,
.battle-card-title,
.sort-hero-title, .sort-hero-sub,
.sort-step-text,
.notice-box,
.guide-step-desc,
.trade-hero-desc,
.sidebar-bio,
.footer-desc,
.result-header-sub,
.ranking-meta,
.btn {
  line-break: strict;
  word-break: auto-phrase; /* Chrome 119+: AI文節解析による自然な改行 */
  overflow-wrap: break-word;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── ヘッダー ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--h-header);
  z-index: var(--z-header);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(126,207,237,.2);
  transition: box-shadow var(--t-normal);
}
.site-header.scrolled {
  box-shadow: 0 2px 24px rgba(26,138,181,.1);
}
.header-inner {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ロゴ */
.site-logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex-shrink: 0;
}
.logo-ja {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-sky-500);
  letter-spacing: .08em;
}
.logo-en {
  font-family: 'DM Serif Display', serif;
  font-size: 10px;
  color: var(--c-ink-300);
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* デスクトップナビ */
.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-500);
  letter-spacing: .04em;
  position: relative;
  transition: color var(--t-fast);
}
.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1.5px;
  background: var(--c-sky-400);
  transition: width var(--t-normal);
}
.site-nav a:hover,
.site-nav a.active { color: var(--c-sky-500); }
.site-nav a:hover::after,
.site-nav a.active::after { width: 100%; }
.nav-btn {
  padding: 8px 18px;
  background: var(--c-sky-400);
  color: var(--c-white) !important;
  border-radius: var(--r-full);
  font-size: 12px !important;
  font-weight: 600 !important;
  transition: background var(--t-fast), transform var(--t-fast) !important;
  letter-spacing: .04em !important;
}
.nav-btn:hover {
  background: var(--c-sky-500) !important;
  transform: translateY(-1px);
}
.nav-btn::after { display: none !important; }

/* ハンバーガー */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--c-ink-700);
  border-radius: var(--r-full);
  transition: all var(--t-normal);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* モバイルナビ */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--h-header); left: 0; right: 0;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-sky-200);
  padding: 20px 24px 28px;
  flex-direction: column;
  gap: 4px;
  z-index: calc(var(--z-header) - 1);
  box-shadow: var(--s-lg);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--c-ink-600);
  border-bottom: 1px solid var(--c-ink-100);
  transition: color var(--t-fast), padding-left var(--t-fast);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: var(--c-sky-500); padding-left: 16px; }

/* ── レイアウト ── */
.container {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 0 32px;
}
.page-wrap {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 48px 32px 80px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}
.page-wrap.full {
  grid-template-columns: 1fr;
}
.page-main {}
.page-sidebar { position: sticky; top: calc(var(--h-header) + 24px); }

/* ── パンくずリスト ── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--c-ink-300);
  margin-bottom: 32px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-ink-100);
}
.breadcrumb a {
  color: var(--c-sky-500);
  transition: opacity var(--t-fast);
}
.breadcrumb a:hover { opacity: .7; }
.breadcrumb .sep { color: var(--c-ink-200); }

/* ── ページヘッダー ── */
.page-header {
  background: linear-gradient(160deg, var(--c-sky-100) 0%, var(--c-sky-50) 60%, var(--c-body) 100%);
  padding: 52px 32px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(58,181,224,.12), transparent);
  pointer-events: none;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,224,102,.15), transparent);
  pointer-events: none;
}
.page-header-label {
  font-family: 'DM Serif Display', serif;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--c-sky-400);
  margin-bottom: 10px;
}
.page-header h1 {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  color: var(--c-ink-800);
  letter-spacing: .04em;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

/* ── サイドバー ── */
.sidebar-widget {
  background: var(--c-white);
  border: 1px solid var(--c-ink-100);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--s-sm);
}
.sidebar-widget:last-child { margin-bottom: 0; }
.sidebar-widget-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--c-ink-400);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--c-sky-100);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-widget-title::before {
  content: '';
  width: 3px; height: 14px;
  background: var(--c-sky-400);
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* 広告枠 */
.ad-slot {
  width: 100%;
  background: var(--c-ink-50);
  border: 1.5px dashed var(--c-ink-100);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ink-200);
  font-size: 11px;
  letter-spacing: .08em;
}
.ad-slot-sidebar { height: 250px; }
.ad-slot-mobile-banner { height: 100px; display: none; }
.ad-slot-mobile-reader { height: 50px; display: none; }

/* ── 固定サイドバー広告（左右） ── */
.ad-sidebar {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  display: none;
  z-index: 100;
}
.ad-sidebar-left  { left:  calc(50% - 640px - 180px); }
.ad-sidebar-right { right: calc(50% - 640px - 180px); }
.ad-sidebar-inner {
  background: var(--c-white);
  border: 1px solid var(--c-ink-100);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--s-sm);
}
.ad-sidebar-label {
  font-size: 9px;
  color: var(--c-ink-300);
  text-align: center;
  letter-spacing: .1em;
  padding: 4px 0;
  background: var(--c-ink-50, #f8f9fa);
  border-bottom: 1px solid var(--c-ink-100);
}
.ad-sidebar-slot {
  width: 160px;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--c-sky-50), #fff);
  color: var(--c-ink-300);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
}
/* 1640px 以上で表示 */
@media (min-width: 1640px) { .ad-sidebar { display: block; } }

/* サイドバー最新記事 */
.sidebar-post-list { list-style: none; }
.sidebar-post-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--c-ink-50);
}
.sidebar-post-item:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-post-item a {
  font-size: 12px;
  color: var(--c-ink-600);
  line-height: 1.6;
  transition: color var(--t-fast);
  display: block;
}
.sidebar-post-item a:hover { color: var(--c-sky-500); }
.sidebar-post-date {
  font-size: 10px;
  color: var(--c-ink-300);
  margin-top: 3px;
}

/* サイドバーカテゴリ */
.sidebar-cat-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-cat-link {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--c-sky-50);
  color: var(--c-sky-500);
  border: 1px solid var(--c-sky-200);
  transition: all var(--t-fast);
  font-weight: 500;
}
.sidebar-cat-link:hover {
  background: var(--c-sky-400);
  color: var(--c-white);
  border-color: var(--c-sky-400);
}

/* ── ボタン ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
}
.btn-primary {
  background: var(--c-sky-400);
  color: var(--c-white);
  box-shadow: 0 4px 16px rgba(58,181,224,.3);
}
.btn-primary:hover {
  background: var(--c-sky-500);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(58,181,224,.4);
}
.btn-outline {
  background: transparent;
  color: var(--c-sky-500);
  border: 1.5px solid var(--c-sky-300);
}
.btn-outline:hover {
  background: var(--c-sky-50);
  border-color: var(--c-sky-400);
  transform: translateY(-2px);
}
.btn-danger {
  background: #fff0f0;
  color: var(--c-danger);
  border: 1.5px solid #ffd0d0;
}
.btn-danger:hover { background: var(--c-danger); color: var(--c-white); }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── バッジ ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}
.badge-live    { background: #e8f4ff; color: #2b7fc9; }
.badge-release { background: #fff0f7; color: #c92b7a; }
.badge-diary   { background: #f0fff4; color: #2bc97a; }
.badge-event   { background: #fff8e8; color: #c97a2b; }
.badge-member  { background: #f3f0ff; color: #7a2bc9; }
.badge-other   { background: var(--c-sky-100); color: var(--c-sky-500); }
.badge-done    { background: #f0fff4; color: #2bc97a; }
.badge-hidden  { background: #fff0f0; color: var(--c-danger); }

/* ── フォームコントロール ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink-600);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-label .required { color: var(--c-danger); font-size: 11px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--c-ink-100);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--c-ink-800);
  background: var(--c-white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-control:focus {
  border-color: var(--c-sky-400);
  box-shadow: 0 0 0 3px rgba(58,181,224,.12);
}
.form-control::placeholder { color: var(--c-ink-200); }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a9aab' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 120px; line-height: 1.7; }

/* パスワード強度チェッカー */
.pw-strength { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pw-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--c-ink-300);
  transition: color var(--t-fast);
}
.pw-check.ok { color: var(--c-success); }
.pw-check-icon { font-size: 11px; }

/* ── アニメーション ── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── ローディング ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--c-sky-200);
  border-top-color: var(--c-sky-400);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
.loading-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--c-ink-300);
  font-size: 14px;
}

/* ── トースト通知 ── */
.toast-container {
  position: fixed;
  top: calc(var(--h-header) + 16px);
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--s-md);
  animation: fadeIn .3s ease;
  pointer-events: auto;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: #f0fff4; color: #1a7f3c; border: 1px solid #c3f0d5; }
.toast-error   { background: #fff0f0; color: #b71c1c; border: 1px solid #ffd0d0; }
.toast-info    { background: var(--c-sky-50); color: var(--c-sky-600); border: 1px solid var(--c-sky-200); }

/* ── モーダル ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,36,.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--c-white);
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--s-xl);
  transform: translateY(16px) scale(.97);
  transition: transform var(--t-normal);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-ink-800);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--c-ink-300);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--c-ink-600); }

/* ── フッター ── */
.site-footer {
  background: var(--c-ink-800);
  color: rgba(255,255,255,.6);
  padding: 56px 32px 36px;
  margin-top: 80px;
}
.footer-inner {
  max-width: var(--w-max);
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-brand .logo-ja { color: var(--c-sky-300); font-size: 20px; }
.footer-brand .logo-en { color: rgba(255,255,255,.25); }
.footer-desc {
  font-size: 13px;
  line-height: 1.9;
  margin-top: 14px;
  color: rgba(255,255,255,.45);
  max-width: 280px;
}
.footer-col h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c-sky-200);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  font-size: 13px;
  color: rgba(255,255,255,.45);
  transition: color var(--t-fast);
}
.footer-col a:hover { color: rgba(255,255,255,.85); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-disclaimer {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  line-height: 1.8;
  max-width: 540px;
}
.footer-copy {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  white-space: nowrap;
}

/* ── メンテナンスモード ── */
.maintenance-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--c-sky-50);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}
.maintenance-screen.active { display: flex; }
.maintenance-icon { font-size: 64px; margin-bottom: 24px; }
.maintenance-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--c-ink-800);
  margin-bottom: 12px;
}
.maintenance-msg {
  font-size: 15px;
  color: var(--c-ink-500);
  line-height: 1.8;
  max-width: 480px;
}

/* ── レスポンシブ ── */
@media (max-width: 1024px) {
  .page-wrap { gap: 32px; }
}
@media (max-width: 768px) {
  body { font-size: 14px; }
  .header-inner { padding: 0 20px; }
  .site-nav { display: none; }
  .hamburger { display: flex; }
  .container { padding: 0 20px; }
  .page-wrap {
    padding: 32px 20px 60px;
    grid-template-columns: 1fr;
  }
  .page-main { overflow-x: hidden; min-width: 0; }
  .page-sidebar { display: none; }
  /* モバイルではrevealのtransformを無効化（overflow-x:hiddenとの衝突でスクロールが初期ロックされるため） */
  .reveal { transform: none; }
  .reveal.visible { transform: none; }
  .page-header { padding: 40px 20px 36px; }
  .site-footer { padding: 16px 20px 12px; margin-top: 40px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 10px; padding-bottom: 10px; }
  .footer-brand { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .footer-desc { display: none; }
  .footer-brand .logo-ja { font-size: 14px; }
  .footer-brand .logo-en { font-size: 9px; }
  .footer-col { padding-top: 2px; }
  .footer-col h4 { font-size: 9px; margin-bottom: 4px; letter-spacing: .12em; }
  .footer-col li { margin-bottom: 2px; }
  .footer-col a { font-size: 11px; line-height: 1.6; }
  .footer-bottom { flex-direction: row; align-items: center; justify-content: flex-end; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
  .footer-disclaimer { display: none; }
  .footer-copy { font-size: 10px; }

  /* モーダル */
  .modal { padding: 24px 20px; max-width: calc(100vw - 32px); }
  .modal-title { font-size: 16px; }

  /* トースト */
  .toast-container { right: 12px; left: 12px; }
  .toast { max-width: 100%; width: 100%; box-sizing: border-box; }

  /* モバイル広告 */
  .ad-slot-mobile-banner,
  .ad-slot-mobile-reader { display: flex; margin: 16px auto; }
  .ad-slot-mobile-banner { width: 320px; }
  .ad-slot-mobile-reader { width: 320px; }
}

@media (max-width: 480px) {
  .page-wrap { padding: 24px 16px 48px; }
  .page-header { padding: 32px 16px 28px; }
  .container { padding: 0 16px; }
  .header-inner { padding: 0 16px; }
  .site-footer { padding: 14px 16px 10px; margin-top: 28px; }
  .footer-grid { gap: 0; }
  .btn-lg { padding: 11px 20px; font-size: 14px; }
  .modal { padding: 20px 16px; }
  /* ボタンが複数並ぶdivを縦並びに */
  .modal > div[style*="justify-content:flex-end"],
  .modal > div[style*="justify-content: flex-end"] {
    flex-wrap: wrap;
    justify-content: stretch !important;
  }
  .modal > div[style*="justify-content:flex-end"] .btn,
  .modal > div[style*="justify-content: flex-end"] .btn {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    justify-content: center;
  }
}
