/* Mangolf 成績管理：給 40–70 歲使用者，字大、對比高、按鈕大 */
:root {
  --green: #14532d;
  --green-hover: #166534;
  --green-soft: #e8f3ec;
  --ink: #1a1f1c;
  --muted: #56615b;
  --line: #d5dbd7;
  --bg: #f4f6f4;
  --card: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --gold: #a16207;
  --gold-soft: #fef6dc;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.6;
}

a { color: var(--green); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.3; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.nowrap { white-space: nowrap; }

/* 版面 */
.topbar {
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.ws-chip {
  color: #fff;
  text-decoration: none;
  border: 1.5px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .95rem;
  max-width: 55vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 14px 6px;
  min-height: 56px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 4px solid transparent;
}
.tabs a.active { color: var(--green); border-bottom-color: var(--green); }

.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 96px; }

/* 手機：分頁固定在畫面下方，拇指好按 */
@media (max-width: 720px) {
  .tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a { border-bottom: 0; border-top: 4px solid transparent; }
  .tabs a.active { border-top-color: var(--green); }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 22px;
  border-radius: 10px;
  border: 2px solid var(--green);
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn.secondary { background: #fff; color: var(--green); }
.btn.secondary:hover { background: var(--green-soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 44px; padding: 6px 14px; font-size: .95rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* 表單 */
label { display: block; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=url], select {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid #9aa59f;
  border-radius: 10px;
}
input:focus, select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
  margin: 0;
  cursor: pointer;
}
.check input { width: 24px; height: 24px; accent-color: var(--green); flex: none; }
.check:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

details.advanced { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; }
details.advanced summary { cursor: pointer; font-weight: 700; min-height: 36px; }

/* 訊息 */
.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.alert.ok { background: var(--green-soft); color: var(--green); border: 1px solid #b7d8c2; }
.alert.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3b8b1; }
.alert ul { margin: 0; padding-left: 20px; }

/* 清單 */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  color: inherit;
  text-decoration: none;
}
a.list-item:hover { border-color: var(--green); }
.list-item .title { font-weight: 700; font-size: 1.1rem; }
.chev { color: var(--muted); font-size: 1.5rem; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .85rem;
  font-weight: 700;
  background: var(--green-soft);
  color: var(--green);
}
.tag.wait { background: var(--gold-soft); color: var(--gold); }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: var(--green-soft); color: var(--green); font-size: .9rem; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.sticky { position: sticky; left: 0; background: var(--card); text-align: left; z-index: 1; box-shadow: 1px 0 0 var(--line); }
thead .sticky { background: var(--green-soft); }
td.num, th.num { font-variant-numeric: tabular-nums; }
.results td { font-size: 1.1rem; }
.results .net { font-weight: 800; font-size: 1.25rem; color: var(--green); }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; border-radius: 50%; font-weight: 800; background: #eef1ef; }
.rank.r1 { background: #f6d860; }
.rank.r2 { background: #d9dde2; }
.rank.r3 { background: #e7b98a; }
.hidden-hole { background: var(--gold-soft); }
thead th.hidden-hole { background: #fbe9a9; color: var(--gold); }
.sub { font-weight: 800; background: #f1f4f2; }
.under { color: #b42318; font-weight: 700; }

/* 成績輸入 */
.score-table input {
  width: 64px;
  min-height: 52px;
  padding: 4px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
}
.score-table th.player { min-width: 84px; white-space: normal; }
.pars input { width: 52px; min-height: 48px; padding: 4px; text-align: center; font-weight: 700; }

/* 登入頁 */
.login-wrap { max-width: 440px; margin: 8vh auto 0; text-align: center; }
.login-wrap h1 { font-size: 1.9rem; margin-bottom: 8px; }
.btn.line { background: #06c755; border-color: #06c755; font-size: 1.15rem; min-height: 60px; }
.btn.line:hover { background: #05b34c; border-color: #05b34c; }
.btn.google { background: #fff; color: var(--ink); border-color: #9aa59f; font-size: 1.15rem; min-height: 60px; }
.btn.google:hover { background: #f1f4f2; }
.stack > * + * { margin-top: 14px; }

.copy-box { display: flex; gap: 8px; }
.copy-box input { flex: 1; min-width: 0; font-size: .9rem; }

@media print {
  .topbar, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
}
