:root {
  --bg: #140f2d;
  --bg-soft: #1d1642;
  --line: #f2d6a2;
  --paper: #f4ead8;
  --paper-shadow: rgba(242, 214, 162, 0.26);
  --ink: #2c2132;
  --cream: #f6e0b4;
  --danger: #be4a47;
  --danger-dark: #922f36;
  --cyan: #22d4d6;
  --green: #4cdf8f;
  --violet: #b7a8ff;
  --muted: #c6b6d8;
  --panel-border: rgba(242, 214, 162, 0.4);
}

@font-face {
  font-family: "Kameron Custom";
  src: url("/assets/imported/assets_logos/font/Kameron/static/Kameron-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Kameron Custom";
  src: url("/assets/imported/assets_logos/font/Kameron/static/Kameron-Bold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: "Kufam Custom";
  src: url("/assets/imported/assets_logos/font/Kufam/static/Kufam-Bold.ttf") format("truetype");
  font-weight: 700;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Kameron Custom", Georgia, serif;
  color: var(--cream);
  background:
    linear-gradient(rgba(24, 16, 47, 0.22), rgba(24, 16, 47, 0.22)),
    url("/assets/imported/assets_logos/assets/bg.png") center/cover no-repeat fixed,
    linear-gradient(135deg, #120c27, #171036 45%, #110b24);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(183, 168, 255, 0.16), transparent 18%),
    radial-gradient(circle at 80% 25%, rgba(34, 212, 214, 0.12), transparent 16%),
    radial-gradient(circle at 50% 85%, rgba(190, 74, 71, 0.1), transparent 18%);
}

.duel-app {
  width: 1900px;
  max-width: calc(100vw - 20px);
  margin: 0 auto;
  min-height: 900px;
  padding: 14px 0 16px;
}

.home-shell {
  width: 1500px;
  max-width: calc(100vw - 28px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 36px 0 32px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 420px;
  gap: 28px;
  align-items: stretch;
}

.home-copy,
.auth-card,
.home-history-card,
.app-meta-bar {
  border: 1px solid rgba(242, 214, 162, 0.28);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(34, 212, 214, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(190, 74, 71, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(18, 13, 37, 0.9), rgba(15, 11, 31, 0.76));
  box-shadow: inset 0 0 0 1px rgba(242, 214, 162, 0.06);
}

.home-copy {
  padding: 36px;
}

.home-logo {
  display: block;
  width: min(320px, 52%);
  margin-bottom: 12px;
}

.home-kicker {
  margin: 0 0 10px;
  color: #db7b82;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.9rem;
}

.home-title {
  margin: 0 0 18px;
  max-width: 780px;
  color: #fff0c7;
  font-size: clamp(2.8rem, 4.8vw, 5rem);
  line-height: 0.95;
}

.home-description {
  margin: 0 0 26px;
  max-width: 780px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.home-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.home-button {
  border: 1px solid rgba(242, 214, 162, 0.4);
  border-radius: 999px;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(246, 224, 180, 0.18), rgba(242, 214, 162, 0.08));
  color: #fff1c9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.home-button-secondary {
  background: rgba(34, 212, 214, 0.1);
}

.home-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.home-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.home-highlight {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(246, 224, 180, 0.06);
  border: 1px solid rgba(242, 214, 162, 0.12);
}

.home-highlight strong,
.profile-stats strong {
  display: block;
  color: #fff0c7;
  font-size: 1.05rem;
}

.home-highlight span,
.profile-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-card,
.home-history-card {
  padding: 26px;
}

.auth-title {
  margin: 0 0 12px;
  color: #fff0c7;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-copy,
.auth-status {
  color: var(--muted);
  line-height: 1.5;
}

.auth-switch {
  display: flex;
  gap: 8px;
  margin: 22px 0 16px;
}

.auth-tab {
  border: 1px solid rgba(242, 214, 162, 0.3);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(246, 224, 180, 0.08);
  color: #fff1c9;
  font: inherit;
  cursor: pointer;
}

.auth-tab.is-selected {
  background: rgba(34, 212, 214, 0.14);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-status {
  margin: 16px 0 0;
}

.profile-name {
  margin: 0 0 18px;
  color: #fff0c7;
  font-size: 2rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.profile-rank {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(246, 224, 180, 0.06);
}

.rank-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.rank-icon-bronze {
  background-image: url("/ranked-assets/logos_asset_ranked/logos_bronze.png");
}

.rank-icon-argent {
  background-image: url("/ranked-assets/logos_asset_ranked/logos_silver.png");
}

.rank-icon-or {
  background-image: url("/ranked-assets/logos_asset_ranked/logos_or.png");
}

.rank-icon-top1 {
  background-image: url("/ranked-assets/logos_asset_ranked/logos_top1.png");
}

.profile-stats div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(246, 224, 180, 0.06);
}

.home-history {
  margin-top: 24px;
}

.ranked-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.ranked-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ranked-legend {
  display: grid;
  gap: 10px;
}

.ranked-legend div {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(246, 224, 180, 0.06);
}

.profile-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.profile-history-list li {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(246, 224, 180, 0.08);
  color: #fff7e6;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.leaderboard-entry.is-self {
  box-shadow: inset 0 0 0 1px rgba(34, 212, 214, 0.3);
}

.leaderboard-main,
.leaderboard-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-rank {
  min-width: 34px;
  color: #f3d793;
  font-weight: 700;
}

.leaderboard-side {
  color: var(--muted);
  white-space: nowrap;
}

.profile-history-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.92rem;
}

.app-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 12px 14px;
  padding: 14px 16px;
}

.app-meta-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 12px 18px;
  border-bottom: 0;
  background: url("/assets/imported/assets_logos/assets/line.png") bottom center/100% 2px no-repeat;
}

.top-bar-main {
  display: grid;
  grid-template-columns: 300px minmax(260px, 1fr) 240px;
  align-items: center;
  gap: 24px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  width: 270px;
  min-height: 84px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.top-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.top-block-right {
  justify-content: flex-end;
}

.topic-row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.mode-switch-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.mode-switch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-switch-button {
  border: 1px solid rgba(242, 214, 162, 0.34);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(246, 224, 180, 0.08);
  color: #fff1c9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mode-switch-button.is-selected {
  background: rgba(34, 212, 214, 0.16);
  box-shadow: inset 0 0 0 1px rgba(34, 212, 214, 0.24);
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 14px 18px;
  align-items: center;
}

.session-fields,
.session-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.session-status {
  margin: 0;
  color: var(--muted);
  grid-column: 1 / -1;
}

.session-input {
  min-width: 180px;
  border: 1px solid rgba(242, 214, 162, 0.32);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(246, 224, 180, 0.08);
  color: #fff7e6;
  font: inherit;
}

.session-input-code {
  min-width: 130px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-button {
  border: 1px solid rgba(242, 214, 162, 0.34);
  border-radius: 999px;
  padding: 12px 16px;
  background: rgba(246, 224, 180, 0.12);
  color: #fff1c9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.session-button-secondary {
  background: rgba(34, 212, 214, 0.1);
}

.session-button:disabled,
.session-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.topic-row-label {
  align-self: start;
  padding-top: 8px;
}

.top-label,
.mode-label {
  color: var(--cream);
  font-weight: 700;
}

.top-label {
  white-space: nowrap;
  font-size: 1.05rem;
}

.topic-input {
  width: 100%;
  border: 0;
  border-radius: 18px;
  border: 1px solid rgba(242, 214, 162, 0.32);
  padding: 16px 18px;
  background: rgba(246, 224, 180, 0.08);
  color: #fff7e6;
  font-size: clamp(1.15rem, 1.45vw, 1.55rem);
  font-weight: 700;
  font-family: "Kameron Custom", Georgia, serif;
  line-height: 1.35;
  min-height: 62px;
  white-space: normal;
}

.topic-input:focus {
  outline: none;
  border-color: var(--line);
  box-shadow: 0 0 0 2px rgba(234, 210, 172, 0.14);
}

.top-center {
  text-align: center;
  justify-self: center;
}

.timer-display {
  font-family: "Kufam Custom", sans-serif;
  font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
}

.round-display {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.mode-label {
  color: #db7b82;
  font-size: 0.88rem;
}

.top-value {
  display: inline-flex;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid rgba(242, 214, 162, 0.32);
  border-radius: 999px;
  background: rgba(246, 224, 180, 0.08);
  font-weight: 700;
  min-width: 140px;
}

.duel-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(560px, 1fr) 350px;
  gap: 24px;
  min-height: 700px;
  padding: 20px 8px 0;
}

.duel-stage.training-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  padding-top: 0;
}

.stage-divider {
  position: absolute;
  left: calc(50% - 194px);
  top: 24px;
  bottom: 14px;
  width: 2px;
  background: url("/assets/imported/assets_logos/assets/line.png") center/100% 100% no-repeat;
  opacity: 0.88;
}

.duelist-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 690px;
  position: relative;
}

.duelist-panel.duelist-right {
  align-items: flex-end;
}

.training-panel {
  grid-column: 1;
  min-height: 640px;
  align-self: start;
  margin-top: -28px;
}

.training-card {
  width: 100%;
  min-height: 390px;
  padding: 22px 28px 28px;
  border-radius: 22px;
  border: 1px solid rgba(242, 214, 162, 0.32);
  background:
    radial-gradient(circle at top left, rgba(34, 212, 214, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(190, 74, 71, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(19, 14, 38, 0.92), rgba(15, 11, 31, 0.74));
  box-shadow: inset 0 0 0 1px rgba(242, 214, 162, 0.08);
}

.training-label {
  margin: 0 0 10px;
  color: #db7b82;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
}

.training-title {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.95;
}

.training-copy {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 700px;
}

.training-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.training-input {
  width: 100%;
  min-height: 240px;
  border: 1px solid rgba(242, 214, 162, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(246, 224, 180, 0.08), rgba(255, 255, 255, 0.03));
  color: #fff7e6;
  padding: 18px 20px;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
  box-shadow: inset 0 0 24px rgba(242, 214, 162, 0.05);
}

.training-input:focus,
.session-input:focus {
  outline: none;
  border-color: var(--line);
  box-shadow: 0 0 0 2px rgba(234, 210, 172, 0.14);
}

.speech-card {
  width: min(100%, 560px);
  min-height: 285px;
  padding: 22px 24px 18px;
  border-radius: 18px;
  border: 4px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, var(--paper));
  color: var(--ink);
  box-shadow: inset 0 0 30px var(--paper-shadow);
}

.speech-card.active-turn {
  box-shadow:
    inset 0 0 30px var(--paper-shadow),
    0 0 0 3px rgba(242, 214, 162, 0.28);
}

.speech-label {
  margin: 0 0 12px;
  color: #7f6546;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.argument-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: flex-start;
}

.argument-input {
  width: 100%;
  min-height: 185px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.55;
  resize: none;
}

.argument-input:focus {
  outline: none;
}

.panel-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 12px;
  width: 100%;
}

.send-button {
  min-width: 172px;
  min-height: 64px;
  border: 0;
  padding: 14px 24px;
  background: url("/assets/imported/assets_logos/assets/fight_send_button.png") center/100% 100% no-repeat;
  color: #5a3728;
  font-size: 1.28rem;
  font-weight: 700;
  cursor: pointer;
  font-family: "Kameron Custom", Georgia, serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 249, 230, 0.6);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.send-button.is-busy {
  opacity: 0.92;
  position: relative;
  animation: busyButtonPulse 1.1s ease-in-out infinite;
}

.send-button.is-busy::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 999px;
  border: 2px solid rgba(90, 55, 40, 0.22);
  border-top-color: #5a3728;
  animation: loaderSpin 0.8s linear infinite;
}

.local-history-card {
  width: min(100%, 560px);
  min-height: 136px;
  padding: 8px 12px 0;
}

.local-history-title {
  margin: 0 0 10px;
  color: #f1d6a1;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.local-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 196px;
  overflow-y: auto;
  padding-right: 4px;
}

.local-history-empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.local-history-item {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(15, 11, 31, 0.44);
  border: 1px solid rgba(242, 214, 162, 0.12);
  color: #f8ebce;
}

.local-history-item.attack {
  box-shadow: inset 0 0 0 1px rgba(76, 223, 143, 0.08);
}

.local-history-item.defense {
  box-shadow: inset 0 0 0 1px rgba(255, 108, 115, 0.08);
}

.local-history-item.bonus {
  box-shadow: inset 0 0 0 1px rgba(34, 212, 214, 0.14);
  background: rgba(34, 212, 214, 0.08);
}

.local-history-item.malus {
  box-shadow: inset 0 0 0 1px rgba(176, 65, 62, 0.18);
  background: rgba(176, 65, 62, 0.12);
}

.local-history-tag {
  color: #e9c785;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.local-history-item.attack .local-history-tag {
  color: #74ef9f;
}

.local-history-item.defense .local-history-tag {
  color: #ff9ea1;
}

.local-history-item.bonus .local-history-tag {
  color: #77e7ea;
}

.local-history-item.malus .local-history-tag {
  color: #e89191;
}

.local-history-text {
  min-width: 0;
}

.local-history-meta {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.local-history-list::-webkit-scrollbar {
  width: 8px;
}

.local-history-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.local-history-list::-webkit-scrollbar-thumb {
  background: rgba(234, 210, 172, 0.4);
  border-radius: 999px;
}

.player-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  width: min(100%, 600px);
}

.duelist-right .player-card {
  text-align: right;
}

.avatar-frame {
  position: relative;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  border: 4px solid #d6b45c;
  overflow: hidden;
  box-shadow: 0 0 28px rgba(214, 180, 92, 0.18);
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.status-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.health-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 10px;
}

.heart-badge {
  width: 58px;
  height: 58px;
  background: url("/assets/imported/assets_logos/assets/fight_heart.png") center/contain no-repeat;
}

.health-track {
  position: relative;
  height: 34px;
  overflow: hidden;
  border-radius: 999px;
  border: 4px solid #f3e8d6;
  background: #f3efe9;
}

.health-bar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--danger-dark), var(--danger));
  transition: width 0.35s ease;
}

