@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@400;500;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --base-bg: #fffef9;
  --text-color: #333;
  --main-pink: #ffaaa5;
  --soft-pink: #ffd3b6;
  --main-green: #a8e6cf;
  --soft-green: #dcedc1;
  --accent-red: #BF2A27;
  --border-color: #ead8c0;
  --soft-yellow: #fff9e6;
  --main-yellow: #DDBE4D;
}

body {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 500;
  font-style: normal;
  background-color: var(--base-bg);
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
  padding: 20px;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
}

h1,
h2,
h3,
h4 {
  color: var(--accent-red);
  text-align: center;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
}

h1 {
  font-size: 2rem;
  margin-bottom: 30px;
  position: relative;
  display: inline-block;
  width: 100%;
}

h2 {
  max-width: 1200px;
  margin: auto;
}

h3 {
  color: var(--accent-red) !important;
}

h5 {
  border-left: 6px solid var(--accent-red);
  padding-left: 6px;
  font-size: 1rem;
}

a {
  color: #004AAD;
}


header {
  width: 100%;
}

@media (max-width: 768px) {
  header>div>div {
    flex-direction: column;
  }

  header h1 img {
    width: 80%;
    max-width: 200px;
  }
}


@media (min-width: 769px) {
  header h1 {
    text-align: left !important;
  }

  header>div>div {
    margin-bottom: 0 !important;
  }

  header h1 a {
    display: flex;
    width: fit-content;
  }

  header h1 img {
    width: 210px;
  }
}

.main-search-section {
  background-color: var(--soft-yellow) !important;
  border: 2px solid #ffeeba;
  max-width: 860px;
  margin: 20px auto !important;
}

.main-search-section input[type="text"i] {
  border: solid 2px var(--border-color) !important;
}

.main-search-section h3 {
  margin-top: 0 !important;
}


.filter-controls,
.login-prompt,
.chara-event-section,
.ranking-selector-container,
#ranking-content,
.ranking-preview-section,
.rankings-grid {
  max-width: 1200px;
  margin: 0 auto 3em !important;
}


nav {
  background: white;
  padding: 15px;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  text-align: center;
  font-weight: 500;
  min-width: 310px;
  justify-content: space-between;
}

nav a {
  color: var(--accent-red);
  text-decoration: none;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background 0.3s;
}

nav a:hover {
  background: var(--soft-pink);
}

.flash {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  padding: 30px 20px;
  max-width: 1200px;
  margin: 3em auto;
}

.flash.success {
  background-color: #e2f7f0;
  color: #2d6a4f;
  border: 2px solid var(--main-green);
}

.flash.warning {
  background-color: #fff9e6;
  color: #856404;
  border: 2px solid var(--soft-pink);
}

.flash.error {
  background-color: #ffeef0;
  color: #a4161a;
  border: 2px solid var(--accent-red);
}

/* Filter Controls */
.filter-controls {
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 3em !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.filter-input,
.filter-select {
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--main-pink);
}

#regionFilter {
  background-color: var(--accent-red);
  color: #fff;
  font-size: 1rem;
}

.filter-input {
  flex: 1;
}

.syllabary-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.syllabary-btn {
  padding: 8px 15px;
  border: 2px solid var(--border-color);
  background: white;
  color: var(--accent-red);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.3s;
}

.syllabary-btn:hover,
.syllabary-btn.active {
  background: var(--accent-red);
  color: white;
  border-color: var(--accent-red);
  transform: scale(1.05);
}

