/* ポチバスノート - PochiBas Note CSS */
:root {
  --orange: #FF8C00;
  --orange-light: #FFA500;
  --orange-dark: #CC7000;
  --blue: #004E89;
  --blue-light: #006BB3;
  --green: #2ECC71;
  --green-dark: #25A25A;
  --gray-bg: #F5F5F5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Hiragino Kaku Gothic Pro', 'ヒラギノ角ゴ Pro', 'Yu Gothic', '游ゴシック', 'Meiryo', 'メイリオ', sans-serif;
  background: #F0F2F5;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  padding: 12px 16px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo .ball-icon {
  font-size: 28px;
}

.app-logo h1 {
  font-size: 20px;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.5px;
}

.app-logo .subtitle {
  font-size: 10px;
  opacity: 0.85;
  margin: 0;
}

/* ===== NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  border-top: 2px solid #E5E7EB;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  color: #9CA3AF;
  font-size: 10px;
  gap: 2px;
}

.nav-item i { font-size: 18px; }

.nav-item.active {
  color: var(--orange);
}

.nav-item.active i { color: var(--orange); }

/* ===== MAIN CONTENT ===== */
.main-content {
  padding: 16px;
  padding-bottom: 80px;
  min-height: calc(100vh - 60px);
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 4px 12px rgba(255,140,0,0.3);
}

.btn-primary:hover { background: var(--orange-dark); }

.btn-secondary {
  background: var(--blue);
  color: white;
  box-shadow: 0 4px 12px rgba(0,78,137,0.2);
}

.btn-success {
  background: var(--green);
  color: white;
  box-shadow: 0 4px 12px rgba(46,204,113,0.3);
}

.btn-success:hover { background: var(--green-dark); }

.btn-danger {
  background: #EF4444;
  color: white;
}

.btn-outline {
  background: white;
  border: 2px solid var(--orange);
  color: var(--orange);
}

.btn-gray {
  background: #F3F4F6;
  color: #374151;
}

.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.btn-full { width: 100%; }
.btn-round { border-radius: 50px; }

/* ===== FORM ===== */
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: #6B7280;
  margin-bottom: 4px;
  display: block;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.form-input:focus { border-color: var(--orange); }

/* ===== QUARTER TABS ===== */
.quarter-tabs {
  display: flex;
  background: #F3F4F6;
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
  margin-bottom: 16px;
}

.quarter-tab {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #6B7280;
  transition: all 0.2s;
}

.quarter-tab.active {
  background: var(--orange);
  color: white;
  box-shadow: 0 2px 8px rgba(255,140,0,0.3);
}

/* ===== SCORE DISPLAY ===== */
.score-board {
  background: linear-gradient(135deg, var(--blue) 0%, #005FA3 100%);
  border-radius: 20px;
  padding: 20px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}

.score-board::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.score-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 8px 0;
}

.score-team {
  flex: 1;
  text-align: center;
}

