/* 1:1 most-wins ranking card and popup, coupon popup (app 2.7.1, mockups m271-duel-card / m271-duel-popup /
   m271-coupon). Layout here; colours, borders and shadows are plain properties the UI layer tool can adjust. */

/* ---------- card under the duel card ---------- */
.duel-week {
  border: 3px solid var(--cs-gold, #f0b43c);
  border-radius: var(--cs-radius, 18px);
  background: linear-gradient(180deg, #fffdf5, var(--cs-cream, #fff6e3));
  box-shadow: var(--cs-shadow, 0 4px 0 rgba(120, 70, 20, 0.25));
  color: var(--cs-brown, #4d3420);
  padding: 12px 14px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.duel-week-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.duel-week-trophy {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.duel-week-heading {
  min-width: 0;
}

.duel-week-title {
  margin: 0;
}

.duel-week-left {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--cs-brown-soft, #8a6a4a);
}

.duel-week-me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 12px;
  background: #ffefc2;
  border: 1px solid #f0d08a;
  font-size: 14px;
  font-weight: 900;
}

.duel-week-me-cap {
  font-size: 11px;
  font-weight: 700;
  color: var(--cs-brown-soft, #8a6a4a);
  text-align: right;
}

.duel-week-all {
  justify-self: end;
  min-height: 34px;
  padding: 4px 14px;
  font-size: 13px;
}

/* ---------- rows (card and popup) ---------- */
.duel-rank-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.duel-rank-row {
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: 12px;
  background: #fffaf0;
  border: 1px solid #efd4a6;
  font-weight: 800;
}

.duel-rank-row.is-me {
  background: #fff1b8;
  border-color: #f2c14e;
}

.duel-rank-badge {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.duel-rank-medal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The number sits on the medal's round face (upper part of the picture). */
.duel-rank-badge.has-medal .duel-rank-num {
  position: relative;
  margin-top: -7px;
  font-size: 13px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(80, 40, 0, 0.7);
}

.duel-rank-badge:not(.has-medal) .duel-rank-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #9a7552;
  color: #ffffff;
  font-size: 13px;
}

.duel-rank-face {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #fde7c2;
  border: 2px solid #f0c27a;
}

.duel-rank-name {
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.duel-rank-wins {
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.duel-rank-empty {
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cs-brown-soft, #8a6a4a);
  text-align: center;
}

/* ---------- popup ---------- */
.popup-card--duel-rank {
  max-width: 440px;
  max-height: calc(100vh - 32px - var(--popup-safe-y));
  max-height: calc(100dvh - 32px - var(--popup-safe-y));
  gap: 8px;
  overflow-y: auto;
}

.duel-rank-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: #f3e3c6;
}

.duel-rank-tab {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-weight: 900;
  font-size: 15px;
  color: #6b4a2b;
  cursor: pointer;
}

.duel-rank-tab.is-active {
  background: linear-gradient(180deg, #4fa8ff, #1f6fe0);
  color: #ffffff;
  box-shadow: 0 2px 0 rgba(10, 50, 120, 0.35);
}

.duel-rank-reward {
  padding: 8px;
  border-radius: 14px;
  background: #fff2d1;
  border: 1px solid #f0cf8a;
}

.duel-rank-prizes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.duel-rank-prize {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.duel-rank-prize-medal {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}

.duel-rank-prize-text {
  min-width: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: pre-line;
  color: #4d3420;
}

.duel-rank-rest {
  margin: 6px 0 0;
  padding: 3px 8px;
  border-radius: 10px;
  background: #ffe7b0;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  color: #4d3420;
}

.duel-rank-full {
  overflow-y: auto;
  min-height: 0;
}

.duel-rank-note {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: #8a6a4a;
  text-align: center;
}

/* ---------- coupon ---------- */
.mail-coupon-open {
  width: 100%;
}

.popup-card--coupon {
  max-width: 360px;
  gap: 8px;
}

.coupon-sub,
.coupon-hint {
  margin: 0;
  text-align: center;
  font-weight: 700;
}

.coupon-sub {
  font-size: 0.95rem;
  color: #4d3420;
}

.coupon-hint {
  font-size: 0.8rem;
  color: #8a6a4a;
}

.coupon-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px solid #8cc6f5;
  border-radius: 14px;
  background: #ffffff;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  color: #2b1d10;
}

.coupon-input:focus {
  outline: none;
  border-color: #2f8de4;
  box-shadow: 0 0 0 3px rgba(47, 141, 228, 0.25);
}

.coupon-input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  color: #b9a58c;
}

.coupon-error {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #d23b2e;
  text-align: center;
}

#popup-coupon[data-state="already"] .coupon-error {
  color: #6b4a2b;
}

#popup-coupon[data-state="already"] .coupon-error-icon {
  display: none;
}

.coupon-error-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Narrow phones (320): the medal above its text, so "+ 3 spins" keeps one line. */
@media (max-width: 359px) {
  .duel-rank-prize {
    flex-direction: column;
    text-align: center;
  }
}