.login-prompt {
  border: 2px solid #ffeeba !important;
  background-color: var(--soft-yellow) !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* CharaEvent Section */
.chara-event-section {
  margin: 3em 0;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.chara-event-section>p {
  text-align: center;
}

.event-header {
  background: var(--accent-red);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 15px;
  position: relative;
  color: #fff;
}

.event-logo {
  max-height: 80px;
  width: auto;
  max-width: 90%;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.chara-event-section h3 {
  font-size: 1.6rem;
  margin: 0;
  color: #fff !important;
}

@media (max-width: 600px) {
  .event-header {
    padding: 15px;
  }

  .event-logo {
    max-height: 60px;
  }

  .event-header::before,
  .event-header::after {
    font-size: 1.4rem;
  }
}

/* Character List */
.character-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.character-card {
  background: #ffffff;
  border: 2px solid #ffefe0;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.character-card:hover {
  transform: translateY(-8px);
  border-color: var(--soft-pink);
}

.character-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
}

.character-card h4 {
  margin: 10px 0 5px 0;
  color: var(--text-color);
  font-size: 1.1rem;
}

.character-card p {
  font-size: 0.9rem;
  color: var(--text-color);
  margin-bottom: 15px;
  flex-grow: 1;
  text-align: left;
}

/* Buttons */
.btn-vote {
  background: linear-gradient(135deg, var(--main-green) 0%, var(--soft-green) 100%);
  color: #2d6a4f;
  font-weight: 700;
  border-radius: 50px;
  border: none;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #89cfae;
  font-family: inherit;
  transition: all 0.2s;
  max-width: 500px;
  margin: 3em auto;
}

.btn-vote:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #89cfae;
}

.btn-vote:active {
  box-shadow: none;
  transform: translateY(4px);
}

.btn-voted {
  background: #eee;
  color: #aaa;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-voted:hover {
  transform: none;
  box-shadow: none;
}


/* Back Links */
.back-to-top-container {
  text-align: center;
  margin: 30px 0;
}

.back-to-top-link {
  display: inline-flex;
  align-items: center;
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 50px;
  background-color: #f0f0f0;
  transition: all 0.2s;
}

.back-to-top-link:hover {
  background-color: var(--soft-pink);
  color: var(--accent-red);
  transform: translateX(-5px);
}

.back-to-top-link::before {
  content: '←';
  margin-right: 8px;
}

/* Form Styles */
.form-container {
  max-width: 500px;
  margin: 30px auto;
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 2px solid var(--border-color);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--accent-red);
}

.form-group select,
.form-group input {
  width: 100%;
  box-sizing: border-box;
}

/* フィルタリング用の非表示クラス */
.hidden {
  display: none !important;
}

/* Ranking Page */
.ranking-list {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

@media (min-width: 768px) {
  .ranking-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  .ranking-item {
    padding: 10px;
  }
}

.ranking-item {
  display: flex;
  align-items: center;
  background: white;
  padding: 15px;
  border-radius: 12px;
  border: 2px solid #ffefe0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  height: 100%;
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-red);
  min-width: 40px;
  width: auto;
  text-align: center;
  margin-right: 15px;
  white-space: nowrap;
}

.ranking-item img {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: contain;
  background-color: #f8f9fa;
  margin-right: 15px;
  border: 1px solid #eee;
}

.ranking-info {
  flex-grow: 1;
  min-width: 0;
}

.ranking-name {
  font-weight: 700;
  font-size: 1.1rem;
  word-break: break-all;
  line-height: 1.3;
}

.ranking-votes {
  color: #888;
  font-size: 0.9rem;
}

/* Banner Slider */
.banner-slider {
  overflow: hidden;
  width: 100%;
  background: white;
  padding: 15px 0;
  margin-bottom: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.banner-track {
  display: flex;
  width: fit-content;
  animation: scroll 40s linear infinite;
}

.banner-item {
  flex: 0 0 auto;
  height: 60px;
  /* 縦幅を固定 */
  margin: 0 10px;
}

.banner-item img {
  height: 100%;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  /* アスペクト比を維持しつつ枠内に収める */
  border-radius: 6px;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }

  /* 複製分があるため-50%で一周 */
}

/* ホバー時に停止 */
.banner-slider:hover .banner-track {
  animation-play-state: paused;
}

/* Ranking Selector UI */
.ranking-selector-container {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.ranking-selector {
  display: flex;
  overflow-x: auto;
  gap: 20px;
  padding: 10px 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--soft-pink) transparent;
}

.ranking-selector::-webkit-scrollbar {
  height: 6px;
}

.ranking-selector::-webkit-scrollbar-thumb {
  background-color: var(--soft-pink);
  border-radius: 10px;
}

.selector-item {
  flex: 0 0 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid transparent;
}

.selector-item.active {
  border-color: var(--accent-red);
  background: white;
  box-shadow: 0 4px 15px rgba(230, 57, 70, 0.1);
}

.selector-item.active span {
  color: var(--accent-red);
}

.selector-img-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--main-yellow);
  overflow: hidden;
  margin-bottom: 10px;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.selector-item.active .selector-img-wrapper {
  border-color: var(--main-yellow);
  box-shadow: none;
}

