:root {
  color-scheme: light;
  --green: #1f7a3a;
  --green-dark: #145c2a;
  --green-light: #e6f4e9;
  --line: #cfe3d4;
  --text: #1d2b21;
  --muted: #5d6f62;
  --neg: #c0392b;
  --bg: #f6faf6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding-inline: 12px;
  padding-block: 0 40px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
.wrap { max-width: 760px; margin: 0 auto; }
a { color: var(--green-dark); }

header.site {
  display: flex; align-items: center; gap: 14px;
  padding-block: 14px;
  text-decoration: none; color: inherit;
}
header.site img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
header.site h1 { margin: 0; font-size: 1.35rem; color: var(--green-dark); line-height: 1.2; }
header.site h1 small { font-size: .7em; color: var(--green); font-weight: 600; }
header.site p { margin: 2px 0 0; color: var(--green); font-weight: 700; font-size: .9rem; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px 14px; margin-bottom: 16px; overflow: hidden; }
.bar { background: var(--green); color: #fff; font-size: 1rem; text-align: center; margin: 0 -14px 12px; padding: 8px; }
h2.bar { border-radius: 0; }
body > .wrap > h2.bar, #app > h2.bar { margin: 16px 0 8px; border-radius: 8px; }
.center { text-align: center; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field span { font-size: .85rem; color: var(--muted); }
input, select, button { font: inherit; font-size: 16px; }
input[type=text], input:not([type]), select {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.player { border-top: 1px dashed var(--line); padding-top: 8px; }
.player h3 { margin: 0 0 6px; font-size: .95rem; color: var(--green-dark); }

button {
  border: 1px solid var(--line); background: #fff; color: var(--green-dark);
  border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: 700;
}
button:disabled { opacity: .4; cursor: default; }
button.primary { display: block; width: 100%; background: var(--green); color: #fff; border-color: var(--green); font-size: 1.2rem; padding: 14px; margin-top: 12px; }
button.danger { color: var(--neg); }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions > * { flex: 1; margin-top: 0; }

.holebar {
  position: sticky; top: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--green); color: #fff; border-radius: 0 0 12px 12px; padding: 8px 14px; margin: 0 -12px 10px;
}
.holebar .course { font-size: .8rem; opacity: .9; }
.holebar .hole { font-size: 1.1rem; }
.holebar .hole b { font-size: 1.6rem; }
.holebar small { opacity: .85; }
.holebar .par { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.holebar .par select { width: auto; padding: 6px 8px; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 10px; }
table.sheet { width: 100%; border-collapse: collapse; background: #fff; table-layout: fixed; min-width: 340px; }
table.sheet th, table.sheet td { border: 1px solid var(--line); padding: 4px 3px; text-align: center; }
table.sheet th.lbl { width: 84px; background: var(--green-light); font-size: .78rem; font-weight: 700; text-align: left; padding-left: 6px; line-height: 1.25; }
table.sheet th.lbl small { display: block; font-weight: 400; color: var(--muted); }
table.sheet th.name { background: var(--green-light); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.sheet td.big { font-size: 1.35rem; font-weight: 700; }
table.sheet select { padding: 8px 2px; text-align: center; text-align-last: center; }
table.sheet input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--green); }
table.holes { min-width: 420px; }
table.holes th:nth-child(2), table.holes td:nth-child(2) { width: 40px; }
table.holes tr.sum td, table.holes tr.sum th { background: var(--green-light); font-weight: 700; }
.neg { color: var(--neg); }
.err { color: var(--neg); font-weight: 700; text-align: center; }

ol.rank { list-style: none; padding: 0; margin: 0; }
ol.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
ol.rank .pos { width: 32px; height: 32px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); display: grid; place-items: center; font-weight: 800; flex: none; }
ol.rank li:first-child .pos { background: #f2c94c; color: #5a4300; }
ol.rank .who { flex: 1; font-weight: 700; min-width: 0; }
ol.rank .who small { display: block; font-weight: 400; color: var(--muted); }
ol.rank .pt { font-size: 1.5rem; font-weight: 800; }
.note { font-size: .85rem; color: var(--muted); }

/* トップページ */
.menu { display: grid; gap: 12px; margin-bottom: 16px; }
.menu a { display: block; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: 12px; padding: 16px; text-decoration: none; color: var(--text); }
.menu a b { display: block; font-size: 1.25rem; color: var(--green-dark); }
.menu a span { font-size: .9rem; color: var(--muted); }
.rules table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rules th, .rules td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.rules th { width: 34%; color: var(--green-dark); }
footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 24px; }

/* アカウント機能 */
.auth-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: .88rem; }
.auth-bar .who { color: var(--muted); min-width: 0; }
.auth-bar a { font-weight: 700; }
a.btn { display: inline-block; text-align: center; border: 1px solid var(--line); background: #fff; color: var(--green-dark); border-radius: 10px; padding: 12px 14px; font-weight: 700; text-decoration: none; }
a.btn.primary-link { display: block; background: var(--green); color: #fff; border-color: var(--green); margin-top: 8px; }
.cloud-box { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; }
.cloud-box p { margin: 0 0 8px; }
.cloud-box input[type=text] { font-size: 14px; }
.cloud-box .actions button.primary { margin-top: 0; font-size: 1rem; padding: 12px; }
.friends { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.friends .note { width: 100%; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--green-light); border-color: var(--line); font-size: .9rem; }
.chip small { color: var(--muted); font-weight: 400; }
.chip.ghost { background: #fff; color: var(--muted); }
.auth-card .social { display: block; width: 100%; margin-top: 10px; font-size: 1rem; }
.auth-card .social.google { background: #fff; color: #3c4043; border-color: #dadce0; }
.auth-card .social.apple { background: #000; color: #fff; border-color: #000; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 18px 0 10px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.tabs .tab { flex: 1; padding: 10px 6px; border-radius: 10px; background: #fff; color: var(--muted); white-space: nowrap; }
.tabs .tab.on { background: var(--green); color: #fff; border-color: var(--green); }
.linklike { border: 0; background: none; color: var(--green-dark); text-decoration: underline; font-weight: 400; padding: 10px 0 0; }
.me-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; }
.me-card small { color: var(--muted); word-break: break-all; }
ul.history, ul.friend-list { list-style: none; padding: 0; margin: 0 0 16px; }
ul.history li a { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; color: var(--text); text-decoration: none; }
.h-main { min-width: 0; }
.h-main small, .h-me small { display: block; color: var(--muted); font-size: .8rem; }
.h-me { text-align: right; flex: none; }
.h-me b { font-size: 1.3rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--green-light); border-radius: 10px; padding: 8px; text-align: center; }
.stat small { display: block; color: var(--muted); font-size: .72rem; }
.stat b { font-size: 1.2rem; }
table.stats { min-width: 360px; }
.friend-add { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; }
ul.friend-list li { display: grid; grid-template-columns: 1fr 96px auto; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; }
.f-name small { display: block; color: var(--muted); font-size: .75rem; }
ul.friend-list button, .friend-add button { padding: 10px 12px; }
.danger-zone h3 { margin: 14px 0 4px; font-size: 1rem; color: var(--neg); }
@media (max-width: 420px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