.health-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #e4bc7a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.player-name {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.95;
}

.player-tagline {
  color: var(--muted);
  margin: 0;
}

.player-state {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.player-state strong {
  color: var(--cream);
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  align-items: flex-start;
}

.status-badges-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 214, 162, 0.24);
  background: rgba(246, 224, 180, 0.08);
  color: #f7ebcd;
  cursor: help;
}

.status-badge-bonus {
  box-shadow: inset 0 0 0 1px rgba(76, 223, 143, 0.15);
}

.status-badge-malus {
  box-shadow: inset 0 0 0 1px rgba(255, 108, 115, 0.18);
}

.status-badge-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: center/contain no-repeat;
}

.status-badge-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.status-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 10;
  width: 168px;
  padding: 14px 12px;
  border-radius: 16px;
  border: 2px solid rgba(242, 214, 162, 0.78);
  background: linear-gradient(180deg, #fffef8, #f4ead7);
  color: #247f72;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.28);
}

.status-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 14px;
  height: 14px;
  background: #f4ead7;
  border-right: 2px solid rgba(242, 214, 162, 0.78);
  border-bottom: 2px solid rgba(242, 214, 162, 0.78);
  transform: translateX(-50%) translateY(50%) rotate(225deg);
}

.status-badge:hover .status-tooltip,
.status-badge:focus-within .status-tooltip,
.status-badge:focus .status-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.status-tooltip-icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  border-radius: 12px;
  background: rgba(36, 127, 114, 0.1) center/24px 24px no-repeat;
}