.selector-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selector-item span {
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.selector-item .badge {
  position: absolute;
  top: -5px;
  left: 50%;
  background: #ccc;
  color: white;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 10px;
  z-index: 1;
  background-color: var(--accent-red);
  width: 3rem;
  transform: translateX(-50%);
}

.selector-item .badge.active {
  background: var(--accent-red);
}

.ranking-pane h1 {
  margin-bottom: 30px;
  font-size: 1.4rem;
}

.ranking-pane h1::before {
  content: "";
}

.no-image-rank {
  width: 60px;
  height: 60px;
  background: #eee;
  border-radius: 12px;
  margin-right: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #999;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #999;
  font-style: italic;
}

.character-card.favorite {
  border: 3px solid var(--main-pink);
  background: #fff9f9;
}

.character-list-container h4 {
  background: var(--soft-yellow);
  color: var(--accent-red);
  padding: 10px 0;
  border-radius: 6px;
  margin: 0;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  .character-list-container h4 {
    font-size: clamp(15px, 4.8vw, 18px) !important;
  }
}

.region-separator {
  grid-column: 1 / -1;
  padding: 5px 15px;
  font-size: 1rem;
  width: auto !important;
  text-align: center;
  position: relative;
  background-color: var(--soft-yellow);
  border-top: 1px dotted var(--accent-red) !important;
  border-bottom: 1px dotted var(--accent-red) !important;
}

.region-separator strong {
  color: var(--accent-red) !important;
}


/* Medal styles */
.medal {
  font-size: 1.4rem;
  margin-right: 5px;
  vertical-align: middle;
}

.medal.gold {
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.medal.silver {
  text-shadow: 0 0 5px rgba(192, 192, 192, 0.5);
}

.medal.bronze {
  text-shadow: 0 0 5px rgba(205, 127, 50, 0.5);
}

/* Pagination styles */
.pagination .btn {
  background: var(--soft-pink);
  color: var(--accent-red);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.pagination .btn:hover {
  background: var(--main-pink);
  color: white;
}

/* Responsive Ranking Grid */
.rankings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.ranking-preview-section,
.latest-event-preview {
  flex: 1;
  min-width: 300px;
}

/* Quick Vote Cards */
.vote-quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
}

.quick-vote-card {
  flex: 1;
  min-width: 280px;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 2px solid #eee;
  display: flex;
  flex-direction: column;
}

.quick-vote-card.web {
  border-color: var(--accent-red) !important;
}

.quick-vote-card.local {
  border-color: var(--accent-red);
}

.quick-vote-card .card-header {
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: bold;
}

.quick-vote-card.web .card-header {
  background: var(--accent-red);
}

.quick-vote-card.local .card-header {
  background: var(--accent-red);
}

.quick-vote-card .card-body {
  padding: 15px;
  flex: 1;
}

.event-mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-mini-item {
  display: flex;
  align-items: center;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  font-size: 14px;
  border: 1px solid #eee;
  transition: background 0.2s;
}

.quick-vote-card.local .event-mini-item {
  background: #fffefe;
  border-color: #ffebeb;
}

.event-mini-item:hover {
  background: #f0f0f0;
}

.quick-vote-card.local .event-mini-item:hover {
  background: #fff0f0;
}

.event-mini-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  margin-right: 10px;
}

.event-mini-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-mini-go {
  color: var(--accent-red);
  font-weight: bold;
  font-size: 12px;
  margin-left: 5px;
}

.no-events-msg {
  font-size: 13px;
  color: #999;
  text-align: center;
  margin: 10px 0;
}

@media (max-width: 768px) {

  .ranking-preview-section,
  .latest-event-preview {
    flex: 1 1 100%;
    min-width: 0;
  }
}

.lp-container {
  border-radius: 12px !important;
  max-width: 600px !important;
  margin: 3em 0 0 0 !important;
  border: none !important;

}

.lp-vote-btn {
  padding: 12px 30px !important;
  margin-bottom: 30px!important;
}

.btn-voted.lp-vote-btn {
  display: block;
}

.lp-img {
  border: none!important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0) !important;
  border-radius: 6px;
  max-width: 450px;
  max-height: 450px;
}

.lp-desc {
  border-radius: 6px !important;
  background-color: var(--soft-yellow);
  border-left: 5px solid var(--accent-red);
  max-width: 500px;
}

/* エントリー */

.container {
  max-width: 600px;
  margin: auto;
}

.card-body {
  padding: 20px;
}

.card-body input,
.card-body select {
  padding: 6px;
}

.card-body textarea {
  width: 100%;
}

.card-body select {
  width: 75%;
}

.badge.bg-danger {
  font-size: 12px;
}

.badge.bg-danger:before {
  content: "※";
}

/* プロフィール登録 */
.form-group input,
.form-group select {
  padding: 6px;
}


.btn-lg {
  background: linear-gradient(135deg, var(--main-green) 0%, var(--soft-green) 100%);
  color: #2d6a4f;
  font-weight: 700;
  border-radius: 50px;
  border: none;
  padding: 12px 30px;
  cursor: pointer;
  box-shadow: 0 4px 0 #89cfae;
  font-family: inherit;
  transition: all 0.2s;
  max-width: 500px;
  display: block !important;
  margin: 3em auto;
  font-size: 1.2rem;
}

.btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #89cfae;
}
