/* =====================================================================
   RAID ページ専用のスタイル
   色は「文字」と必ずセットで使い、色だけに頼らない（色覚の違いへの配慮）
   OK=緑 / 違反=赤 / 違反の疑い=オレンジ / 要確認=黄 / 判定中・配信中=金・灰
   ===================================================================== */

#raid-root,
.raid-modal {
  --rd-ok: 92, 214, 140;
  --rd-bad: 255, 59, 77;
  --rd-warn: 255, 150, 60;
  --rd-check: 240, 210, 80;
  --rd-live: 240, 194, 76;
  --rd-idle: 143, 149, 163;
}

#raid-root {
  display: grid;
  gap: 18px;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  box-shadow: 0 0 0 1.5px rgba(var(--c-primary-rgb), 0.85);
}
.avatar-sm .avatar-initial {
  font-size: 0.8rem;
}

.raid-dim {
  color: var(--c-muted);
}
.raid-bad {
  color: rgb(var(--rd-bad));
  font-weight: 700;
}

/* ---------- 上部の警告パネル ---------- */
.raid-alert {
  --cut: 16px;
}
.raid-alert-inner {
  padding: 18px 22px;
}
.raid-alert-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
}
.raid-alert-title {
  font-size: 1.15rem;
  font-weight: 800;
}
.raid-alert-sub {
  color: var(--c-muted);
  font-size: 0.88rem;
  margin: 0;
}
.raid-alert--bad .cut-edge {
  background: linear-gradient(135deg, rgb(var(--rd-bad)), rgba(var(--rd-bad), 0.35), rgb(var(--rd-bad)));
}
.raid-alert--bad {
  filter: drop-shadow(0 0 14px rgba(var(--rd-bad), 0.4));
}
.raid-alert--bad .cut-body {
  background: linear-gradient(180deg, #2a0d12, #14090c);
}
.raid-alert--bad .raid-alert-title {
  color: #ff8d99;
}
.raid-alert--ok .cut-edge {
  background: linear-gradient(135deg, rgba(var(--rd-ok), 0.8), rgba(var(--rd-ok), 0.2), rgba(var(--rd-ok), 0.6));
}
.raid-alert--ok .raid-alert-title {
  color: rgb(var(--rd-ok));
}
.raid-alert-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 4px 0 0;
  display: grid;
  gap: 6px;
  max-height: 22rem; /* 件数が多いときは、枠の中でスクロールする（1 か月分を、ずっと出しておく） */
  overflow-y: auto;
}
.raid-alert-list li {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.raid-alert-list li > a {
  flex: 1 1 auto;
  min-width: 0;
}
.raid-detail-btn {
  flex: 0 0 auto;
  align-self: center;
  white-space: nowrap;
}
.raid-alert-list a {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--c-text);
  text-decoration: none;
}
.raid-alert-list a:hover {
  background: rgba(var(--rd-bad), 0.14);
}
.raid-alert-list a > span:not(.raid-badge) {
  color: var(--c-muted);
  font-size: 0.88rem;
}

.raid-warn {
  margin: 0;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: rgb(var(--rd-check));
  border: 1px solid rgba(var(--rd-check), 0.5);
  background: rgba(var(--rd-check), 0.07);
}

/* ---------- 絞り込み ---------- */
.raid-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
}
.raid-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.raid-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  cursor: pointer;
  color: var(--c-text);
  background: #0b0b10;
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.5);
  font: inherit;
  font-size: 0.9rem;
}
.raid-chip:hover {
  background: rgba(var(--c-primary-rgb), 0.18);
}
.raid-chip.is-active {
  color: #1a1204;
  background: var(--gold-sheen);
  box-shadow: none;
  font-weight: 700;
}
.raid-chip-n {
  font-family: var(--font-num);
  font-size: 0.85rem;
  opacity: 0.8;
}
.raid-member-select {
  width: auto;
  min-width: 180px;
}

/* ---------- 記録 ---------- */
.raid-log {
  display: grid;
  gap: 12px;
}
.raid-day {
  margin: 14px 0 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--c-primary-bright);
  display: flex;
  align-items: center;
  gap: 12px;
}
.raid-day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--c-primary-rgb), 0.5), transparent);
}

