:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --text: #1d1d1f;
  --muted: #86868b;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --border: #d2d2d7;
  --radius: 12px;
  --accent-ok: #34c759;
  --accent-warn: #ff3b30;
  --nav-height: 64px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  justify-content: center;
  line-height: 1.4;
  padding-bottom: var(--nav-height);
}

.app-container {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  min-height: calc(100vh - var(--nav-height));
}

h1 { font-size: 24px; font-weight: 700; margin: 8px 0; text-align: center; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.muted { color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 16px; }

.field-group { margin-bottom: 16px; }
label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

input, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 16px;
  background: #fafafa;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.row > * { flex: 1; min-width: 120px; }

button {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:active { transform: scale(0.98); }
button.primary { background: var(--primary); color: #fff; border: none; }
button.secondary { background: #f0f0f2; color: var(--text); border: none; }
button.ghost { border: none; background: transparent; color: var(--primary); font-size: 13px; padding: 8px; }

.tab-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-btn {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  padding: 0;
}
.tab-btn.active { color: var(--primary); }
.tab-btn span { font-size: 20px; }

.game-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.stat-pill {
  background: #f0f0f2;
  padding: 8px;
  border-radius: 10px;
  text-align: center;
}
.stat-label { font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 16px; font-weight: 700; display: block; }
.stat-value.big { font-size: 28px; color: var(--primary); }

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}
.status-badge.ok { background: var(--accent-ok); color: #fff; }
.status-badge.warn { background: var(--accent-warn); color: #fff; }

.grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 12px; }
.input-item label { margin-bottom: 4px; color: var(--text); }

    .answers {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f8f8f8;
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
}

.compare-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px;
  border: 1px solid var(--border);
  text-align: left;
  min-width: 100px;
}

th {
  background: #f0f0f2;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
}

.my-col { background: #f3f9ff; }

.import-toast {
  background: var(--accent-ok);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
  animation: fadeIn 0.3s;
}

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

.hidden { display: none !important; }
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.settings-toggle {
  text-align: center;
  margin: 8px 0;
}

.player-list { margin-top: 16px; padding: 12px; border-radius: 8px; background: #f8f9fa; border: 1px solid #eee; }
.player-list h3 { margin: 0 0 8px; font-size: 14px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; text-align: left; }
.player-tag { display: inline-block; background: #e9ecef; padding: 4px 10px; border-radius: 20px; font-size: 13px; margin: 2px; border: 1px solid #dee2e6; color: var(--text); }
.player-tag.online { border-color: var(--accent-ok); background: #e8f5e9; }

/* SEO & Instructions */
.seo-section { margin-top: 32px; padding: 16px; border-top: 1px solid var(--border); color: var(--text); }
.seo-section h2 { font-size: 20px; text-align: center; margin-bottom: 16px; color: var(--primary); }
.seo-section p { font-size: 14px; color: var(--muted); text-align: center; line-height: 1.6; margin-bottom: 24px; }
.instruction-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.step-icon { font-size: 20px; }
.marketing-blurb { background: #fff; padding: 16px; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.marketing-blurb h3 { font-size: 16px; margin-bottom: 12px; color: var(--text); }
.marketing-blurb ul { padding-left: 20px; margin: 0; }
.marketing-blurb li { font-size: 13px; margin-bottom: 8px; color: var(--muted); }

@media (min-width: 480px) {
  body { padding: 40px 0 calc(40px + var(--nav-height)); }
  .tab-bar { border-radius: 20px 20px 0 0; }
}
