/* Shared design for every page (tier list, checklists, tools).
 * Page files only add their own components on top of this. */

:root {
  --bg: #07060d;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f0fb;
  --muted: #9b98b6;
  --faint: #6b6886;
  --accent: #a855f7;
  --accent-2: #ec4899;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --danger: #f43f5e;
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(168, 85, 247, 0.20), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(34, 211, 238, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Buttons ===== */

button, input, textarea, select {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

button:hover { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(168, 85, 247, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
button:active { transform: scale(0.97); }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }

.btn-ghost, button.ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
}

.btn-ghost:hover, button.ghost:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  box-shadow: none;
}

.btn-danger, button.danger {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  box-shadow: none;
}

.btn-danger:hover, button.danger:hover { background: rgba(244, 63, 94, 0.22); box-shadow: none; }

.btn-success {
  background: linear-gradient(135deg, #10b981, var(--cyan));
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.25);
}

.btn-small, button.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }

.btn-icon { width: 44px; padding: 0; font-size: 18px; }

.link-btn {
  min-height: 28px;
  padding: 0 4px;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.link-btn:hover { color: var(--text); box-shadow: none; filter: none; }

/* ===== Fields ===== */

input, textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-size: 16px; /* 16px stops iOS from zooming on focus */
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: text;
  -webkit-user-select: text;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

input:focus, textarea:focus, select:focus {
  border-color: rgba(168, 85, 247, 0.7);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.16);
}

textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%239b98b6' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

select option { background: #15121f; color: var(--text); }

input[type="search"]::-webkit-search-cancel-button { filter: invert(0.7); }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

label { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ===== Layout ===== */

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 120px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.eyebrow, .section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

.empty { color: var(--faint); font-size: 14px; }

.status { min-height: 18px; font-size: 13px; color: var(--amber); text-align: center; }

.pill {
  display: inline-block;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Segmented control: tool tabs, list tabs */
.segmented {
  display: flex;
  gap: 4px;
  padding: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.segmented::-webkit-scrollbar { display: none; }

.segmented > button {
  flex-shrink: 0;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  box-shadow: none;
}

.segmented > button:hover { color: var(--text); background: var(--surface-2); box-shadow: none; filter: none; }

.segmented > button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.9), rgba(236, 72, 153, 0.85));
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
}

/* Progress bar */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 0.35s ease;
}

/* ===== Top bar ===== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 6, 13, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-right: auto;
}

.logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border-strong), 0 6px 18px rgba(168, 85, 247, 0.35);
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: linear-gradient(90deg, #fff, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.nav button { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

/* ===== Modals ===== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  background: rgba(3, 2, 8, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 8vh auto 0;
  padding: 24px;
  background: linear-gradient(180deg, rgba(30, 24, 46, 0.96), rgba(16, 13, 26, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.22s ease-out;
}

.modal-content h2 { margin: 0 40px 18px 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.modal-content h3 { margin: 22px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  box-shadow: none;
}

.close:hover { color: var(--text); background: var(--surface-3); box-shadow: none; }

.row { display: flex; gap: 10px; }
.row > input { flex: 1; }

.muted { color: var(--faint); font-style: italic; }

/* ===== Login ===== */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(700px 400px at 50% 0%, rgba(168, 85, 247, 0.25), transparent 70%),
    rgba(5, 4, 10, 0.96);
}

.auth-panel {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  text-align: center;
  background: linear-gradient(180deg, rgba(30, 24, 46, 0.96), rgba(16, 13, 26, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.auth-panel img { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 16px; object-fit: cover; }
.auth-panel h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.auth-error { color: #fb7185; font-size: 14px; }
.auth-error:empty { display: none; }

/* ===== Motion ===== */

@keyframes modalIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Phones ===== */

@media (max-width: 640px) {
  .app { padding: 14px 12px 110px; }
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .logo { width: 34px; height: 34px; border-radius: 10px; }
  h1 { font-size: 17px; }
  .nav { gap: 6px; }
  .nav button { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .nav .label { display: none; }

  .modal { padding: 0; }
  .modal-content {
    max-width: none;
    min-height: 100%;
    margin: 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 0;
    border: 0;
  }
}

/* Deployed build version, bottom-right */
.app-version {
  position: fixed;
  right: 8px;
  bottom: 4px;
  z-index: 3000;
  font: 10px/1.2 var(--font);
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}