.status-tooltip-title {
  color: #24a28d;
  font-size: 1rem;
  margin-bottom: 6px;
}

.status-tooltip-value {
  color: #d14e58;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-tooltip-text {
  color: #6b645d;
  font-size: 0.78rem;
  line-height: 1.3;
}

.player-card.is-active .player-name,
.player-card.is-active .turn-chip {
  color: #fff2cb;
}

.turn-chip {
  color: #cc97a5;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.battle-feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.feed-card {
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: rgba(15, 11, 31, 0.62);
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(242, 214, 162, 0.08);
}

.analysis-card {
  position: relative;
  overflow: visible;
  z-index: 4;
}

.analysis-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(34, 212, 214, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(15, 11, 31, 0.92), rgba(18, 13, 35, 0.96));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 2;
}

.analysis-card.is-loading .analysis-loader {
  opacity: 1;
  visibility: visible;
}

.analysis-loader-ring,
.analysis-loader-core {
  grid-area: 1 / 1;
  border-radius: 999px;
}

.analysis-loader-ring {
  width: 88px;
  height: 88px;
  border: 3px solid rgba(242, 214, 162, 0.18);
  border-top-color: var(--cyan);
  border-bottom-color: var(--line);
  animation: loaderSpin 1.15s linear infinite;
}

