:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --text: #1a1a2e;
  --subtle: #4a5568;
  --green: #1a6b3c;
  --green-dark: #0d3b1f;
  --gold: #c8a84e;
  --danger: #8b1e1e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #e8efe9 0%, var(--bg) 35%, var(--bg) 100%);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.hero h1 { margin: 0 0 8px; color: var(--green-dark); }
.hero p { margin: 0 0 18px; color: var(--subtle); }
.portal-home-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}
.portal-home-link:hover,
.portal-home-link:focus {
  color: var(--green-dark);
  text-decoration: underline;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(13, 59, 31, 0.08);
}

.hint { color: var(--subtle); font-size: 14px; }
.hidden { display: none !important; }

.form label { display: block; margin-bottom: 10px; font-size: 14px; }
.form input {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid #cfd8d3;
  border-radius: 10px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #e8efe9;
  color: var(--green-dark);
}
.btn.primary { background: var(--gold); color: var(--green-dark); }
.btn.danger { background: #f6d7d7; color: var(--danger); }
.btn[href] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn.current-response {
  outline: 2px solid rgba(26, 107, 60, 0.4);
  box-shadow: 0 0 0 2px rgba(26, 107, 60, 0.08);
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn.linkish {
  background: transparent;
  color: var(--green);
  text-decoration: underline;
  padding: 6px 0 8px;
  border-radius: 0;
  text-align: left;
}

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { background: #eef3ef; }
.tab.active { background: var(--green); color: white; }
.portal-tabs {
  margin-bottom: 0;
}
.portal-tabs .tab {
  flex: 1;
}
.portal-tabs-card {
  padding: 10px;
}

.notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #eef5ef;
  border-left: 4px solid var(--green);
}
.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}
.invite-fallback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f8f6;
  border: 1px solid #dbe7df;
}
.invite-fallback p {
  margin: 0;
}
.invite-fallback p + p {
  margin-top: 8px;
}
.invite-open-status {
  color: var(--green-dark);
  font-size: 15px;
}
.invite-open-status.error {
  color: var(--danger);
}
.notice p { margin: 6px 0 10px; }
.skill-summary {
  margin-top: 10px;
  background: #eef6f2;
}
.skill-summary p {
  margin: 6px 0 0;
}
.skill-report {
  margin-top: 12px;
}
.table-wrap {
  overflow-x: auto;
}
.skill-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #d9e2dc;
  border-radius: 10px;
  overflow: hidden;
}
.skill-table th,
.skill-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #ecf1ed;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}
.skill-table th {
  background: #f3f7f4;
  color: var(--green-dark);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.playdate {
  border: 1px solid #d9e2dc;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.playdate h3 { margin: 0 0 4px; }
.playdate p { margin: 0; color: var(--subtle); font-size: 13px; }
.playdate-status {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
}
.playdate-status.in { color: #0d3b1f; }
.playdate-status.out { color: #8b1e1e; }
.playdate-status.pending { color: #6b5a25; }

.actions { display: flex; gap: 8px; margin: 10px 0; }
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-loading {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 140px;
}
.golf-spinner {
  position: relative;
  width: 84px;
  height: 64px;
}
.golf-spinner .flag {
  position: absolute;
  left: 44px;
  top: 4px;
  width: 3px;
  height: 34px;
  background: #2f5b38;
  transform-origin: top center;
  animation: flag-sway 1.2s ease-in-out infinite;
}
.golf-spinner .flag::before {
  content: "";
  position: absolute;
  top: 0;
  left: 3px;
  width: 20px;
  height: 10px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}
.golf-spinner .ball {
  position: absolute;
  bottom: 6px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #e9f0ec 70%);
  box-shadow: inset 0 0 0 1px #cfd8d3, 0 4px 8px rgba(20, 40, 26, 0.15);
  animation: golf-roll 1.1s ease-in-out infinite;
}
@keyframes golf-roll {
  0% { transform: translateX(0) translateY(0) scale(1); }
  50% { transform: translateX(50px) translateY(-3px) scale(1.02); }
  100% { transform: translateX(0) translateY(0) scale(1); }
}
@keyframes flag-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(3deg); }
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}
.stat-tile {
  border: 1px solid #d9e2dc;
  border-radius: 12px;
  padding: 10px;
  background: #f9fcfa;
}
.stat-tile .label {
  color: var(--subtle);
  font-size: 12px;
}
.stat-tile .value {
  display: block;
  margin-top: 6px;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 800;
}
.stats-list .playdate {
  align-items: flex-start;
}
.live-toolbar {
  margin-top: 8px;
  margin-bottom: 10px;
  align-items: flex-end;
}
.live-select-wrap {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--subtle);
}
.live-select-wrap select {
  min-width: 260px;
  border: 1px solid #cfd8d3;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}
.live-board {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 10px;
  background: #99c9b8;
  border-radius: 16px;
  padding: 12px;
  width: max-content;
  min-width: 1120px;
}
.live-row-label {
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6px;
  padding-right: 4px;
}
.live-row-label.player {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
.live-row-grid {
  display: grid;
  grid-template-columns: repeat(18, 48px);
  gap: 8px;
}
.live-cell {
  height: 38px;
  border: 1px solid #8ea79f;
  background: #fff;
  border-radius: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 19px;
}
.live-cell.head {
  border: 0;
  background: transparent;
  color: #12121a;
  font-size: 28px;
  font-weight: 800;
}
.live-cell.par-row {
  background: #5ca8cc;
  color: #0d2231;
}
.live-score-cell {
  position: relative;
  height: 38px;
  border: 1px solid #8ea79f;
  background: #fff;
  display: grid;
  place-items: center;
}
.live-score-number {
  position: relative;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid transparent;
  font-weight: 800;
  font-size: 19px;
  line-height: 1;
  color: #12121a;
}
.live-score-number.empty {
  border: 0;
  color: #7d8898;
}
.live-score-number.par { color: #1f7fda; }
.live-score-number.birdie { color: #eb4242; }
.live-score-number.eagle { color: #2467d6; }
.live-score-number.special { color: #a77707; }
.live-score-number.over { color: #111; }
.live-score-number.ring-birdie { border-color: #ff3e46; }
.live-score-number.ring-eagle { border-color: #2b62e1; }
.live-score-number.ring-special { border-color: #d9a82a; background: rgba(217, 168, 42, 0.2); }
.bogey-dots {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  color: #111;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}
.bogey-dots.two {
  letter-spacing: 0;
}
.triple-bar {
  position: absolute;
  top: 3px;
  left: 8px;
  right: 8px;
  height: 5px;
  border-radius: 5px;
  background: #7a4ecf;
}
ul { margin: 8px 0 0; padding-left: 18px; }
li { margin-bottom: 6px; }

.status {
  min-height: 22px;
  font-size: 14px;
  color: var(--green-dark);
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .container { padding: 14px; }
  .hero h1 { font-size: 30px; line-height: 1.1; }
  .hero p { font-size: 15px; }
  .card { padding: 12px; }
  h2 { font-size: 32px; line-height: 1.15; }
  h3 { font-size: 18px; line-height: 1.2; }
  .hint { font-size: 13px; }
  .btn { font-size: 14px; padding: 9px 12px; }
  .playdate h3 { font-size: 22px; }
  .playdate p { font-size: 14px; }
  .skill-table th,
  .skill-table td { font-size: 12px; padding: 7px 8px; }
  .columns { grid-template-columns: 1fr; gap: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
  .live-select-wrap select { min-width: 220px; }
  .live-board { grid-template-columns: 140px 1fr; }
  .live-row-label.player { font-size: 12px; }
  .invite-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
