.df-shell,
.df-shell * {
  box-sizing: border-box;
}

.df-shell {
  --df-blood: #e2543f;
  --df-steel: #4d9be0;
  --df-moss: #3fbf85;
  --df-gold: #f0b93a;
  --df-plum: #a56ad8;
  --df-ember: #ff8a3d;
  --df-ink: #f6ecdf;
  --df-dim: #b8a596;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 12px 20px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.cg-shell-game .cg-stage-main #game-root > .df-shell {
  max-width: min(100%, 820px) !important;
}

.df-topbar,
.df-statline,
.df-actions,
.df-chips,
.df-controls,
.df-relics {
  display: flex;
  align-items: center;
}

.df-topbar {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 44px;
}

.df-statline,
.df-actions {
  gap: 6px;
}

.df-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 999px;
  background: var(--cg-panel);
  box-shadow: 0 3px 10px rgba(33, 43, 40, 0.07);
}

.df-stat span {
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.df-stat strong {
  font-size: 15px;
  line-height: 1;
}

.df-btn,
.df-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(33, 43, 40, 0.08);
  transition: transform 120ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.df-btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.df-btn:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}

.df-icon {
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.df-primary {
  border-color: #b5541c;
  background: linear-gradient(180deg, #ffa24a, #e0651e);
  color: #2a1204;
  box-shadow: 0 6px 16px rgba(224, 101, 30, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.df-primary:disabled {
  filter: grayscale(0.7);
}

.df-btn:focus-visible,
.df-close:focus-visible,
.df-card:focus-visible,
.df-choice:focus-visible,
.df-foe:focus-visible {
  outline: 3px solid var(--df-gold);
  outline-offset: 2px;
}

.df-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid #3a2a2c;
  border-radius: 18px;
  background: linear-gradient(180deg, #211519, #120b10);
  box-shadow: 0 18px 40px rgba(20, 10, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--df-ink);
  overflow: hidden;
  min-height: 560px;
}

.df-hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.df-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.df-panel-meta {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 5px 10px;
}

.df-label {
  color: var(--df-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.df-piles {
  color: var(--df-dim);
  font-size: 11px;
  font-weight: 700;
}

.df-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.df-hpfill,
.df-foefill,
.df-foeblock {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.df-hpfill {
  background: linear-gradient(180deg, #ff8a6a, #d03a2a 55%, #a02418);
  box-shadow: 0 0 10px rgba(255, 80, 50, 0.6);
}

.df-foefill {
  background: linear-gradient(180deg, #ffd06a, #f0902a 55%, #c4601a);
}

.df-foeblock {
  top: auto;
  height: 4px;
  background: #7ec4ff;
  box-shadow: 0 0 8px rgba(126, 196, 255, 0.9);
}

.df-low .df-hpfill {
  animation: df-throb 0.9s ease-in-out infinite;
}

.df-shake {
  animation: df-shake 280ms linear;
}

.df-chips {
  gap: 6px;
}

.df-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
}

.df-chip b {
  font-weight: 900;
}

.df-ico {
  width: 15px;
  height: 15px;
  flex: none;
}

.df-chip-hp .df-ico {
  color: var(--df-blood);
}

.df-chip-blk .df-ico {
  color: var(--df-steel);
}

.df-pips {
  display: flex;
  gap: 5px;
}

.df-pip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.df-pip-on {
  border-color: #ffe9a8;
  background: radial-gradient(circle at 35% 30%, #fff5c8, #ffb42a 55%, #d8710a);
  box-shadow: 0 0 12px rgba(255, 180, 42, 0.8);
}

.df-panel-energy .df-chips {
  display: none;
}

.df-relics {
  gap: 5px;
  flex-wrap: wrap;
}

.df-relic {
  padding: 2px 8px;
  border: 1px solid rgba(240, 185, 58, 0.5);
  border-radius: 999px;
  background: rgba(240, 185, 58, 0.14);
  color: #ffdf8a;
  font-size: 10px;
  font-weight: 800;
}

.df-board {
  position: relative;
  flex: 1 1 auto;
  min-height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #170e14;
  overflow: hidden;
}

.df-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.df-foewrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
}

.df-foe {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 420px);
  height: 100%;
  padding: 30px 8px 16px;
  border-radius: 14px;
  cursor: crosshair;
  outline-offset: -3px;
}

.df-foe.df-aim {
  background: radial-gradient(60% 55% at 50% 55%, rgba(255, 90, 50, 0.22), transparent 70%);
  animation: df-aim 900ms ease-in-out infinite;
}

.df-intent {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 12px 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(10, 6, 10, 0.72);
  backdrop-filter: blur(4px);
  font-size: 13px;
  font-weight: 800;
  animation: df-bob 2.2s ease-in-out infinite;
}

.df-intentico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.df-intentico .df-ico {
  width: 16px;
  height: 16px;
}

.df-intent b {
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

.df-intent b i {
  margin-left: 2px;
  font-size: 13px;
  font-style: normal;
  opacity: 0.85;
}

.df-intentname {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--df-dim);
  white-space: nowrap;
}

.df-intent-atk {
  border-color: rgba(255, 90, 60, 0.7);
  box-shadow: 0 0 16px rgba(255, 70, 40, 0.35);
}

.df-intent-atk .df-intentico {
  background: #d03a2a;
  color: #fff;
}

.df-intent-blk {
  border-color: rgba(100, 180, 255, 0.7);
  box-shadow: 0 0 16px rgba(80, 160, 255, 0.35);
}

.df-intent-blk .df-intentico {
  background: #2f75b8;
  color: #fff;
}

.df-intent-buff {
  border-color: rgba(190, 120, 255, 0.7);
  box-shadow: 0 0 16px rgba(170, 100, 255, 0.35);
}

.df-intent-buff .df-intentico {
  background: #8a4cc4;
  color: #fff;
}

.df-foeart {
  flex: 1 1 auto;
  width: 100%;
  min-height: 90px;
}

.df-foemeta {
  display: grid;
  gap: 3px;
  width: min(260px, 82%);
  text-align: center;
}

.df-foename {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.df-bar-foe {
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.df-foehp {
  font-size: 11px;
  font-weight: 800;
  color: var(--df-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.df-log {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 7px;
  z-index: 3;
  display: grid;
  gap: 1px;
  text-align: center;
  pointer-events: none;
  font-size: 11px;
  line-height: 1.25;
  color: #e8d9c8;
  text-shadow: 0 1px 4px #000;
}

.df-log span:last-child {
  color: #fff;
  font-weight: 800;
}

.df-log span:not(:last-child) {
  display: none;
}

.df-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  min-height: 118px;
  padding: 14px 2px 2px;
}

.df-card {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 124px;
  aspect-ratio: 5 / 7;
  padding: 16px 4px 4px;
  border: 2px solid var(--df-edge, #c9a24a);
  border-radius: 10px;
  background: linear-gradient(170deg, var(--df-c1), var(--df-c2));
  color: #fff;
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.3, 1), filter 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.df-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.16) 48%, transparent 60%);
  pointer-events: none;
}

.df-tone-atk { --df-c1: #a83a2c; --df-c2: #3d1512; --df-edge: #e8a24a; --df-glow: rgba(255, 110, 60, 0.7); }
.df-tone-blk { --df-c1: #2f6ea8; --df-c2: #11263f; --df-edge: #8ccbff; --df-glow: rgba(110, 190, 255, 0.7); }
.df-tone-heal { --df-c1: #2a8f62; --df-c2: #0f3324; --df-edge: #8ff0bd; --df-glow: rgba(90, 240, 160, 0.7); }
.df-tone-draw { --df-c1: #b07a22; --df-c2: #3a2508; --df-edge: #ffd98a; --df-glow: rgba(255, 200, 90, 0.7); }
.df-tone-forge { --df-c1: #c2621a; --df-c2: #431c06; --df-edge: #ffb56a; --df-glow: rgba(255, 150, 60, 0.7); }
.df-tone-twin { --df-c1: #7a48a8; --df-c2: #29143d; --df-edge: #d3a6ff; --df-glow: rgba(190, 130, 255, 0.7); }
.df-tone-relic { --df-c1: #8a6a1c; --df-c2: #2e2008; --df-edge: #ffe08a; --df-glow: rgba(255, 220, 110, 0.7); }

.df-cost {
  position: absolute;
  left: 3px;
  top: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #ffe9a8;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffdc7a, #d8800c);
  color: #3a1a02;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  z-index: 2;
}

.df-art {
  display: grid;
  place-items: center;
  width: 62%;
  aspect-ratio: 1;
  margin-top: 2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.04) 70%);
  box-shadow: 0 0 14px var(--df-glow);
}

.df-art .df-ico {
  width: 62%;
  height: 62%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.df-cname {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.df-cbody {
  flex: 1 1 auto;
  display: grid;
  align-items: center;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.12;
  color: #fff3e0;
}

.df-cflag {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--df-edge);
  opacity: 0.85;
}

.df-ckey {
  position: absolute;
  right: 4px;
  top: 3px;
  font-size: 10px;
  font-weight: 900;
  opacity: 0.55;
}

.df-up {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 0 0 1px #fff3b0, 0 0 14px rgba(255, 224, 120, 0.7);
}

.df-up .df-cname::after {
  content: "+";
  margin-left: 1px;
  color: #ffe08a;
}

.df-locked {
  filter: grayscale(0.75) brightness(0.62);
  cursor: default;
}

.df-sel {
  transform: translateY(-16px) scale(1.07);
  z-index: 3;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.6), 0 0 0 3px #fff3b0, 0 0 22px var(--df-glow);
}

.df-new {
  animation: df-deal 340ms cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}

.df-new:nth-child(2) { animation-delay: 45ms; }
.df-new:nth-child(3) { animation-delay: 90ms; }
.df-new:nth-child(4) { animation-delay: 135ms; }
.df-new:nth-child(5) { animation-delay: 180ms; }
.df-new:nth-child(6) { animation-delay: 225ms; }
.df-new:nth-child(n+7) { animation-delay: 270ms; }

.df-fly {
  position: fixed;
  z-index: 9999;
  max-width: none;
  margin: 0;
  pointer-events: none;
  transition: transform 360ms cubic-bezier(0.3, 0.1, 0.5, 1), opacity 360ms ease-in;
}

@media (hover: hover) {
  .df-card:not(.df-locked):not(.df-sel):hover {
    transform: translateY(-10px);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.55), 0 0 16px var(--df-glow);
  }
}

.df-controls {
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.df-hint {
  min-width: 0;
  color: var(--df-dim);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

#df-end {
  flex: none;
  min-width: 132px;
  min-height: 48px;
  font-size: 15px;
}

.df-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 14px;
  background: radial-gradient(80% 70% at 50% 40%, rgba(60, 26, 20, 0.92), rgba(12, 6, 10, 0.96));
  backdrop-filter: blur(3px);
  text-align: center;
  font-family: Inter, Arial, sans-serif;
  animation: df-fade 220ms ease;
}

#df-start {
  background: linear-gradient(180deg, rgba(12, 6, 10, 0.15), rgba(12, 6, 10, 0.78) 60%);
  backdrop-filter: none;
  justify-content: flex-end;
  padding-bottom: 96px;
}

.df-ovlabel {
  color: var(--df-gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.df-ovtitle {
  font-size: clamp(30px, 8vw, 52px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #fff3b8, #f0a030 60%, #d8620e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 12px rgba(255, 120, 30, 0.35));
}

.df-ovcopy {
  font-family: Inter, Arial, sans-serif;
  max-width: 420px;
  margin: 0;
  color: var(--df-dim);
  font-size: 14px;
  line-height: 1.4;
}

.df-ovbtns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.df-ovnote {
  color: var(--df-dim);
  font-size: 12px;
}

.df-choices {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  justify-content: center;
}

.df-choice {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 180px;
  min-height: 170px;
  padding: 28px 8px 10px;
  border: 2px solid var(--df-edge);
  border-radius: 14px;
  background: linear-gradient(170deg, var(--df-c1), var(--df-c2));
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: df-deal 380ms cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}

.df-choice:nth-child(2) { animation-delay: 70ms; }
.df-choice:nth-child(3) { animation-delay: 140ms; }

.df-choice.df-focus,
.df-choice:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.6), 0 0 22px var(--df-glow);
}

.df-choicekey {
  position: absolute;
  left: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  font-size: 12px;
  font-weight: 900;
}

.df-choiceart {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.04) 70%);
  box-shadow: 0 0 18px var(--df-glow);
}

.df-choiceart .df-ico {
  width: 32px;
  height: 32px;
}

.df-choice strong {
  font-size: 14px;
  font-weight: 900;
}

.df-choicebody {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff0dc;
}

.df-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 8, 12, 0.66);
}

.df-modal-card {
  position: relative;
  width: min(100%, 460px);
  max-height: 88vh;
  overflow: auto;
  padding: 22px 20px 18px;
  border-radius: 16px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.df-modal-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.df-modal-card p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
}

.df-modal .df-close {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 0;
  font-size: 20px;
}

.df-hidden {
  display: none !important;
}

@keyframes df-deal {
  from { opacity: 0; transform: translateY(46px) rotate(-6deg) scale(0.8); }
  to { opacity: 1; transform: none; }
}

@keyframes df-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes df-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes df-aim {
  0%, 100% { background-color: rgba(255, 90, 50, 0); }
  50% { background-color: rgba(255, 90, 50, 0.08); }
}

@keyframes df-throb {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

@keyframes df-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@media (min-width: 640px) {
  .df-hud {
    grid-template-columns: 1.4fr auto 1.2fr;
  }

  .df-panel-meta {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-start;
  }

  .df-stage {
    padding: 12px;
    gap: 12px;
  }

  .df-board {
    min-height: 330px;
  }

  .df-card {
    max-width: 132px;
    padding-top: 18px;
  }

  .df-cname {
    font-size: 13px;
  }

  .df-cbody {
    font-size: 11px;
  }

  .df-hand {
    gap: 10px;
    min-height: 168px;
  }

  .df-log {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .df-shell {
    padding: 0 8px 16px;
  }

  .df-stat {
    padding: 6px 8px;
  }

  .df-stat:first-child {
    display: none;
  }

  .df-btn {
    padding: 0 12px;
  }

  .df-cflag {
    display: none;
  }
}

@media (pointer: coarse) {
  .df-ckey {
    display: none;
  }

  .df-hint {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .df-new,
  .df-choice,
  .df-intent,
  .df-overlay,
  .df-foe.df-aim {
    animation: none;
  }
}