.raid-row {
  --cut: 12px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.raid-row-inner {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(220px, 1.2fr) minmax(200px, 1.3fr);
  gap: 10px 22px;
  align-items: center;
  padding: 14px 18px;
}
.raid-who-col {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.raid-player {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
  text-decoration: none;
}
.raid-player .avatar {
  width: 44px;
  height: 44px;
}
.raid-player b {
  font-size: 1.02rem;
}

.raid-times {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 18px;
  justify-content: start;
}
.raid-times > div,
.raid-dest {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.raid-k {
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--c-muted);
}
.raid-times b {
  font-family: var(--font-num);
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}

.raid-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
/* レイドをもらった側の名前の上に、「レイド先」の小さな字を置く */
.raid-target {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.raid-target-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
/* 運営が入れた「結果」の文字 */
.raid-result-text {
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.raid-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-text);
  text-decoration: none;
  font-weight: 700;
}
.raid-who:hover .raid-who-name {
  text-decoration: underline;
}

.raid-src {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  box-shadow: inset 0 0 0 1px rgba(var(--rd-idle), 0.6);
  white-space: nowrap;
}
.raid-src--host {
  color: var(--c-primary-bright);
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.75);
}
.raid-src--signal {
  color: #07130c;
  background: linear-gradient(135deg, #7ff0b0, #35c47a);
  box-shadow: none;
  font-weight: 700;
}
.raid-viewers {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--c-primary-bright);
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.55);
  white-space: nowrap;
}
.raid-src--confirmed {
  color: #1a1204;
  background: var(--gold-sheen);
  box-shadow: none;
  font-weight: 700;
}

.raid-issue {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--c-muted);
  background: rgba(255, 255, 255, 0.03);
}
.raid-issue.is-bad {
  color: #ffd5d9;
  font-weight: 700;
  background: rgba(var(--rd-bad), 0.12);
  border-left: 4px solid rgb(var(--rd-bad));
}

/* 状態バッジ */
.raid-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.2em 0.9em;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.5;
  white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.raid-badge .dot {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
.raid-badge--ok {
  color: #06210f;
  background: rgb(var(--rd-ok));
}
.raid-badge--violation {
  color: #fff;
  background: rgb(var(--rd-bad));
}
.raid-badge--suspect {
  color: #2a1200;
  background: rgb(var(--rd-warn));
}
.raid-badge--check {
  color: #2a2200;
  background: rgb(var(--rd-check));
}
.raid-badge--trial {
  color: #fff;
  background: #8a4fd6;
}
.raid-badge--allowed {
  color: rgb(var(--rd-ok));
  background: rgba(var(--rd-ok), 0.14);
  box-shadow: inset 0 0 0 1px rgba(var(--rd-ok), 0.8);
}
.raid-badge--maint {
  color: var(--c-text);
  background: rgba(var(--rd-check), 0.22);
  box-shadow: inset 0 0 0 1px rgba(var(--rd-check), 0.7);
}
.raid-badge--disconnect {
  color: var(--c-text);
  background: rgba(var(--rd-idle), 0.3);
  box-shadow: inset 0 0 0 1px rgba(var(--rd-idle), 0.8);
}
.raid-badge--pending {
  color: var(--c-text);
  background: rgba(var(--rd-idle), 0.3);
}
.raid-badge--live {
  color: #1a1204;
  background: var(--gold-sheen);
}

/* 行の枠の色 */
.raid-row.state-violation .cut-edge {
  background: linear-gradient(135deg, rgb(var(--rd-bad)), rgba(var(--rd-bad), 0.4), rgb(var(--rd-bad)));
}
.raid-row.state-violation {
  filter: drop-shadow(0 0 10px rgba(var(--rd-bad), 0.35));
}
.raid-row.state-violation .cut-body {
  background: linear-gradient(180deg, #25101a, #130a0e);
}
.raid-row.state-suspect .cut-edge {
  background: linear-gradient(135deg, rgb(var(--rd-warn)), rgba(var(--rd-warn), 0.35), rgb(var(--rd-warn)));
}
.raid-row.state-suspect .cut-body {
  background: linear-gradient(180deg, #241608, #130d07);
}
.raid-row.state-check .cut-edge {
  background: linear-gradient(135deg, rgba(var(--rd-check), 0.8), rgba(var(--rd-check), 0.2), rgba(var(--rd-check), 0.6));
}
.raid-row.state-ok .cut-edge {
  background: linear-gradient(135deg, rgba(var(--rd-ok), 0.55), rgba(var(--rd-ok), 0.12), rgba(var(--rd-ok), 0.4));
}
.raid-row.state-pending .cut-edge {
  background: linear-gradient(135deg, rgba(var(--rd-idle), 0.6), rgba(var(--rd-idle), 0.15), rgba(var(--rd-idle), 0.45));
}

.raid-row.is-flash {
  animation: raid-flash 1.6s ease-out;
}
@keyframes raid-flash {
  0% {
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0)) brightness(1.6);
  }
  100% {
    filter: none;
  }
}

/* ---------- 運営用 ---------- */
.raid-admin-row {
  grid-column: 1 / -1;
}
.raid-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  padding: 12px;
  background: rgba(var(--c-primary-rgb), 0.08);
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.4);
}
.raid-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--c-muted);
}
.raid-field[hidden] {
  display: none;
}
.raid-field--wide,
.raid-form-actions,
.raid-form-msg {
  grid-column: 1 / -1;
}
.raid-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.raid-form-msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--c-muted);
}
.raid-form-msg:empty {
  display: none;
}

