:root {
  --bg: #0b0e14;
  --bg-card: #131824;
  --bg-card-hover: #161d2c;
  --border: #232938;
  --text: #e8ecf4;
  --text-dim: #8891a5;
  --accent: #ff4d4d;
  --accent-2: #ffb020;
  --success: #33d17a;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1030 0%, var(--bg) 55%);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* Nav */
#nav {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  width: 38px;
  height: 38px;
  margin-left: auto;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.nav-links {
  display: flex;
  gap: 18px;
  flex: 1;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-dim);
  font-size: 0.92rem;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav-user {
  color: var(--text-dim);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.92rem;
  padding: 0;
}

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.container.narrow {
  max-width: 460px;
}

.card,
.boss-card,
.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h1,
.boss-card h1 {
  margin-top: 0;
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-top: -8px;
}

/* Announcement */
.announcement {
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.15), rgba(255, 176, 32, 0.05));
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.95rem;
}

/* Boss card */
.boss-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.boss-header h1 {
  font-size: 1.8rem;
}

.status-badge {
  background: var(--success);
  color: #06210f;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.flavor {
  color: var(--text-dim);
  margin-top: -6px;
}

.hp-bar-wrap {
  margin: 20px 0;
}

.hp-bar-track {
  background: #1a1f2c;
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 34px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 18px rgba(255, 77, 77, 0.55);
  transition: width 0.8s ease;
  border-radius: 999px 0 0 999px;
}

.hp-bar-fill.low {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

.hp-numbers {
  text-align: center;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stat {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cta-row {
  text-align: center;
}

/* Activity feed */
.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.activity-feed li {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.activity-user {
  font-weight: 700;
}

.activity-damage {
  color: var(--accent);
  font-weight: 700;
}

.activity-type {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.activity-time {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.empty {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  background: #0f131c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
}

.code-area {
  width: 100%;
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #1a0505;
}

.btn-secondary {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.danger-zone {
  border-color: rgba(255, 77, 77, 0.4);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.92rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Table */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.damage-cell {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Result / messages */
.result-card {
  text-align: center;
  padding: 20px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.result-damage {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
}

.victory {
  color: var(--success);
  font-weight: 700;
}

.error {
  color: var(--accent);
  font-size: 0.88rem;
}

.msg {
  font-size: 0.88rem;
}

.msg.success {
  color: var(--success);
}

.msg.error {
  color: var(--accent);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.4);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-links a {
    padding: 12px 4px;
    width: 100%;
    border-bottom: 1px solid var(--border);
  }

  .nav-auth {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding-top: 12px;
  }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 20px 16px 48px;
  }

  .card,
  .boss-card,
  .activity-card {
    padding: 18px;
  }
}
