/* SaMiina Pockets — 共通スタイル */

:root {
  --ink: #1a2520;
  --paper: #faf7ee;
  --bg: #f3efe2;
  --card: #ffffff;
  --green-deep: #0d3a2e;
  --green-mid: #185c46;
  --green-soft: #e8efe8;
  --gold: #c8973d;
  --gold-light: #e8c577;
  --rule: #2c3e35;
  --muted: #5a6660;
  --win: #2a8a5e;
  --draw: #b58a3d;
  --lose: #b34a4a;
  --pro: #6b4d9b;
  --hover: rgba(13, 58, 46, 0.06);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  /* iOS Safariで html 側にも overflow-x 抑制が要る */
  overflow-x: hidden;
}
html, body {
  background: var(--bg);
  color: var(--ink);
  /* 2026年時点での日本語向けシステムフォントスタック (iOS→Android→Windows→Mac)
     Helvetica Neue/Arial = 欧文部分 / Hiragino = macOS/iOS和文 / Noto Sans JP = Windows 11+/Android 和文 */
  font-family:
    "Helvetica Neue",
    Arial,
    "Hiragino Kaku Gothic ProN",
    "Hiragino Sans",
    "Noto Sans JP",
    sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  /* 縦スクロール時の左右ブレ・横はみ出し抑制（iOS Safari等） */
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

/* ===== Header ===== */
.app-header {
  background: var(--green-deep);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
/* ロゴはヘッダー中央に絶対配置（左右に他のリンクを置けるよう） */
.app-header a.brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.app-header a.brand img { display: block; }
.app-header .brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size:20px;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.1s;
}
.app-header a.brand:hover { opacity: 0.8; }
.app-header .brand .gold { color: var(--gold-light); }
.app-header .brand img {
  height: 56px; width: auto; display: block;
}
@media (max-width: 600px) {
  .app-header .brand img { height: 44px; }
}
.app-header .sub {
  font-size:16px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}
.app-header .spacer { flex: 1; }
.app-header .user-info {
  display: flex; align-items: center; gap: 8px;
  font-size:17px; color: rgba(255,255,255,0.85);
}
.app-header .user-info img {
  width: 24px; height: 24px; border-radius: 50%;
}
.app-header button {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size:17px;
  cursor: pointer;
  font-family: inherit;
}
.app-header button:hover { background: rgba(255,255,255,0.18); }

/* ヘッダー戻るリンクのシンプル化（インラインstyleを上書き） */
.app-header .back-link {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  padding: 6px 4px !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  opacity: 0.92;
  transition: opacity 0.1s;
}
.app-header .back-link:hover { opacity: 1; }

/* ===== Main container ===== */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 12px 60px;  /* 下にゆとり：スマホのブラウザUIによる見切れ対策 */
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size:18.5px;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-soft);
  display: flex; align-items: center; gap: 8px;
}
.card-title .num {
  font-family: 'Outfit'; font-weight: 300;
  color: var(--gold); font-size:21.5px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--green-deep); color: #fff;
  border: none; border-radius: 6px;
  padding: 10px 16px;
  font-family: inherit; font-size:17.5px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--green-mid); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-gold { background: var(--gold); }
.btn-gold:hover { background: #b88330; }
.btn-outline {
  background: transparent; color: var(--green-deep);
  border: 1px solid var(--green-deep);
}
.btn-outline:hover { background: var(--green-soft); }
.btn-danger { background: var(--lose); }
.btn-danger:hover { background: #9a3a3a; }
.btn-sm { padding: 6px 10px; font-size:17px; }
.btn-lg { padding: 14px 22px; font-size:19px; }
.btn-block { display: flex; width: 100%; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; font-size:17.5px; }
table th {
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--green-deep);
  font-size:17px;
}
table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--green-soft);
}
table tr:hover td { background: var(--hover); }

/* ===== Form ===== */
input, select, textarea {
  font-family: inherit;
  font-size:18.5px;
  padding: 8px 10px;
  border: 1px solid #d6cfb8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  /* 入力欄内スクロール時の左右ブレ抑制 */
  overscroll-behavior: contain;
  max-width: 100%;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,61,0.15);
}
label {
  display: block;
  font-size:17px;
  font-weight: 600;
  color: var(--green-mid);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.field { margin-bottom: 12px; }

/* ===== Tabs ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--green-soft);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* スマホでタブをタッチした際の縦スクロール巻き込みを抑制（横方向のpanのみ許可） */
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}
.tab-bar button {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-family: inherit; font-size:17.5px; font-weight: 600;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -2px;
}
.tab-bar button.active {
  color: var(--green-deep);
  border-bottom-color: var(--gold);
}
.tab-bar button:hover:not(.active) {
  color: var(--green-mid);
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size:16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--green-soft);
  color: var(--green-deep);
}
.badge-pro { background: rgba(107, 77, 155, 0.12); color: var(--pro); }
.badge-win { background: rgba(42, 138, 94, 0.12); color: var(--win); }
.badge-draw { background: rgba(181, 138, 61, 0.12); color: var(--draw); }
.badge-lose { background: rgba(179, 74, 74, 0.12); color: var(--lose); }