.analysis-loader-ring-delayed {
  width: 120px;
  height: 120px;
  border-width: 2px;
  animation-duration: 1.8s;
  animation-direction: reverse;
  opacity: 0.8;
}

.analysis-loader-core {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle, #fff6cf 0%, #f2d6a2 45%, rgba(242, 214, 162, 0.12) 100%);
  box-shadow: 0 0 26px rgba(242, 214, 162, 0.45);
  animation: loaderPulse 1.2s ease-in-out infinite;
}

.analysis-loader-text {
  grid-area: 2 / 1;
  margin: 0;
  color: #fff1c9;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.analysis-card.is-loading .analysis-stats,
.analysis-card.is-loading .analysis-details,
.analysis-card.is-loading .feed-label {
  filter: blur(2px);
  opacity: 0.25;
}

.feed-label {
  margin: 0 0 14px;
  color: #fff1c9;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.analysis-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analysis-stats div {
  border-radius: 16px;
  padding: 12px;
  background: rgba(246, 224, 180, 0.08);
}

.analysis-stat {
  position: relative;
  cursor: help;
}

.analysis-stat::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: 250px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(242, 214, 162, 0.54);
  background: linear-gradient(180deg, #fffef8, #f4ead7);
  color: #5a5148;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 24;
}

.analysis-stat[data-tooltip]:hover::after,
.analysis-stat[data-tooltip]:focus-within::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.analysis-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.analysis-stats strong {
  color: #fff7e6;
  font-size: 1.1rem;
}

.analysis-details {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.history-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow: auto;
}

.history-card li {
  padding: 14px;
  border-radius: 16px;
  background: rgba(246, 224, 180, 0.08);
  border: 1px solid rgba(242, 214, 162, 0.12);
  color: #f8ebce;
  line-height: 1.45;
}

.feed-event-turn {
  box-shadow: inset 0 0 0 1px rgba(76, 223, 143, 0.14);
}

.feed-event-bonus {
  background: rgba(34, 212, 214, 0.08);
  box-shadow: inset 0 0 0 1px rgba(34, 212, 214, 0.16);
}

.feed-event-penalty {
  background: rgba(190, 74, 71, 0.12);
  box-shadow: inset 0 0 0 1px rgba(190, 74, 71, 0.18);
}

.feed-event-presence {
  background: rgba(183, 168, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(183, 168, 255, 0.14);
}

.history-card strong {
  display: block;
  color: #fff1c9;
  margin-bottom: 6px;
}

.winner-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(76, 223, 143, 0.12);
  color: #bcffd8;
  font-weight: 700;
}

.impact-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floating-impact {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, 0);
  font-weight: 700;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  opacity: 0;
  animation: floatImpact 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  will-change: transform, opacity;
}