.score-team-name {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.score-value {
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.score-divider {
  font-size: 36px;
  font-weight: 300;
  opacity: 0.6;
}

/* ===== TIMER ===== */
.timer-display {
  background: #1A1A2E;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

.timer-value {
  font-size: 48px;
  font-weight: 900;
  color: #FFD700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
}

.timer-quarter {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

.timer-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.timer-btn {
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-align: center;
}

.timer-btn:active { transform: scale(0.94); }

.timer-btn-time { background: #1A1A2E; color: #FFD700; border: 1px solid #333; }
.timer-btn-control { background: var(--orange); color: white; }

/* ===== PLAYER GRID ===== */
.player-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.player-btn {
  padding: 12px 8px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  border: 2px solid #E5E7EB;
  background: white;
  transition: all 0.2s;
  position: relative;
}

.player-btn:active { transform: scale(0.95); }

.player-btn.selected {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
  box-shadow: 0 4px 12px rgba(255,140,0,0.3);
}

.player-num {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.player-name {
  font-size: 10px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== ACTION BUTTONS ===== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.action-btn {
  padding: 14px 8px;
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  border: none;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.action-btn:active { transform: scale(0.95); }

.action-btn i { font-size: 20px; }

.action-shot { background: #FFF3E0; color: #E65100; }
.action-shot.selected { background: #E65100; color: white; }
.action-reb { background: #E8F5E9; color: #2E7D32; }
.action-reb.selected { background: #2E7D32; color: white; }
.action-ast { background: #E3F2FD; color: #1565C0; }
.action-ast.selected { background: #1565C0; color: white; }
.action-stl { background: #F3E5F5; color: #6A1B9A; }
.action-stl.selected { background: #6A1B9A; color: white; }
.action-blk { background: #E0F7FA; color: #00695C; }
.action-blk.selected { background: #00695C; color: white; }
.action-to { background: #FFEBEE; color: #B71C1C; }
.action-to.selected { background: #B71C1C; color: white; }
.action-foul { background: #FFF8E1; color: #F57F17; }
.action-foul.selected { background: #F57F17; color: white; }

/* ===== COURT MAP ===== */
.court-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.court-svg {
  width: 100%;
  border-radius: 12px;
  cursor: crosshair;
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.shot-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: 2px solid white;
  opacity: 0.9;
}

.shot-dot.make { background: #22C55E; }
.shot-dot.miss { background: #EF4444; }

/* ===== STATS TABLE ===== */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.stats-table th {
  background: #F3F4F6;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
  color: #374151;
  font-size: 11px;
  white-space: nowrap;
}

.stats-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid #F3F4F6;
  color: #374151;
  white-space: nowrap;
}

.stats-table tr:last-child td { border-bottom: none; }
.stats-table tr:hover td { background: #FFF8F0; }

.stats-table td.player-col {
  text-align: left;
  font-weight: 700;
}

.stats-highlight { color: var(--orange); font-weight: 700; }

/* ===== RESULT BADGE ===== */
.result-btn {
  flex: 1;
  padding: 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-btn:active { transform: scale(0.96); }
.result-make { background: #DCFCE7; color: #166534; }
.result-make:hover, .result-make.selected { background: #22C55E; color: white; box-shadow: 0 4px 16px rgba(34,197,94,0.4); }
.result-miss { background: #FEE2E2; color: #991B1B; }
.result-miss:hover, .result-miss.selected { background: #EF4444; color: white; box-shadow: 0 4px 16px rgba(239,68,68,0.4); }

/* ===== GAME HISTORY ===== */
.game-history-item {
  background: white;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.game-history-item:hover { border-left-color: var(--orange); transform: translateX(2px); }
.game-history-item.win { border-left-color: var(--green); }
.game-history-item.loss { border-left-color: #EF4444; }
.game-history-item.draw { border-left-color: #9CA3AF; }

/* ===== STEP INDICATOR ===== */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  background: #F9FAFB;
  border-radius: 12px;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.3s;
}

.step-dot.active { background: var(--orange); color: white; box-shadow: 0 2px 8px rgba(255,140,0,0.4); }
.step-dot.done { background: var(--green); color: white; }
.step-dot.pending { background: #E5E7EB; color: #9CA3AF; }

.step-line {
  flex: 1;
  height: 2px;
  background: #E5E7EB;
  border-radius: 1px;
  max-width: 40px;
}

.step-line.done { background: var(--green); }

/* ===== MEMO ===== */
.memo-category-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.memo-category-btn.active {
  border-color: currentColor;
  background: currentColor;
  color: white !important;
}

.memo-item {
  background: #F9FAFB;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--orange);
  font-size: 13px;
}

/* ===== HEATMAP ===== */
.heatmap-cell {
  transition: all 0.3s;
  cursor: default;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}

.modal-overlay.center {
  align-items: center;
  padding: 16px;
}

.modal-panel {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-panel.center {
  border-radius: 20px;
  max-width: 480px;
  margin: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  margin: -12px auto 16px;
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-orange { background: #FFF3E0; color: #E65100; }
.badge-blue { background: #E3F2FD; color: #1565C0; }
.badge-green { background: #E8F5E9; color: #2E7D32; }
.badge-red { background: #FFEBEE; color: #B71C1C; }
.badge-gray { background: #F3F4F6; color: #374151; }

/* ===== ANIMATIONS ===== */
@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,0,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255,140,0,0); }
}

.recording { animation: pulse-orange 1.5s infinite; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1F2937;
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 220px;
}

.toast.success { background: var(--green-dark); }
.toast.error { background: #DC2626; }
.toast.info { background: var(--blue); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9CA3AF;
}

.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; margin: 4px 0; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 2px; }

/* ===== PDF PRINT ===== */
@media print {
  .bottom-nav, .app-header, .no-print { display: none !important; }
  .main-content { padding: 0; }
  body { background: white; }
}

/* ===== MODE TOGGLE ===== */
.mode-toggle {
  display: flex;
  background: #F3F4F6;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #6B7280;
  transition: all 0.2s;
}

.mode-btn.active { background: white; color: #374151; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

/* ===== PROGRESS BAR ===== */
.stat-bar-bg { background: #E5E7EB; height: 6px; border-radius: 3px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

/* Player delete button */
.player-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #EF4444;
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid white;
  opacity: 0;
  transition: opacity 0.2s;
}

.player-btn:hover .player-delete { opacity: 1; }

/* Confirm dialog */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