/* ===== Auth screen ===== */
.auth-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 80vh; text-align: center;
}
.auth-screen .auth-card {
  background: var(--card);
  padding: 40px 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 360px; width: 90%;
}
.auth-screen .auth-card h1 {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size:25px;
  font-weight: 900;
  color: var(--green-deep);
  margin-bottom: 8px;
}
.auth-screen .auth-card .sub {
  font-size:17px;
  color: var(--muted);
  margin-bottom: 24px;
  letter-spacing: 0.1em;
  font-family: 'Outfit', sans-serif;
}
.auth-screen .auth-card .msg {
  font-size:17.5px;
  color: var(--muted);
  margin-bottom: 20px;
}
.auth-screen .auth-card .error {
  background: rgba(179, 74, 74, 0.08);
  border-left: 3px solid var(--lose);
  color: var(--lose);
  padding: 8px 12px;
  font-size:17px;
  border-radius: 4px;
  margin-top: 12px;
  text-align: left;
}

/* ===== Loading ===== */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(13,58,46,0.15);
  border-top-color: var(--green-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  color: var(--muted);
  font-size:17.5px;
}

/* ===== Notice ===== */
.notice {
  background: var(--green-soft);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  font-size:17px;
  color: var(--ink);
  border-radius: 4px;
  line-height: 1.6;
}

/* ===== Breadcrumb / Detail header ===== */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  font-size:17px;
  color: var(--muted);
}
.breadcrumb .btn-back {
  background: transparent; border: none;
  color: var(--green-mid); font-family: inherit; font-size:17.5px;
  font-weight: 600; cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.breadcrumb .btn-back:hover { background: var(--green-soft); }
.breadcrumb .sep { color: rgba(0,0,0,0.2); }
.breadcrumb .current { color: var(--green-deep); font-weight: 700; font-size:17.5px; }

.detail-header-card {
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  color: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.detail-header-card .title-row {
  display: flex; align-items: baseline;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px;
}
.detail-header-card h1 {
  font-size:21.5px; font-weight: 900;
  letter-spacing: 0.04em;
  margin: 0;
}
.detail-header-card .meta {
  font-size:17px; color: rgba(255,255,255,0.85);
  line-height: 1.7;
}
.detail-header-card .meta b { color: var(--gold-light); font-weight: 700; }
.detail-header-card .actions {
  margin-top: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.detail-header-card .actions button {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-family: inherit; font-size:17px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.detail-header-card .actions button:hover { background: rgba(255,255,255,0.2); }
.detail-header-card .actions button.danger { color: #ffb3b3; border-color: rgba(255,179,179,0.3); }

.page-header {
  display: flex; align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 8px;
}
.page-header h1 {
  font-size:20px; font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.04em;
  margin: 0;
  flex: 1;
}

/* Stats row in overview */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.stat-tile {
  background: var(--card);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-tile .label {
  font-size:15px;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 4px;
}
.stat-tile .value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size:25px;
  color: var(--green-deep);
  line-height: 1;
}
.stat-tile .sub {
  font-size:15px; color: var(--muted);
  margin-top: 4px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13, 37, 32, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.18s ease;
  overscroll-behavior: contain;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal-header {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--green-soft);
}
.modal-header h2 {
  font-size:19px;
  font-weight: 700;
  color: var(--green-deep);
  letter-spacing: 0.04em;
  margin: 0;
  flex: 1;
}
.modal-close {
  background: transparent;
  border: none;
  font-size:25px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--green-soft); color: var(--green-deep); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  flex: 1;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--green-soft);
  background: rgba(232, 239, 232, 0.3);
  border-radius: 0 0 12px 12px;
}

/* Radio card group */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.radio-card {
  display: block;
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--green-soft);
  border-radius: 8px;
  padding: 12px 14px;
  transition: all 0.15s;
  background: #fff;
}
.radio-card:hover { border-color: var(--gold-light); }
.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-card:has(input:checked) {
  border-color: var(--gold);
  background: rgba(200,151,61,0.06);
  box-shadow: 0 0 0 3px rgba(200,151,61,0.12);
}
.radio-card .radio-title {
  font-size:17.5px;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 2px;
}
.radio-card:has(input:checked) .radio-title { color: var(--gold); }
.radio-card .radio-sub {
  font-size:16px;
  color: var(--muted);
  line-height: 1.4;
}

.hint {
  font-size:16px;
  color: var(--muted);
  margin-top: 4px;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.04em;
}
.hint b { font-weight: 700; color: var(--green-mid); }

/* ===== Mobile tweaks ===== */
@media (max-width: 600px) {
  .container { padding: 8px; }
  .card { padding: 12px; margin-bottom: 10px; border-radius: 6px; }
  .card-title { font-size:17.5px; margin-bottom: 8px; padding-bottom: 6px; }
  .app-header { padding: 8px 12px; gap: 8px; }
  .app-header .brand { font-size:18.5px; }
  .app-header .sub { display: none; }
  table { font-size:16px; }
  table th, table td { padding: 5px 6px; }
  .stats-row { gap: 6px; }
  .stat-tile { padding: 8px 6px; }
  .stat-tile .label { font-size:14.5px; }
  .stat-tile .value { font-size:21.5px; }
  .detail-header-card { padding: 12px 14px; }
  .detail-header-card h1 { font-size:19px; }
}