.floating-impact.damage {
  color: #ff797b;
  font-size: 3.8rem;
  letter-spacing: 0.03em;
}

.floating-impact.logic,
.floating-impact.example,
.floating-impact.emotion {
  color: #8cffbb;
  font-size: 1.45rem;
}

.floating-impact.penalty {
  color: #ff9ca1;
  font-size: 1.45rem;
}

.health-track.flash-damage {
  animation: hpFlash 1.2s ease;
}

.speech-card.card-pulse {
  animation: cardPulse 1.15s ease;
}

.analysis-card.flash-panel {
  animation: panelFlash 1.4s ease;
}

@keyframes floatImpact {
  0% {
    opacity: 0;
    transform: translate(-50%, 40px) scale(0.72);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -96px) scale(1.18);
  }
}

@keyframes hpFlash {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 120, 120, 0);
  }
  28% {
    box-shadow: 0 0 30px rgba(255, 120, 120, 0.9);
  }
  60% {
    box-shadow: 0 0 18px rgba(255, 120, 120, 0.45);
  }
}

@keyframes cardPulse {
  0%, 100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
  }
}

@keyframes panelFlash {
  0%, 100% {
    box-shadow: inset 0 0 0 1px rgba(242, 214, 162, 0.08);
  }
  35% {
    box-shadow:
      inset 0 0 0 1px rgba(242, 214, 162, 0.08),
      0 0 42px rgba(242, 214, 162, 0.32);
  }
  65% {
    box-shadow:
      inset 0 0 0 1px rgba(242, 214, 162, 0.08),
      0 0 24px rgba(34, 212, 214, 0.18);
  }
}

@keyframes loaderSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes loaderPulse {
  0%, 100% {
    transform: scale(0.86);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

@keyframes busyButtonPulse {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.2) brightness(1.04);
  }
}

@media (max-width: 1180px) {
  .duel-app {
    width: min(100%, calc(100% - 24px));
    min-height: auto;
  }

  .duel-stage {
    grid-template-columns: 1fr;
    gap: 22px;
    min-height: auto;
  }

  .stage-divider {
    display: none;
  }

  .duelist-panel {
    min-height: auto;
  }

  .duelist-panel.duelist-right {
    align-items: stretch;
  }

  .speech-card,
  .player-card {
    width: 100%;
  }

  .top-bar-main,
  .topic-row,
  .session-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .top-block-right {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .duel-app {
    width: min(100%, calc(100% - 20px));
  }

  .brand-mark {
    width: 220px;
    height: 64px;
  }

  .brand-logo {
    width: 220px;
  }

  .top-block,
  .top-block-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topic-row {
    gap: 10px;
  }

  .topic-input {
    min-height: 78px;
    font-size: 1.05rem;
  }

  .player-card,
  .health-row {
    grid-template-columns: 1fr;
  }

  .avatar-frame {
    width: 86px;
    height: 86px;
  }
}