.raid-admin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  font-size: 0.9rem;
  color: var(--c-muted);
}
.raid-admin .input {
  width: min(100%, 260px);
}
.raid-admin.is-on {
  color: var(--c-primary-bright);
}
.raid-admin-toggle {
  border: 0;
  background: none;
  padding: 6px 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--c-muted);
  text-decoration: underline;
  cursor: pointer;
}
.raid-admin-toggle:hover {
  color: var(--c-text);
}

.raid-note {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  font-size: 0.84rem;
  line-height: 1.8;
  color: var(--c-muted);
}
.raid-note p {
  margin: 0;
}

/* ---------- スマホ ---------- */
@media (max-width: 860px) {
  .raid-row-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }
  .raid-times {
    grid-template-columns: repeat(3, minmax(0, auto));
  }
  .raid-form {
    grid-template-columns: 1fr;
  }
  .raid-member-select {
    width: 100%;
  }
  .raid-alert-inner {
    padding: 16px;
  }
}

/* 記録の準備がまだのときの表示（js/pages/raid.js の setupHint）。文字を変えたいときは raid.js の "STAND-BY" を書き換える */
.raid-standby {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 12vw, 120px) 16px;
  border: 1px solid rgba(var(--c-primary-rgb), 0.25);
  background: rgba(0, 0, 0, 0.35);
}

.raid-standby-text {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  letter-spacing: 0.5em;
  padding-left: 0.5em;
  color: var(--c-primary-bright, #f6e3a8);
  text-shadow: 0 0 18px rgba(var(--c-primary-rgb), 0.5);
}

/* ---------- 「詳細」のウィンドウ（js/pages/raid.js の openDetail） ---------- */
.raid-modal-open {
  overflow: hidden;
}
.raid-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
  overflow-y: auto;
}
.raid-modal-box {
  width: min(640px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px;
  box-sizing: border-box;
  background: #0d0d12;
  border: 1px solid rgba(var(--c-primary-rgb), 0.6);
  box-shadow: 0 0 30px rgba(var(--c-primary-rgb), 0.35);
}
.raid-d-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 14px;
}
.raid-d-list {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
}
.raid-d-item {
  display: grid;
  grid-template-columns: 11em minmax(0, 1fr);
  gap: 4px 14px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.raid-d-item dt {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}
.raid-d-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.raid-d-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
@media (max-width: 560px) {
  .raid-d-item {
    grid-template-columns: 1fr;
  }
}

/* ---------- 「レイド一覧」（js/pages/raid.js の openList） ---------- */
.raid-filters-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.raid-list-btn {
  white-space: nowrap;
}
.raid-range-note {
  margin: -6px 0 0;
  font-size: 0.82rem;
  color: var(--c-muted);
}
.raid-modal-box--wide {
  width: min(880px, 100%);
}
.raid-list-title {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--c-primary-bright);
}
.raid-list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: 18px 0 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.raid-modal .raid-log {
  display: grid;
  gap: 10px;
}
.raid-cal {
  width: min(420px, 100%);
  margin: 0 auto;
}
.raid-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.raid-cal-head b {
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}
.raid-cal-nav {
  width: 44px;
  height: 40px;
  border: 0;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--c-text);
  background: #0b0b10;
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.5);
}
.raid-cal-nav:hover:not(:disabled) {
  background: rgba(var(--c-primary-rgb), 0.18);
}
.raid-cal-nav:disabled {
  opacity: 0.3;
  cursor: default;
}
.raid-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.raid-cal-week {
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--c-muted);
}
.raid-cal-week .is-sun {
  color: rgb(255, 130, 140);
}
.raid-cal-week .is-sat {
  color: rgb(130, 180, 255);
}
.raid-cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 46px;
  padding: 2px 0;
  border: 0;
  font: inherit;
  color: var(--c-muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: default;
}
.raid-cal-day:disabled {
  opacity: 0.45;
}
.raid-cal-day.has-data {
  cursor: pointer;
  color: var(--c-text);
  background: #0b0b10;
  box-shadow: inset 0 0 0 1px rgba(var(--c-primary-rgb), 0.5);
}
.raid-cal-day.has-data:hover {
  background: rgba(var(--c-primary-rgb), 0.2);
}
.raid-cal-day.is-today .raid-cal-num {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.raid-cal-day.is-selected {
  color: #1a1204;
  background: var(--gold-sheen);
  box-shadow: none;
  font-weight: 700;
}
.raid-cal-num {
  font-size: 0.95rem;
}
.raid-cal-n {
  font-family: var(--font-num);
  font-size: 0.72rem;
  opacity: 0.8;
}
.raid-cal-day.has-bad::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--rd-bad));
  box-shadow: 0 0 0 1.5px #0d0d12;
}
.raid-cal-legend {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--c-muted);
}
.raid-cal-dot {
  flex: 0 0 auto;
  margin-top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--rd-bad));
}
