body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f1220;
  color: #eaeaf0;
  margin: 0;
  padding: 20px;
  overflow-x: hidden;
}

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #7F77DD, #c47fff, #60aaff, #7F77DD);
  background-size: 300% 100%;
  z-index: 99999;
  transition: width 0.3s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

#top-bar.running {
  opacity: 1;
  animation: top-bar-shimmer 1.5s linear infinite;
}

#top-bar.finishing {
  width: 100% !important;
  transition: width 0.2s ease, opacity 0.4s ease 0.25s;
  opacity: 0;
}

@keyframes top-bar-shimmer {
  0%   { background-position: 300% 0; }
  100% { background-position: 0% 0; }
}

h1, h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

h3 {
  font-size: 25px;
}

input, button {
  background: #1c2040;
  border: 1px solid #2f3470;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 4px 0;
  transition: background 0.3s;
}

button:hover {
  background: #2a2f60;
  cursor: pointer;
}

.box {
  background: #161932;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}

.box.visible {
  opacity: 1;
  transform: translateY(0);
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat {
  background: #1b1f40;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}

.stat.show {
  opacity: 1;
  transform: translateY(0);
}

table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  font-size: 18px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1c2040;
  font-size: 20px;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  transition: background .2s, opacity .35s ease, transform .35s ease;
  opacity: 0;
  transform: translateY(10px);
}

tbody tr td {
  border-top: 4px solid #0f1220;
}

tbody tr.group-mid td,
tbody tr.group-end td {
  border-top: none;
}

tbody tr.show {
  opacity: 1;
  transform: translateY(0);
}

tr:hover,
tr.group-hover {
  background: rgba(255, 255, 255, 0.05);
}

.pity-green  { background: rgba(0,   255, 160, 0.12); }
.pity-yellow { background: rgba(255, 210,  70, 0.14); }
.pity-red    { background: rgba(255,  80,  80, 0.16); }

.r2 { color: #9aa0a6; }
.r3 { color: #00ff9c; }
.r4 { color: #00c8ff; }
.r5 { color: #ffd54a; font-weight: bold; }
.r6 { color: #ff4d5a; font-weight: bold; text-shadow: 0 0 6px #ff4d5a; }

canvas {
  width: 100%;
  max-height: 280px;
  height: 280px;
  display: block;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: #141833;
  border: 1px solid #2f3470;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.filter-bar span {
  margin-right: 6px;
  color: #9aa0a6;
  font-size: 14px;
}

.filter-bar button {
  padding: 6px 12px;
  font-size: 14px;
  margin: 0;
}

.filter-bar button.active {
  background: #3a4090;
  border-color: #7F77DD;
  box-shadow: 0 0 8px rgba(90, 100, 255, .4);
}

.filter-bar button.filter-type {
  border-width: 1px;
  border-style: solid;
  font-weight: bold;
}

.filter-bar button.type-limited   { color: #ff4d5a; }
.filter-bar button.type-character { color: #c47fff; }
.filter-bar button.type-water     { color: #60aaff; }
.filter-bar button.type-regular   { color: #ffb93c; }

.filter-bar button.filter-type:hover,
.filter-bar button.filter-type.active {
  filter: brightness(1.3);
  box-shadow: 0 0 8px rgba(90, 100, 255, .2);
}

.db-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.db-buttons button {
  flex: 1;
  font-size: 14px;
}

.url-import {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.url-import input[type="text"] {
  flex: 1;
  margin: 0;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  box-sizing: border-box;
}

.url-import input[type="text"]::placeholder { color: #555a80; }

.url-import button {
  white-space: nowrap;
  padding: 0 14px;
  font-size: 14px;
  margin: 0;
  height: 36px;
  box-sizing: border-box;
}

.url-import button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #1c2040;
}

.file-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.profile-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.profiles {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profiles select {
  background: #1c2040;
  border: 1px solid #2f3470;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.profiles button { padding: 6px 10px; font-size: 14px; }

.side-buttons {
  display: flex;
  gap: 8px;
}

.side-btn {
  text-decoration: none;
  background: #1c2040;
  border: 1px solid #2f3470;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.3s;
}

.side-btn:hover { background: #2a2f60; }

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1c2040;
  border: 1px solid #2f3470;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  transform: translateX(400px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 350px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show          { opacity: 1; transform: translateX(0); }
.toast-success       { border-left: 4px solid #00ff9c; }
.toast-error         { border-left: 4px solid #ff4d5a; }
.toast-info          { border-left: 4px solid #00c8ff; }
.toast-warning       { border-left: 4px solid #ffd54a; }
.toast-success::before { content: '✅'; }
.toast-error::before   { content: '⚠️'; }
.toast-info::before    { content: 'ℹ️'; }
.toast-warning::before { content: '⚡'; }

.recent-six-stars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 16px;
  padding: 12px 8px;
  align-items: start;
  justify-items: center;
}


.recent-six-stars-placeholder {
  width: 100%;
  text-align: center;
  color: #9aa0a6;
  font-size: 16px;
  padding: 40px 20px;
}

.six-star-card {
  width: 100%;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.six-star-portrait {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #1b1f40;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.six-star-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.six-star-card:hover .six-star-portrait { transform: scale(1.05); }

.six-star-pity {
  position: absolute;
  top: 62px;
  right: calc(50% - 52px);
  color: white;
  font-weight: bold;
  font-size: 13px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.six-star-name {
  margin-top: 6px;
  font-size: 13px;
  text-align: center;
  color: #eaeaf0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.pity-color-green .six-star-portrait       { box-shadow: 0 0 16px rgba(0,   255, 160, 0.7); }
.pity-color-green:hover .six-star-portrait { box-shadow: 0 0 20px rgba(0,   255, 160, 0.8); }
.pity-color-green .six-star-pity           { background: rgba(0,   255, 160, 0.9); }

.pity-color-yellow .six-star-portrait       { box-shadow: 0 0 16px rgba(255, 210, 70, 0.7); }
.pity-color-yellow:hover .six-star-portrait { box-shadow: 0 0 20px rgba(255, 210, 70, 0.8); }
.pity-color-yellow .six-star-pity           { background: rgba(255, 210, 70, 0.9); }

.pity-color-red .six-star-portrait          { box-shadow: 0 0 16px rgba(255, 80,  80, 0.7); }
.pity-color-red:hover .six-star-portrait    { box-shadow: 0 0 20px rgba(255, 80,  80, 0.8); }
.pity-color-red .six-star-pity              { background: rgba(255, 80,  80, 0.9); }

.banner-type {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.type-character { background: rgba(180,100,255,.15); color: #c47fff; border: 1px solid rgba(180,100,255,.35); }
.type-limited   { background: rgba(255, 77, 90,.15); color: #ff4d5a; border: 1px solid rgba(255, 77, 90,.35); }
.type-water     { background: rgba( 80,160,255,.15); color: #60aaff; border: 1px solid rgba( 80,160,255,.35); }
.type-regular   { background: rgba(255,185, 60,.15); color: #ffb93c; border: 1px solid rgba(255,185, 60,.35); }
.type-other     { background: rgba(154,160,166,.15); color: #9aa0a6; border: 1px solid rgba(154,160,166,.35); }

.banner-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

#statsBox .banner-stats-row {
  margin-top: 16px;
  margin-bottom: 0;
}

.banner-stat-card {
  background: transparent;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}

.banner-stat-card.visible { opacity: 1; transform: translateY(0); }

.banner-stat-card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-stat-card-title .banner-type { font-size: 13px; padding: 3px 8px; }

.banner-stat-item {
  background: #1b1f40;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.banner-stat-item:last-child { margin-bottom: 0; }

.banner-stat-label,
.banner-stat-pity-label { font-size: 14px; color: #9aa0a6; display: flex; flex-direction: column; gap: 2px; }

.banner-stat-label .sub {
  font-size: 12px;
  color: #6b6f8a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.banner-stat-label .sub img { width: 16px; height: 16px; vertical-align: middle; }

.banner-stat-value { font-size: 28px; font-weight: 700; color: #eaeaf0; }

.banner-stat-pity-label .pity-hint { font-size: 12px; color: #6b6f8a; }

.banner-stat-pity-value             { font-size: 28px; font-weight: 700; }
.banner-stat-pity-value.pity-val-green  { color: #00ffa0; }
.banner-stat-pity-value.pity-val-yellow { color: #ffd54a; }
.banner-stat-pity-value.pity-val-red    { color: #ff4d5a; }

.banner-stat-empty {
  text-align: center;
  color: #6b6f8a;
  font-size: 14px;
  padding: 20px 0;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
}

.home-button {
  margin-left: auto;
  padding: 6px 14px;
  background-color: #1c2040;
  border: 1px solid #2f3470;
  color: #eaeaf0;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  transition: background 0.3s, color 0.3s;
}

.home-button:hover { background-color: #2a2f60; color: #ffffff; cursor: pointer; }

#scrollTopBtn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: #1c2040;
  border: 1px solid #2f3470;
  color: #eaeaf0;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s;
  pointer-events: none;
  z-index: 1000;
}

#scrollTopBtn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
#scrollTopBtn:hover   { background: #2a2f60; box-shadow: 0 0 12px rgba(90, 100, 255, 0.4); }

.group-bracket-empty {
  width: 28px;
  background: transparent !important;
}

.group-bracket {
  width: 28px;
  padding: 0 4px 0 2px;
  background: transparent !important;
  position: relative;
  vertical-align: middle;
  text-align: center;
}

.group-bracket::before {
  content: '';
  position: absolute;
  left: 0;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: #7F77DD;
}

.group-bracket.group-start::before {
  top: 0;
  border-radius: 2px 0 0 0;
}

.group-bracket.group-end::before {
  bottom: 0;
  border-radius: 0 0 0 2px;
}

.group-bracket span {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: bold;
  color: #7F77DD;
  letter-spacing: 1px;
  padding: 4px 0;
}

tr.group-hover {
  background: rgba(255, 255, 255, 0.07) !important;
}

.active-banners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.active-banner-card {
  background: #1b1f40;
  border: 1px solid #2f3470;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.active-banner-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.active-banner-type-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.active-banner-type-overlay .banner-type {
  background-color: rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.active-banner-img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #141833;
}

.active-banner-img-placeholder {
  width: 100%;
  aspect-ratio: 2 / 1;
  background: #141833;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.active-banner-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.active-banner-name {
  font-size: 14px;
  font-weight: 600;
  color: #eaeaf0;
  line-height: 1.3;
}

.active-banner-countdown {
  font-size: 13px;
  color: #9aa0a6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-banner-countdown-label {
  font-size: 11px;
  color: #6b6f8a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.active-banner-timer {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #eaeaf0;
}

.active-banner-timer.ending-soon { color: #ffd54a; }
.active-banner-timer.ending-very-soon { color: #ff4d5a; }

.active-banner-rate-up {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.active-banner-rate-up-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.active-banner-rate-up-chip.r6 { background: rgba(255, 77, 90, 0.12);  border-color: rgba(255, 77, 90, 0.35); }
.active-banner-rate-up-chip.r5 { background: rgba(255, 213, 74, 0.12); border-color: rgba(255, 213, 74, 0.35); }
.active-banner-rate-up-chip.r4 { background: rgba(0, 200, 255, 0.10);  border-color: rgba(0, 200, 255, 0.30); }
.active-banner-rate-up-chip.r3 { background: rgba(0, 255, 156, 0.10);  border-color: rgba(0, 255, 156, 0.25); }

.active-banner-expired {
  font-size: 13px;
  color: #6b6f8a;
  font-style: italic;
}

.version-footer {
  text-align: center;
  color: #6b6f8a;
  font-size: 13px;
  padding: 12px 0 4px;
}
