:root {
  --ink:#243d32;
  --muted:#738073;
  --paper:#f4f0e5;
  --green:#254d3d;
  --line:#d6d9c8;
  --gold:#ad8343;
  --fire:#c87352;
  --wind:#8c9faf;
  --earth:#87996d;
  --water:#6497a9;
  --board-background:none;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--ink);
  background:var(--paper);
  font-synthesis:none
}

* {
  box-sizing:border-box
}

body {
  margin:0
}

button,input,select,textarea {
  font:inherit
}

button {
  cursor:pointer
}

button,a,input,select,textarea {
  outline-offset:4px
}

button {
  border:1px solid var(--line);
  background:#fbf9f1;
  color:var(--ink);
  border-radius:7px;
  padding:11px 17px;
  transition:background .18s,transform .18s
}

button:hover:not(:disabled) {
  background:#e8ebdf;
  transform:translateY(-1px)
}

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

.primary {
  background:var(--green);
  color:white;
  border-color:var(--green)
}

.primary:hover:not(:disabled) {
  background:#34684f
}

.quiet {
  background:transparent;
  border-color:transparent
}

.small {
  padding:7px 11px;
  font-size:12px
}

.danger {
  color:#a14b3f
}

.gold {
  color:var(--gold)
}

h1,h2,h3,p {
  margin:0
}

h1,h2,h3,.serif {
  font-family:Georgia,'Times New Roman',serif;
  font-weight:400
}

h1 {
  font-size:48px;
  letter-spacing:-2px
}

h2 {
  font-size:32px
}

h3 {
  font-size:23px
}

p {
  line-height:1.6
}

.muted {
  color:var(--muted)
}

.eyebrow {
  text-transform:uppercase;
  letter-spacing:3px;
  font-size:10px;
  font-weight:700;
  color:var(--gold)
}

.row {
  display:flex;
  align-items:center;
  gap:12px
}

.between {
  justify-content:space-between
}

.wrap {
  flex-wrap:wrap
}

.stack {
  display:grid;
  gap:16px
}

.grow {
  flex:1
}

.hidden {
  display:none!important
}

label {
  font-size:12px;
  display:grid;
  gap:7px
}

input,select,textarea {
  background:#fffdf6;
  border:1px solid #cbd1bf;
  border-radius:5px;
  padding:12px;
  color:var(--ink);
  min-width:0
}

input[type=checkbox] {
  width:17px;
  height:17px;
  accent-color:var(--green)
}

.check {
  display:flex;
  align-items:center;
  gap:9px
}

.tag {
  font-size:10px;
  padding:4px 7px;
  border:1px solid var(--line);
  border-radius:3px;
  display:inline-block
}

.divider {
  height:1px;
  background:var(--line);
  margin:20px 0
}

.empty {
  padding:45px;
  text-align:center;
  color:var(--muted)
}

.pill {
  background:#e4e9da;
  border-radius:20px;
  padding:7px 12px;
  font-size:12px
}

.coin {
  color:#957035;
  font-size:13px;
  letter-spacing:.5px
}

header {
  height:83px;
  padding:0 4vw;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:35px;
  background:#f5f2e9e8;
  position:relative;
  z-index:2
}

.brand {
  font-family:Georgia,serif;
  font-size:21px;
  letter-spacing:-.5px;
  padding:0;
  border:0;
  background:none;
  white-space:nowrap
}

.brand span {
  color:var(--gold);
  padding-right:9px
}

nav {
  display:flex;
  align-self:stretch;
  gap:8px
}

nav button {
  background:none;
  border:none;
  border-radius:0;
  color:var(--muted);
  font-size:12px;
  padding:0 16px
}

nav button.active {
  color:var(--green);
  box-shadow:inset 0 -3px var(--green)
}

header .account {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:20px
}

.avatar {
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#dce4d2;
  border-radius:50%;
  object-fit:cover;
  font-family:Georgia;
  font-size:23px;
  border:3px solid #faf8ef
}

.avatar.tiny {
  width:32px;
  height:32px;
  font-size:16px;
  border-width:1px
}

.content {
  max-width:1450px;
  margin:auto;
  padding:36px 4vw 60px
}

.page-head {
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:20px;
  margin-bottom:28px
}

.page-head h1 {
  margin-top:9px
}

.page-head p {
  font-size:13px;
  margin-top:10px
}

.notice {
  padding:12px 4vw;
  background:#e5ead7;
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:13px
}

.home {
  position:relative;
  min-height:calc(100svh - 83px);
  overflow:hidden;
  display:grid;
  grid-template-columns:1.05fr 1fr;
  align-items:center;
  padding:40px 10vw 110px;
  background:radial-gradient(ellipse at 80% 60%,#d5e0ce 0,transparent 45%)
}

.home:before {
  content:'';
  position:absolute;
  width:630px;
  height:630px;
  border:1px solid #bcc9b6;
  border-radius:50%;
  right:-90px;
  top:30px;
  box-shadow:0 0 0 70px #dce4d32e,0 0 0 71px #cad4bf55;
  pointer-events:none
}

.home-copy {
  position:relative;
  z-index:1
}

.home h1 {
  font-size:clamp(65px,7.6vw,118px);
  line-height:.96;
  margin:22px 0;
  letter-spacing:-5px
}

.home h1 em {
  font-weight:400;
  color:#638064
}

.home .intro {
  max-width:330px;
  color:var(--muted);
  font-size:14px
}

.menu-buttons {
  display:grid;
  gap:12px;
  max-width:300px;
  margin-top:35px
}

.menu-buttons button {
  text-align:left;
  padding:17px 22px;
  display:flex;
  justify-content:space-between;
  align-items:center
}

.menu-buttons .primary {
  padding:21px 22px
}

.home-art {
  position:relative;
  height:430px;
  display:flex;
  align-items:center;
  justify-content:center
}

.showcase.card {
  width:230px;
  min-height:330px;
  box-shadow:0 22px 35px #243d322a;
  position:absolute;
  pointer-events:none
}

.showcase:nth-child(1) {
  transform:rotate(-17deg) translate(-125px,25px)
}

.showcase:nth-child(2) {
  transform:rotate(13deg) translate(115px,12px)
}

.showcase:nth-child(3) {
  transform:rotate(-3deg);
  z-index:1
}

.home-art .card-art {
  height:180px
}

.home-art .card-name {
  font-size:20px
}

.home-art .card-text {
  font-size:12px;
  min-height:49px
}

.home-foot {
  position:absolute;
  bottom:30px;
  left:4vw;
  right:4vw;
  display:flex;
  justify-content:space-between;
  align-items:center
}

.profile-button {
  display:flex;
  align-items:center;
  gap:12px;
  background:none;
  border:none;
  text-align:left
}

.profile-button strong {
  display:block;
  font-size:13px;
  font-weight:500
}

.profile-button small {
  display:block;
  font-size:10px;
  color:var(--muted);
  margin-top:5px
}

.seasons {
  display:flex;
  gap:18px;
  font-size:11px;
  color:var(--muted)
}

.card {
  position:relative;
  width:100%;
  min-width:0;
  border:2px solid transparent;
  border-radius:12px;
  background:linear-gradient(#f9f6e9,#f9f6e9) padding-box,var(--edge,linear-gradient(135deg,#91a37b,#91a37b)) border-box;
  overflow:hidden;
  text-align:left;
  padding:7px;
  color:var(--ink);
  display:flex;
  flex-direction:column;
  box-shadow:0 3px 4px #263e3010;
  transition:transform .18s,box-shadow .18s
}

.card:hover:not(:disabled) {
  background:linear-gradient(#fffaf0,#fffaf0) padding-box,var(--edge) border-box;
  box-shadow:0 8px 16px #263e3020;
  transform:translateY(-4px)
}

.card.spell {
  border-radius:22px 22px 6px 6px
}

.card.enchant {
  border-radius:5px;
  border-width:3px
}

.card.totem {
  border-width:3px;
  outline:1px solid #b8a46c;
  outline-offset:2px
}

.card-art {
  height:108px;
  background:radial-gradient(ellipse at 50% 80%,#ffffff90,transparent 60%),var(--tint,#dce6d5);
  border-radius:7px;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  margin-bottom:8px;
  border:1px solid #ffffff90
}

.card-art:before,.card-art:after {
  content:'';
  position:absolute;
  border:1px solid #ffffff66;
  width:95px;
  height:95px;
  transform:rotate(45deg);
  border-radius:40%
}

.card-art:after {
  width:65px;
  height:65px;
  transform:rotate(70deg)
}

.card-art img {
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:1
}

.art-symbol {
  font-family:Georgia;
  font-size:65px;
  line-height:1;
  color:#315943a3;
  text-shadow:0 2px #fff8;
  z-index:1
}

.card.fire .art-symbol {
  color:#9e5039
}

.card.wind .art-symbol {
  color:#506c7d
}

.card.water .art-symbol {
  color:#407b8e
}

.mana {
  position:absolute;
  z-index:2;
  top:10px;
  left:10px;
  width:27px;
  height:31px;
  border-radius:50% 50% 45% 45%;
  background:#f9f7eb;
  border:1px solid #c4cdb5;
  display:grid;
  place-items:center;
  font:18px Georgia;
  color:#294e48;
  box-shadow:0 2px 5px #0002
}

.card-name {
  font:15px Georgia;
  margin:1px 3px 5px;
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden
}

.card-meta {
  font-size:8px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  margin:0 3px 8px;
  color:#818774;
  display:flex;
  justify-content:space-between;
  gap:4px
}

.card-text {
  font-size:10px;
  line-height:1.4;
  min-height:29px;
  margin:0 3px 8px;
  flex:1
}

.stats {
  display:flex;
  justify-content:space-between;
  border-top:1px solid #dce0cd;
  padding:6px 3px 0;
  font-family:Georgia;
  font-size:14px
}

.stats span:last-child {
  color:#a55f51
}

.element-dots {
  display:flex;
  gap:3px
}

.element-dot {
  width:7px;
  height:7px;
  border-radius:50%;
  background:var(--el)
}

.owned-label {
  position:absolute;
  right:9px;
  top:12px;
  border-radius:3px;
  background:#f8f5eae8;
  padding:3px 5px;
  z-index:2;
  font-size:8px
}

.cards-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:17px
}

.card.selected {
  outline:3px solid var(--gold);
  outline-offset:2px
}

.card.ready {
  box-shadow:0 0 0 2px #819f63
}

.card.sleeping {
  opacity:.75
}

.toolbar {
  display:flex;
  gap:12px;
  margin-bottom:20px;
  align-items:center;
  flex-wrap:wrap
}

.searchbox {
  position:relative;
  flex:1;
  min-width:180px
}

.searchbox input {
  width:100%;
  padding-left:36px
}

.searchbox span {
  position:absolute;
  left:13px;
  top:11px;
  color:var(--muted)
}

.filters {
  display:flex;
  gap:5px
}

.filters button {
  padding:9px 12px;
  font-size:11px;
  background:none
}

.filters button.active {
  background:var(--green);
  color:white;
  border-color:var(--green)
}

.book {
  position:relative;
  background:#dddacb;
  border:1px solid #c8c9b5;
  padding:9px;
  border-radius:9px;
  box-shadow:0 15px 30px #253b3012;
  perspective:1500px
}

.book-spread {
  background:linear-gradient(90deg,#f8f5e9 0%,#f8f5e9 48%,#d8d5c4 49.6%,#eeeade 50%,#fbf8ed 51.5%,#f9f6ec 100%);
  padding:28px 30px 20px;
  min-height:570px;
  border:1px solid #fff9;
  border-radius:4px
}

.book-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:65px
}

.book-page {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px;
  align-content:start
}

.book-footer {
  display:flex;
  justify-content:space-between;
  margin-top:25px;
  font:12px Georgia;
  color:#91947d
}

.book.flipping .book-spread {
  animation:pageflip .5s ease
}

@keyframes pageflip {
  0% {
    opacity:.4;
    transform:rotateY(-10deg);
    transform-origin:50% 50%
  }

  100% {
    opacity:1;
    transform:rotateY(0)
  }

}

.book-controls {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:25px;
  margin-top:22px;
  font-size:12px
}

.reorder-controls {
  display:flex;
  justify-content:center;
  gap:5px;
  margin-top:5px
}

.reorder-controls button {
  padding:3px 12px
}

.collection-foot {
  font-size:11px;
  color:var(--muted);
  margin-top:18px;
  text-align:center
}

.deck-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 310px;
  gap:28px
}

.panel {
  border:1px solid var(--line);
  padding:24px;
  border-radius:9px;
  background:#faf8f0
}

.deck-list {
  max-height:450px;
  overflow:auto;
  display:grid;
  gap:6px
}

.deck-row {
  display:flex;
  align-items:center;
  gap:8px;
  border-bottom:1px solid #e4e5d9;
  padding:7px 0;
  font-size:12px
}

.deck-row button {
  padding:3px 8px
}

.deck-row .count {
  color:var(--gold);
  width:20px
}

.totem-choice {
  padding:16px;
  background:#edf0e3;
  border-radius:7px;
  margin:12px 0
}

.deck-info {
  font-size:12px;
  line-height:1.7;
  color:var(--muted)
}

.play-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
  max-width:950px;
  margin:25px auto
}

.play-panel {
  padding:36px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f9f7ee;
  display:flex;
  flex-direction:column;
  gap:22px
}

.play-icon {
  font:70px Georgia;
  color:#77946e
}

.play-panel p {
  font-size:13px;
  color:var(--muted)
}

.play-panel button {
  margin-top:auto
}

.friend-layout {
  display:grid;
  grid-template-columns:1.3fr 1fr;
  gap:25px
}

.person {
  display:flex;
  align-items:center;
  gap:12px;
  border-bottom:1px solid var(--line);
  padding:15px 0
}

.person .name {
  font-size:14px
}

.person .sub {
  font-size:11px;
  color:var(--muted);
  margin-top:5px
}

.shop {
  max-width:1000px;
  margin:auto
}

.pack-display {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:60px;
  align-items:center;
  margin:40px 0
}

.pack {
  height:340px;
  width:235px;
  transform:rotate(-7deg);
  margin:auto;
  background:linear-gradient(135deg,#547b57,#213c31);
  border:7px double #bba678;
  border-radius:10px;
  box-shadow:20px 25px 30px #243d3226;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  color:#e6dfba;
  text-align:center
}

.pack .sigil {
  font-size:90px;
  font-family:Georgia
}

.pack h3 {
  font-size:35px
}

.pack p {
  font-size:10px;
  letter-spacing:3px
}

.pack-results {
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:12px
}

.pack-results .card {
  animation:reveal .5s both
}

.pack-results .card-art {
  height:80px
}

.pack-results .card-name {
  font-size:12px
}

.pack-results .card-text {
  font-size:9px
}

.reveal-status {
  text-align:center;
  font-size:10px;
  margin-top:8px;
  color:var(--gold)
}

@keyframes reveal {
  from {
    opacity:0;
    transform:translateY(25px) rotateY(90deg)
  }

  to {
    opacity:1;
    transform:none
  }

}

.auth-shell {
  min-height:100svh;
  display:grid;
  grid-template-columns:1fr 1fr;
  background:radial-gradient(ellipse at 20% 80%,#dce6d0,transparent 55%)
}

.auth-intro {
  display:flex;
  justify-content:center;
  flex-direction:column;
  padding:10vw
}

.auth-intro h1 {
  font-size:80px;
  line-height:1;
  letter-spacing:-4px;
  margin:20px 0
}

.auth-intro .sigil {
  font:120px Georgia;
  color:#708e6a
}

.auth-form {
  max-width:410px;
  align-self:center;
  justify-self:center;
  width:100%;
  padding:35px
}

.auth-form h2 {
  margin:15px 0
}

.auth-form p {
  font-size:13px;
  color:var(--muted);
  margin-bottom:24px
}

.auth-form form {
  display:grid;
  gap:17px
}

.auth-form .switch {
  font-size:12px;
  margin-top:18px;
  text-align:center
}

.auth-note {
  font-size:11px!important;
  margin-top:20px
}

.editor-layout {
  display:grid;
  grid-template-columns:1fr 280px;
  gap:30px
}

.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px
}

.span2 {
  grid-column:span 2
}

.checkgroup {
  display:flex;
  gap:12px;
  flex-wrap:wrap
}

.preview-card {
  max-width:250px
}

.editor-list {
  width:100%;
  margin-bottom:20px
}

.help {
  font-size:11px;
  color:var(--muted);
  line-height:1.6
}

.battle {
  background:var(--board-background),radial-gradient(ellipse at 50% 50%,#eef0e4,#e1e7d9);
  background-size:cover;
  min-height:calc(100svh - 83px);
  padding:18px 3vw
}

.battle-top {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  font-size:12px
}

.battle-layout {
  display:grid;
  grid-template-columns:150px minmax(0,1fr) 165px;
  gap:20px;
  max-width:1500px;
  margin:auto
}

.battle-center {
  min-width:0
}

.hero {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:14px;
  margin:6px auto;
  padding:8px 16px;
  border:1px solid #bdcbb4;
  border-radius:30px;
  background:#f8f6eb;
  max-width:320px;
  cursor:pointer
}

.hero strong {
  font:16px Georgia
}

.life {
  font:22px Georgia;
  color:#a3564a
}

.mana-line {
  font-size:10px;
  color:#607f89
}

.mana-pips {
  color:#6a95a2;
  font-size:15px;
  letter-spacing:3px
}

.enemy-hand {
  height:45px;
  display:flex;
  justify-content:center;
  gap:4px
}

.card-back {
  width:28px;
  height:38px;
  background:repeating-linear-gradient(45deg,#42624b,#42624b 4px,#4a6b51 4px,#4a6b51 6px);
  border:2px solid #b4ac83;
  border-radius:4px
}

.field {
  min-height:175px;
  display:flex;
  justify-content:center;
  gap:10px;
  align-items:center;
  padding:12px 0
}

.field .card {
  max-width:118px;
  min-width:65px
}

.field .card-art {
  height:65px
}

.field .art-symbol {
  font-size:40px
}

.field .card-name {
  font-size:11px
}

.field .card-text {
  font-size:8px;
  min-height:15px;
  margin-bottom:4px
}

.field .card-meta {
  font-size:6px;
  margin-bottom:4px
}

.field .mana {
  width:20px;
  height:22px;
  font-size:13px;
  top:8px;
  left:8px
}

.field .stats {
  font-size:14px
}

.battle-divider {
  display:flex;
  gap:15px;
  align-items:center;
  font-size:9px;
  text-transform:uppercase;
  letter-spacing:3px;
  color:#809076
}

.battle-divider:before,.battle-divider:after {
  content:'';
  height:1px;
  background:#aebfa2;
  flex:1
}

.hand {
  display:flex;
  justify-content:center;
  gap:8px;
  padding:12px 3px;
  overflow-x:auto;
  align-items:stretch
}

.hand .card {
  width:120px;
  min-width:100px;
  flex:0 1 120px
}

.hand .card-art {
  height:65px
}

.hand .art-symbol {
  font-size:42px
}

.hand .card-name {
  font-size:11px
}

.hand .card-text {
  font-size:9px;
  min-height:30px
}

.hand .card-meta {
  font-size:7px
}

.hand .mana {
  width:21px;
  height:24px;
  font-size:15px
}

.side-label {
  font-size:9px;
  text-transform:uppercase;
  letter-spacing:2px;
  color:var(--muted);
  margin:13px 0
}

.enchant-slot {
  border:1px dashed #aebb9d;
  padding:10px;
  border-radius:5px;
  font-size:10px;
  min-height:48px;
  margin-bottom:8px;
  background:#ffffff35;
  display:block;
  width:100%;
  text-align:left
}

.enchant-slot strong {
  font-family:Georgia;
  display:block;
  font-weight:400;
  margin-bottom:5px;
  font-size:12px
}

.totem-small .card-art {
  height:70px
}

.totem-small .card-name {
  font-size:13px
}

.totem-small .card-text {
  font-size:9px
}

.battle-log {
  font-size:10px;
  line-height:1.6;
  color:#72816a;
  max-height:150px;
  overflow:auto;
  margin-top:15px
}

.battle-log div {
  margin-bottom:5px
}

.turn-panel {
  background:#f6f5e8;
  padding:14px;
  border:1px solid #c8d0ba;
  border-radius:8px;
  font-size:11px;
  line-height:1.6
}

.turn-panel button {
  width:100%;
  margin-top:10px
}

.battle-hint {
  font-size:12px;
  text-align:center;
  color:#607654;
  min-height:25px;
  padding:5px
}

.result-banner {
  text-align:center;
  background:#f6f2df;
  border:1px solid #c3b27e;
  border-radius:10px;
  padding:20px;
  margin-bottom:15px
}

.result-banner h2 {
  margin-bottom:10px
}

dialog {
  border:1px solid #bfc9b1;
  border-radius:14px;
  padding:30px;
  background:var(--paper);
  color:var(--ink);
  width:min(520px,94vw);
  box-shadow:0 25px 90px #172d3530
}

dialog::backdrop {
  background:#192d2566;
  backdrop-filter:blur(4px)
}

dialog .close {
  float:right
}

.modal-card {
  max-width:220px;
  margin:15px auto
}

dialog h2 {
  margin-bottom:20px
}

dialog .stack {
  clear:both
}

#toast {
  position:fixed;
  bottom:25px;
  left:50%;
  transform:translate(-50%,25px);
  background:#254d3d;
  color:#fffaf0;
  border-radius:8px;
  padding:13px 22px;
  font-size:13px;
  box-shadow:0 5px 20px #0002;
  z-index:30;
  max-width:90vw;
  opacity:0;
  pointer-events:none;
  transition:.2s
}

#toast.show {
  opacity:1;
  transform:translate(-50%,0)
}

.error {
  color:#a1483a;
  font-size:12px;
  line-height:1.6
}

.success {
  color:#4c7952
}

.kbd {
  border:1px solid #ccd4c3;
  padding:2px 5px;
  border-radius:3px;
  font-size:10px
}

.loading {
  display:grid;
  place-items:center;
  min-height:90svh;
  font:24px Georgia
}

@media(min-width:1600px) {
  .book-page .card-art {
    height:135px
  }

}

@media(max-width:1100px) {
  header {
    gap:15px
  }

  nav {
    gap:0
  }

  nav button {
    padding:0 10px
  }

  .book-grid {
    gap:40px
  }

  .book-page {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }

  .book-spread {
    padding:22px
  }

  .cards-grid {
    grid-template-columns:repeat(3,1fr)
  }

  .home {
    padding-left:7vw;
    padding-right:7vw
  }

  .home-art {
    transform:scale(.85)
  }

  .battle-layout {
    grid-template-columns:115px minmax(0,1fr) 130px;
    gap:12px
  }

  .field {
    gap:5px
  }

  .field .card-text {
    display:none
  }

  .pack-results {
    grid-template-columns:repeat(4,1fr)
  }

}

@media(max-width:760px) {
  header {
    height:auto;
    min-height:68px;
    flex-wrap:wrap;
    padding:16px 5vw 0;
    gap:10px
  }

  .brand {
    font-size:19px
  }

  header .account {
    gap:10px
  }

  nav {
    order:3;
    width:100%;
    height:42px;
    justify-content:center
  }

  nav button {
    padding:0 12px;
    font-size:11px
  }

  .content {
    padding:25px 5vw
  }

  .page-head {
    align-items:start;
    flex-direction:column;
    gap:15px
  }

  h1 {
    font-size:37px
  }

  .home {
    grid-template-columns:1fr;
    min-height:calc(100svh - 112px);
    padding:35px 8vw 115px
  }

  .home h1 {
    font-size:75px
  }

  .home .intro {
    font-size:12px
  }

  .home-art {
    display:none
  }

  .home-copy {
    max-width:400px;
    margin:0 auto;
    width:100%
  }

  .menu-buttons {
    max-width:none
  }

  .home-foot {
    left:5vw;
    right:5vw
  }

  .seasons {
    font-size:9px;
    gap:7px
  }

  .book-grid {
    gap:22px
  }

  .book-page {
    grid-template-columns:1fr;
    gap:12px
  }

  .book-spread {
    padding:15px
  }

  .book-page .card-art {
    height:105px
  }

  .book-page .card:nth-child(n+4) {
    display:none
  }

  .toolbar {
    gap:8px
  }

  .filters {
    width:100%;
    overflow:auto
  }

  .filters button {
    flex:1;
    padding:8px;
    font-size:10px
  }

  .book {
    max-width:490px;
    margin:auto
  }

  .book-grid .card {
    max-width:100%
  }

  .deck-layout,.friend-layout,.editor-layout {
    grid-template-columns:1fr
  }

  .deck-layout aside {
    order:-1
  }

  .deck-list {
    max-height:150px
  }

  .cards-grid {
    grid-template-columns:repeat(3,1fr);
    gap:10px
  }

  .cards-grid .card-art {
    height:85px
  }

  .cards-grid .card-name {
    font-size:12px
  }

  .play-grid {
    grid-template-columns:1fr;
    margin-top:15px;
    gap:15px
  }

  .play-panel {
    padding:25px
  }

  .play-icon {
    font-size:45px
  }

  .pack-display {
    gap:25px
  }

  .pack {
    width:150px;
    height:230px;
    border-width:5px
  }

  .pack h3 {
    font-size:24px
  }

  .pack .sigil {
    font-size:60px
  }

  .pack-results {
    grid-template-columns:repeat(3,1fr)
  }

  .auth-shell {
    grid-template-columns:1fr
  }

  .auth-intro {
    padding:35px 35px 0;
    text-align:center
  }

  .auth-intro h1 {
    font-size:55px
  }

  .auth-intro .sigil,.auth-intro p {
    display:none
  }

  .auth-form {
    padding:20px 30px
  }

  .battle {
    padding:12px 8px
  }

  .battle-layout {
    grid-template-columns:minmax(0,1fr) 95px;
    gap:8px
  }

  .battle-left {
    grid-column:1 / -1;
    display:flex;
    gap:10px
  }

  .battle-left>div {
    flex:1
  }

  .side-label {
    font-size:8px;
    letter-spacing:1px
  }

  .enchant-slot {
    display:inline-block;
    width:auto;
    font-size:8px;
    padding:5px;
    min-height:30px;
    margin:2px
  }

  .enchant-slot strong {
    font-size:9px
  }

  .battle-center {
    grid-column:1
  }

  .field {
    min-height:135px;
    gap:3px;
    overflow-x:auto;
    justify-content:flex-start
  }

  .field .card {
    flex:0 0 72px;
    min-width:72px
  }

  .field .card-art {
    height:50px
  }

  .field .card-name {
    font-size:9px
  }

  .field .card-meta {
    display:none
  }

  .field .stats {
    font-size:11px
  }

  .battle-log {
    font-size:8px
  }

  .turn-panel {
    padding:8px;
    font-size:9px
  }

  .turn-panel button {
    font-size:10px;
    padding:9px 5px
  }

  .totem-small .card-art {
    height:50px
  }

  .totem-small .card-name {
    font-size:10px
  }

  .totem-small .card-text {
    font-size:8px
  }

  .totem-small .card-meta {
    display:none
  }

  .hero {
    padding:7px 10px;
    gap:9px
  }

  .hero strong {
    font-size:12px
  }

  .life {
    font-size:18px
  }

  .hand {
    justify-content:flex-start;
    gap:5px
  }

  .hand .card {
    min-width:91px
  }

  .battle-hint {
    font-size:10px
  }

  .battle-top {
    font-size:10px
  }

  .battle-divider {
    font-size:7px;
    letter-spacing:1px
  }

  .span2 {
    grid-column:auto
  }

  .form-grid {
    grid-template-columns:1fr
  }

}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    animation:none!important;
    transition:none!important
  }

}

/* A paper leaf turns around the book's center binding. */
.book.flipping .book-spread {
  animation:spreadfade .55s ease
}

.book.flipping:after {
  content:'';
  position:absolute;
  top:10px;
  bottom:10px;
  left:50%;
  width:calc(50% - 10px);
  background:linear-gradient(90deg,#d9d4be,#fbf8ed 12%,#eee9d8);
  border:1px solid #e4dfce;
  border-radius:0 4px 4px 0;
  transform-origin:left center;
  backface-visibility:visible;
  pointer-events:none;
  animation:turnleaf .55s ease-in-out both;
  z-index:2;
  box-shadow:12px 3px 20px #253b3014
}

@keyframes turnleaf {
  0% {
    transform:rotateY(0);
    opacity:1
  }

  80% {
    opacity:1
  }

  100% {
    transform:rotateY(-179deg);
    opacity:0
  }

}

@keyframes spreadfade {
  from {
    opacity:.5
  }

  to {
    opacity:1
  }

}

/* Previous: mirror the paper leaf, pivot and rotation around the binding. */
.book.flipping.flip-backward:after {
  left:10px;
  background:linear-gradient(270deg,#d9d4be,#fbf8ed 12%,#eee9d8);
  border-radius:4px 0 0 4px;
  transform-origin:right center;
  animation-name:turnleaf-backward;
  box-shadow:-12px 3px 20px #253b3014
}

@keyframes turnleaf-backward {
  0% {
    transform:rotateY(0);
    opacity:1
  }

  80% {
    opacity:1
  }

  100% {
    transform:rotateY(179deg);
    opacity:0
  }

}

/* Shared menu card: dimensions, artwork, typography and stat positions stay fixed.
   Responsive layouts change the number of columns, never the card's scale. */
:root {
  --menu-card-width:180px;
  --menu-card-height:280px
}

.card.standard-card {
  width:var(--menu-card-width);
  min-width:var(--menu-card-width);
  max-width:var(--menu-card-width);
  height:var(--menu-card-height);
  min-height:var(--menu-card-height);
  max-height:var(--menu-card-height);
  flex:none;
  display:grid;
  grid-template-rows:112px 36px 12px minmax(0,1fr) 24px;
  gap:4px;
  padding:7px;
  align-content:stretch
}

.card.standard-card:is(.enchant,.totem) {
  padding:6px
}

.card.standard-card .card-art {
  height:112px;
  min-height:112px;
  width:100%;
  margin:0
}

.card.standard-card .card-name {
  font:15px/18px Georgia,'Times New Roman',serif;
  white-space:normal;
  overflow:hidden;
  text-overflow:ellipsis;
  margin:0 3px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow-wrap:anywhere
}

.card.standard-card .card-meta {
  font:8px/12px Arial,Helvetica,sans-serif;
  letter-spacing:1.2px;
  margin:0 3px;
  display:flex
}

.card.standard-card .card-text {
  font:10px/14px Arial,Helvetica,sans-serif;
  min-height:0;
  margin:0 3px;
  overflow:auto;
  overflow-wrap:anywhere;
  align-self:stretch
}

.card.standard-card .stats {
  font:14px/17px Georgia,'Times New Roman',serif;
  height:24px;
  margin:0;
  padding:6px 3px 0
}

.card.standard-card .art-symbol {
  font-size:65px
}

.card.standard-card .mana {
  width:27px;
  height:31px;
  top:10px;
  left:10px;
  font:18px Georgia
}

.cards-grid,.pack-results {
  grid-template-columns:repeat(auto-fit,var(--menu-card-width));
  gap:20px;
  justify-content:center;
  align-items:start
}

.pack-results>div {
  width:var(--menu-card-width)
}

.preview-card,.modal-card {
  width:var(--menu-card-width);
  max-width:var(--menu-card-width)
}

.preview-card {
  margin-inline:auto
}

.book-viewport {
  overflow-x:auto;
  padding:5px 4px 24px;
  margin-inline:-4px
}

.book {
  min-width:430px;
  max-width:none;
  margin:0
}

.book-grid {
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:22px
}

.book-page {
  grid-template-columns:var(--menu-card-width);
  gap:16px;
  justify-content:center
}

.book-page>div {
  width:var(--menu-card-width)
}

.book-spread {
  padding:20px 15px;
  min-height:625px
}

.book-footer {
  gap:15px;
  font-size:10px
}

@media(min-width:1000px) {
  .book-grid {
    gap:40px
  }

  .book-page {
    grid-template-columns:repeat(2,var(--menu-card-width))
  }

  .book-spread {
    padding:24px 22px
  }

}

@media(min-width:1440px) {
  .book-grid {
    gap:50px
  }

  .book-page {
    grid-template-columns:repeat(3,var(--menu-card-width))
  }

}

/* Keep the menu illustration at the same actual card scale, even on tablets. */
.home-art {
  transform:none
}

/* ============================================================
   ARCADE OVERHAUL / PATCH 2
   Square-edge pixel-terminal styling, crisp contrast, smooth UI.
   ============================================================ */
:root {
  --ink:#fff4dc;
  --muted:#bdb2cc;
  --paper:#15101e;
  --green:#d3fb5b;
  --line:#54475e;
  --gold:#ffc857;
  --fire:#fa665c;
  --wind:#90b5ff;
  --earth:#b4e078;
  --water:#5fe1da;
  --surface:#21182d;
  --surface2:#2a1e36;
  --black:#0c0913;
  --neon:#d3fb5b;
  font-family:'Trebuchet MS',Verdana,Arial,sans-serif;
  color:var(--ink);
  background:var(--paper);
}

body {
  background:
    radial-gradient(ellipse at 78% 3%,#6d326737 0%,transparent 34%),
    radial-gradient(ellipse at 2% 55%,#22565c2b 0%,transparent 32%),
    repeating-linear-gradient(0deg,transparent 0 39px,#ffffff04 39px 40px),
    var(--paper);
  min-height:100svh;
}

body::after {
  content:'';
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:15;
  opacity:.22;
  background:repeating-linear-gradient(to bottom,transparent 0px,transparent 3px,#0c09131c 4px,#0c09131c 5px);
}

h1,h2,h3,.serif,.brand {
  font-family:Impact,'Arial Black','Trebuchet MS',sans-serif;
  font-weight:800;
  font-style:normal;
  letter-spacing:.7px;
  text-transform:uppercase;
}

h1 {
  font-size:clamp(36px,4.3vw,62px);
  line-height:1.05;
  letter-spacing:1px;
  text-shadow:3px 3px 0 #0008
}

h2 {
  font-size:clamp(23px,3vw,35px);
  line-height:1.12
}

h3 {
  font-size:19px
}

.home h1 {
  font-size:clamp(69px,8vw,126px);
  line-height:.89;
  letter-spacing:1px
}

.home h1 em,.auth-intro h1 em {
  color:var(--green);
  font-style:normal;
  text-shadow:5px 5px 0 var(--black)
}

.eyebrow {
  color:var(--gold);
  letter-spacing:2.5px;
  font-size:11px;
  font-family:Consolas,'Courier New',monospace
}

.coin {
  color:var(--gold);
  font-weight:800;
  font-family:Consolas,'Courier New',monospace;
  font-size:14px
}

.help,.muted,.person .sub {
  color:var(--muted)
}

.error,.danger {
  color:#ff807d
}

.success {
  color:var(--neon)
}

button,input,select,textarea {
  font-family:inherit
}

button {
  border:2px solid #080710;
  border-radius:1px;
  background:#352740;
  color:var(--ink);
  font-weight:800;
  box-shadow:4px 4px 0 var(--black);
  transition:transform .2s cubic-bezier(.16,1,.3,1),background .2s ease,box-shadow .2s cubic-bezier(.16,1,.3,1),border-color .2s;
}

button:hover:not(:disabled) {
  background:#594064;
  transform:translate(-2px,-2px);
  box-shadow:6px 6px 0 var(--black)
}

button:active:not(:disabled) {
  transform:translate(2px,2px);
  box-shadow:1px 1px 0 var(--black)
}

button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline:3px solid var(--gold);
  outline-offset:3px
}

button:disabled {
  opacity:.53;
  filter:saturate(.6)
}

.primary {
  color:var(--black);
  background:var(--green);
  border-color:var(--black);
  text-transform:uppercase
}

.primary:hover:not(:disabled) {
  color:var(--black);
  background:#f3ffac
}

.quiet {
  color:var(--ink);
  background:transparent;
  border-color:transparent;
  box-shadow:none
}

.quiet:hover:not(:disabled) {
  background:#393047;
  box-shadow:none
}

button.danger:not(.quiet) {
  background:#3c192c;
  border-color:#f05a69;
  color:#ffa1ac
}

input,select,textarea {
  background:#110e1a;
  color:var(--ink);
  border:2px solid var(--line);
  border-radius:0;
  box-shadow:inset 2px 2px 0 #0008
}

input::placeholder,textarea::placeholder {
  color:#9c8eab
}

input[type=checkbox] {
  accent-color:var(--green)
}

input:disabled {
  opacity:.6
}

.tag,.pill {
  background:#2e2539;
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:1px;
  font-family:Consolas,'Courier New',monospace;
  letter-spacing:.5px
}

.divider {
  height:2px;
  background:repeating-linear-gradient(90deg,var(--line) 0 15px,transparent 15px 21px)
}

.empty {
  color:var(--muted)
}

header {
  height:83px;
  background:#191222;
  border-bottom:4px solid #080710;
  box-shadow:0 5px 0 #d3fb5b18;
  gap:26px;
  z-index:5
}

.brand {
  color:var(--ink);
  font-size:25px;
  letter-spacing:.5px;
  text-transform:uppercase;
  border:none;
  box-shadow:none;
  background:none
}

.brand span {
  color:var(--green)
}

.brand:hover:not(:disabled) {
  color:var(--green);
  background:transparent;
  box-shadow:none
}

nav {
  align-items:stretch;
  gap:3px;
  overflow-x:auto;
  overflow-y:hidden
}

nav button {
  color:#b8a9c7;
  font-family:Consolas,'Courier New',monospace;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
  text-transform:uppercase;
  box-shadow:none;
  padding:0 11px
}

nav button:hover:not(:disabled) {
  box-shadow:none;
  background:#3a294c;
  transform:none;
  color:var(--ink)
}

nav button.active {
  color:var(--green);
  box-shadow:inset 0 -4px var(--green);
  background:#272033
}

.account {
  white-space:nowrap
}

.avatar {
  background:#48314b;
  border:3px solid var(--neon);
  border-radius:3px;
  color:var(--ink);
  font-family:Impact,Arial,sans-serif
}

.avatar.tiny {
  border-width:2px
}

.notice,.trade-alert {
  background:#3b2c17;
  border-top:2px solid var(--gold);
  border-bottom:2px solid var(--gold);
  color:var(--ink);
  gap:12px
}

.content {
  padding-top:44px
}

.page-head {
  border-bottom:2px solid var(--line);
  padding-bottom:20px;
  margin-bottom:27px
}

.page-head h1 {
  margin-top:7px
}

.home {
  background:
    linear-gradient(140deg,transparent 65%,#3e244660 65%,#3e244660 66%,transparent 66%),
    radial-gradient(circle at 76% 50%,#c4f95b22 0%,transparent 43%),
    repeating-linear-gradient(90deg,transparent 0 83px,#ffffff05 83px 84px),var(--paper);
}

.home:before {
  border:4px dashed #889d57a0;
  border-radius:0;
  transform:rotate(19deg);
  box-shadow:0 0 0 14px #d3fb5b14,0 0 0 20px #d3fb5b08
}

.home .intro {
  color:var(--muted)
}

.home-art .card {
  box-shadow:10px 14px 0 #000a
}

.home-foot {
  border-top:2px dashed var(--line);
  padding-top:13px
}

.home .profile-button {
  box-shadow:none
}

.home .profile-button:hover {
  box-shadow:none
}

.seasons {
  font-family:Consolas,'Courier New',monospace;
  font-size:11px;
  color:#9dacb5
}

.panel,.play-panel,.turn-panel,.result-banner,.totem-choice {
  background:var(--surface);
  border:3px solid #080710;
  border-radius:1px;
  box-shadow:6px 6px 0 #090610;
}

.panel,.play-panel {
  padding:24px
}

.play-panel {
  background:linear-gradient(140deg,#2b203a,#21182d)
}

.play-panel h2 {
  color:var(--ink)
}

.play-icon {
  color:var(--green)
}

.totem-choice {
  background:#2f2940;
  box-shadow:none
}

.deck-row {
  border-bottom:1px dashed var(--line)
}

.deck-row .count {
  color:var(--green)
}

.person {
  border-bottom:2px dashed #584a65
}

.person .name {
  font-family:Consolas,'Courier New',monospace;
  font-weight:800;
  font-size:14px
}

.filters button {
  border:1px solid var(--line);
  box-shadow:none
}

.filters button:hover {
  box-shadow:none
}

.filters button.active {
  background:var(--green);
  color:var(--black);
  border-color:var(--green)
}

.book {
  background:#080710;
  border:3px solid var(--line);
  border-radius:0;
  box-shadow:10px 13px 0 #050307
}

.book-spread {
  background:linear-gradient(90deg,#241a32 0 48.6%,#120e1a 49.5% 50.5%,#241a32 51.4% 100%);
  border:2px solid #5d4973;
  border-radius:0
}

.book-footer {
  color:var(--gold);
  font-family:Consolas,'Courier New',monospace;
  font-size:11px
}

.book.flipping:after {
  border:3px solid #705b83;
  border-radius:0;
  box-shadow:10px 4px 0 #080710;
  background:linear-gradient(90deg,#38294b,#21172e 70%,#453453)
}

.book.flipping.flip-backward:after {
  box-shadow:-10px 4px 0 #080710;
  background:linear-gradient(270deg,#38294b,#21172e 70%,#453453)
}

.book-controls {
  font-family:Consolas,'Courier New',monospace;
  font-weight:800
}

.card,.card.spell,.card.enchant,.card.totem {
  --rarity-accent:#ad9db9;
  border:3px solid var(--rarity-accent);
  border-radius:2px;
  background:
    repeating-linear-gradient(90deg,transparent 0 5px,#ffffff06 5px 6px),
    linear-gradient(160deg,#342640,#1e172c);
  color:#fff7e6;
  box-shadow:3px 4px 0 #090710;
  transition:transform .23s cubic-bezier(.2,.9,.25,1),box-shadow .23s cubic-bezier(.2,.9,.25,1),filter .2s ease;
}

.card.rarity-common {
  --rarity-accent:#b5a5b6
}

.card.rarity-uncommon {
  --rarity-accent:#8fe0a7
}

.card.rarity-rare {
  --rarity-accent:#ffd067
}

.card.rarity-mysterious {
  --rarity-accent:#f08cff
}

.card:hover:not(:disabled) {
  background:linear-gradient(150deg,#453253,#292139);
  box-shadow:6px 8px 0 #090710;
  transform:translate(-2px,-4px);
  filter:brightness(1.12)
}

.card:disabled {
  filter:saturate(.7);
  opacity:.55
}

.card.totem {
  outline:2px dashed #e5c579;
  outline-offset:1px
}

.card .card-art {
  background:repeating-linear-gradient(45deg,#11162222 0 9px,#2e234133 9px 18px),var(--tint,#7c7777);
  border:2px solid #0d0912;
  border-radius:0
}

.card-art:before,.card-art:after {
  border-radius:0;
  border-color:#ffffff55
}

.card .art-symbol {
  text-shadow:2px 2px #0008
}

.card .card-name {
  font-family:Impact,'Arial Narrow',sans-serif;
  font-size:15px;
  font-weight:700;
  letter-spacing:.3px;
  text-transform:uppercase;
  color:var(--ink)
}

.card .card-meta {
  color:#dbcee0;
  align-items:center;
  letter-spacing:.1px;
  text-transform:uppercase;
  gap:4px
}

.card .card-text {
  color:#f0e4f1
}

.card .stats {
  border-top:2px solid #5a5068;
  font-family:Consolas,'Courier New',monospace;
  color:var(--ink)
}

.card .stats span:last-child {
  color:#ffaaaa
}

.card .mana {
  border:2px solid #0b0a11;
  background:var(--green);
  border-radius:2px;
  color:var(--black);
  font-family:Impact,sans-serif;
  font-size:18px;
  box-shadow:2px 3px 0 #0b0a11
}

.card .owned-label {
  background:#0e0916ef;
  color:var(--green);
  border:1px solid var(--rarity-accent);
  border-radius:0;
  font-family:Consolas,monospace;
  font-size:8px;
  font-weight:800;
  max-width:122px;
  text-align:right
}

.card .element-dot {
  border-radius:0;
  width:6px;
  height:6px;
  border:1px solid #0006
}

.rarity-chip {
  display:inline-block;
  color:#ebe5f1;
  text-shadow:1px 1px 0 #000;
  font-family:Consolas,'Courier New',monospace;
  font-size:7px;
  letter-spacing:.1px;
  text-transform:uppercase;
  white-space:nowrap
}

.rarity-chip.rarity-common {
  color:#d7cbd7
}

.rarity-chip.rarity-uncommon {
  color:#a4ffb5
}

.rarity-chip.rarity-rare {
  color:#ffe39a
}

.rarity-chip.rarity-mysterious {
  color:#ffaeff
}

.card.standard-card {
  width:var(--menu-card-width);
  min-width:var(--menu-card-width);
  max-width:var(--menu-card-width);
  height:var(--menu-card-height);
  min-height:var(--menu-card-height);
  max-height:var(--menu-card-height)
}

.card.standard-card .card-art {
  height:112px;
  min-height:112px
}

.card.standard-card .card-name {
  font-family:Impact,'Arial Narrow',sans-serif;
  font-size:15px;
  line-height:18px
}

.card.standard-card .card-text {
  font-size:10px;
  line-height:14px
}

.card.standard-card .stats {
  font-family:Consolas,'Courier New',monospace;
  font-size:13px
}

.card.standard-card .mana {
  font-family:Impact,sans-serif;
  font-size:18px
}

.card.selected {
  outline:3px solid var(--green)
}

.card.ready {
  box-shadow:0 0 0 3px var(--green)
}

.pack-display {
  gap:50px
}

.shop {
  max-width:1250px
}

.pack {
  background:repeating-linear-gradient(45deg,#8d324d 0 8px,#a73659 8px 16px);
  color:#fef7d9;
  border:8px double var(--gold);
  border-radius:1px;
  box-shadow:15px 18px 0 #06040b;
  animation:pack-idle 3.4s ease-in-out infinite
}

.pack h3 {
  color:var(--green);
  text-shadow:3px 3px 0 var(--black)
}

.pack .sigil {
  color:#ffe9a9;
  text-shadow:0 0 25px #ffecb988
}

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

.odds span {
  display:flex;
  justify-content:space-between;
  gap:5px;
  padding:10px 8px;
  border:1px solid var(--line);
  background:#2e2537;
  font:10px Consolas,monospace;
  color:var(--muted)
}

.odds span b {
  color:var(--green)
}

.pack-results {
  grid-template-columns:repeat(auto-fit,var(--menu-card-width));
  gap:22px;
  justify-content:center
}

.pack-results>div {
  width:var(--menu-card-width)
}

.pack-results .pack-pull {
  animation:card-enter .58s cubic-bezier(.16,1,.3,1) both;
  will-change:transform,opacity
}

.pack-results .card {
  animation:none
}

.reveal-status {
  color:var(--gold);
  font-family:Consolas,monospace;
  font-size:10px;
  text-transform:uppercase
}

/* Keep first discoveries gold; duplicate copies use neutral grey. */
.pack-results .reveal-status.is-duplicate {
  color:#a6a6ae;
}

@keyframes card-enter {
  0% {
    opacity:0;
    transform:translateY(34px) scale(.9) rotate(-3deg)
  }

  65% {
    opacity:1
  }

  100% {
    opacity:1;
    transform:translateY(0) scale(1) rotate(0)
  }

}

@keyframes pack-idle {
  0%,100% {
    transform:translateY(0) rotate(-6deg)
  }

  50% {
    transform:translateY(-7px) rotate(-4deg)
  }

}

.auth-shell {
  background:radial-gradient(ellipse at 15% 90%,#474b246b,transparent 45%),repeating-linear-gradient(90deg,transparent 0 45px,#fff1 45px 46px),var(--paper)
}

.auth-form {
  background:var(--surface);
  border:3px solid #756181;
  box-shadow:9px 9px 0 #080710;
  max-width:440px
}

.auth-intro .sigil {
  color:var(--green)
}

.auth-intro h1 {
  font-size:clamp(48px,7vw,104px)
}

.auth-form h2 {
  color:var(--green)
}

.battle {
  background:radial-gradient(ellipse at 48% 40%,#493a5455,transparent 65%),repeating-linear-gradient(0deg,#16111b,#16111b 35px,#191522 35px,#191522 36px);
  min-height:calc(100svh - 83px)
}

.hero,.enchant-slot,.turn-panel,.result-banner {
  color:var(--ink);
  background:#2c2337;
  border:2px solid #766886;
  border-radius:2px
}

.hero strong {
  font:800 15px Consolas,monospace
}

.life {
  font:800 20px Consolas,monospace;
  color:#ff8989
}

.mana-line {
  color:#bcd1cf
}

.mana-pips {
  color:var(--green)
}

.battle-divider {
  color:var(--gold)
}

.battle-divider:before,.battle-divider:after {
  background:var(--line)
}

.enchant-slot {
  border-style:dashed;
  box-shadow:none
}

.enchant-slot strong {
  font-family:Consolas,monospace;
  font-weight:800
}

.battle-log {
  color:var(--muted)
}

.battle-hint {
  color:#d9d3cb
}

.result-banner {
  background:#382a3d
}

.card-back {
  background:repeating-linear-gradient(45deg,#442c55,#442c55 4px,#66753c 4px,#66753c 6px);
  border:2px solid var(--green)
}

dialog {
  background:#241b32;
  border:3px solid var(--green);
  border-radius:1px;
  box-shadow:12px 14px 0 var(--black);
  color:var(--ink);
  width:min(690px,94vw)
}

dialog::backdrop {
  background:#0b0513c9;
  backdrop-filter:blur(4px)
}

#toast {
  background:#d3fb5b;
  color:#0c0913;
  border:3px solid #080710;
  box-shadow:5px 5px 0 #080710;
  border-radius:1px;
  font-weight:800;
  font-family:Consolas,monospace
}

/* Trade terminal */
.trade-page {
  max-width:1450px
}

.trade-hero {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:22px;
  padding:24px 29px;
  border:3px solid #0b0710;
  border-left:8px solid var(--green);
  background:linear-gradient(120deg,#382241,#261d35 68%);
  box-shadow:6px 7px 0 #090610;
  margin-bottom:24px
}

.trade-hero h2 {
  margin:8px 0 12px;
  color:var(--ink)
}

.trade-hero p {
  font-size:13px;
  max-width:610px
}

.trade-terminal-icon {
  font:900 clamp(45px,7vw,100px) Impact,sans-serif;
  color:var(--green);
  text-shadow:6px 6px 0 #090610;
  flex-shrink:0
}

.trade-players {
  margin:18px 0
}

.trade-players h3 {
  padding-bottom:14px;
  border-bottom:2px dashed var(--line)
}

.trade-columns {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:22px;
  margin:20px 0
}

.trade-offer {
  background:#241b31;
  border:3px solid #5a4e69;
  padding:18px 20px;
  min-height:185px;
  box-shadow:6px 6px 0 #080710;
  transition:border-color .23s,background .23s
}

.trade-offer.is-locked {
  border-color:var(--green);
  background:#253029
}

.trade-offer .row h3 {
  font-size:18px
}

.trade-offer-items {
  display:grid;
  gap:8px;
  padding:13px 0;
  min-height:58px;
  align-content:start
}

.trade-offer-item {
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px;
  background:#160f21;
  border:1px solid #554665;
  min-width:0
}

.trade-offer-item strong {
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px
}

.trade-offer-item small {
  display:block;
  color:var(--muted);
  text-transform:uppercase;
  font:10px Consolas,monospace;
  margin-top:4px
}

.offer-quantity {
  color:var(--green);
  font:800 16px Consolas,monospace
}

.offer-symbol {
  font-size:24px;
  color:var(--gold)
}

.trade-empty {
  padding-top:15px;
  text-align:center
}

.trade-coin-line {
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-top:2px dashed #5a4a6a;
  padding:14px 0 0;
  color:var(--gold);
  font:800 14px Consolas,monospace
}

.trade-status {
  display:inline-block;
  padding:7px 9px;
  border:1px solid var(--line);
  font:800 10px Consolas,'Courier New',monospace;
  letter-spacing:1px;
  white-space:nowrap;
  color:var(--gold)
}

.is-locked .trade-status,.trade-status.trade-confirmed {
  color:var(--green);
  border-color:var(--green)
}

.trade-controls {
  padding:20px 22px;
  background:#2f203a;
  border:2px solid #695279;
  display:grid;
  gap:17px
}

.trade-controls form {
  gap:14px
}

.trade-controls label {
  font:800 12px Consolas,monospace;
  color:var(--gold)
}

.trade-controls input {
  width:175px
}

.trade-actions {
  gap:20px
}

.trade-note {
  font-size:12px;
  color:var(--muted)
}

.trade-stock-title {
  margin-top:34px;
  margin-bottom:16px;
  border-bottom:2px solid var(--line);
  padding-bottom:14px
}

.trade-stock-title h3 {
  margin-top:5px
}

.trade-inventory {
  grid-template-columns:repeat(auto-fit,var(--menu-card-width));
  justify-content:start;
  gap:24px
}

.trade-stock {
  width:var(--menu-card-width);
  min-width:var(--menu-card-width)
}

.trade-stock>.row {
  margin-top:13px
}

.trade-stock .card[disabled] {
  opacity:.81;
  filter:saturate(.7)
}

.trade-stock .card[disabled]:hover {
  transform:none;
  box-shadow:3px 4px 0 #090710
}

.trade-stock .trade-count {
  font:800 10px Consolas,monospace;
  color:var(--gold)
}

.trade-complete {
  border:3px solid var(--green);
  background:#263928;
  padding:22px;
  margin-bottom:20px;
  animation:card-enter .6s ease-out
}

.trade-complete span {
  font:800 12px Consolas,monospace;
  color:var(--green)
}

.trade-complete h2 {
  margin:11px 0
}

.trade-history-title {
  margin:20px 0
}

.trade-history {
  display:grid;
  gap:9px
}

.trade-history-row {
  display:flex;
  align-items:center;
  gap:12px;
  padding:9px 14px;
  background:#221a2c;
  border:1px solid var(--line);
  font-size:13px
}

.history-view {
  gap:10px
}

.history-view .trade-offer {
  padding:12px;
  box-shadow:none
}

@media(max-width:1100px) {
  header {
    gap:9px
  }

  nav button {
    padding:0 8px;
    font-size:11px
  }

  .trade-inventory {
    justify-content:center
  }

}

@media(max-width:760px) {
  header {
    padding-top:11px
  }

  nav {
    justify-content:flex-start;
    gap:0;
    width:100%
  }

  nav button {
    padding:8px 10px
  }

  .home h1 {
    font-size:clamp(58px,15vw,94px)
  }

  .home:before {
    opacity:.3
  }

  .book {
    max-width:none
  }

  .book-viewport {
    overflow-x:auto
  }

  .pack-display {
    grid-template-columns:1fr;
    gap:28px
  }

  .pack {
    height:240px;
    width:155px
  }

  .pack h3 {
    font-size:25px
  }

  .trade-columns {
    grid-template-columns:1fr
  }

  .trade-hero {
    padding:18px
  }

  .trade-hero .trade-terminal-icon {
    font-size:50px
  }

  .trade-controls {
    padding:12px
  }

  .trade-controls input {
    max-width:145px
  }

  .odds {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }

  dialog {
    padding:20px
  }

  .card.standard-card .card-art {
    height:112px;
    min-height:112px
  }

}

@media(prefers-reduced-motion:reduce) {
  .pack,.pack-results .pack-pull,.trade-complete {
    animation:none!important
  }

}

/* Final small-screen refinements: wrapped header, readable book and clear footer. */
@media(max-width:760px) {
  header {
    height:auto;
    min-height:70px;
    flex-wrap:wrap;
    align-items:center;
    gap:7px;
    padding:10px 5vw 0
  }

  header .account {
    margin-left:auto
  }

  header nav {
    order:3;
    display:flex;
    justify-content:flex-start;
    align-self:stretch;
    flex:none;
    width:100%;
    height:44px;
    min-height:44px;
    padding-bottom:3px;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:thin;
    scrollbar-color:var(--green) #1b1424
  }

  header nav button {
    flex:0 0 auto;
    white-space:nowrap;
    padding:0 11px;
    font-size:10px
  }

  .home {
    min-height:calc(100svh - 114px);
    padding-bottom:146px
  }

  .home-foot {
    display:flex;
    align-items:flex-start;
    flex-direction:column;
    gap:7px;
    left:6vw;
    right:6vw
  }

  .seasons {
    justify-content:space-between;
    gap:6px;
    width:100%;
    font-size:9px
  }

  .book-viewport {
    overflow-x:visible;
    padding-bottom:16px
  }

  .book {
    min-width:0;
    width:100%;
    max-width:450px
  }

  .book-spread {
    padding:16px;
    min-height:auto;
    background:#241a32
  }

  .book-grid {
    grid-template-columns:1fr;
    gap:16px
  }

  .book-page {
    grid-template-columns:var(--menu-card-width);
    justify-content:center;
    min-width:0
  }

  .book-footer {
    border-top:2px dashed var(--line);
    padding-top:10px;
    margin-top:17px;
    gap:8px;
    flex-wrap:wrap
  }

  .book.flipping:after {
    display:none
  }

  .book.flipping .book-spread {
    animation:arcade-leaf-forward .46s cubic-bezier(.25,.8,.22,1)
  }

  .book.flipping.flip-backward .book-spread {
    animation:arcade-leaf-backward .46s cubic-bezier(.25,.8,.22,1)
  }

}

@keyframes arcade-leaf-forward {
  0% {
    opacity:.35;
    transform:translateX(16px) rotateY(-7deg)
  }

  100% {
    opacity:1;
    transform:translateX(0) rotateY(0)
  }

}

@keyframes arcade-leaf-backward {
  0% {
    opacity:.35;
    transform:translateX(-16px) rotateY(7deg)
  }

  100% {
    opacity:1;
    transform:translateX(0) rotateY(0)
  }

}

/* Combat readability pass: every hand card stays visible, with explicit action states. */
.battle-layout {
  grid-template-columns:minmax(112px,150px) minmax(0,1fr) minmax(130px,165px);
  gap:clamp(10px,1.3vw,20px)
}

.battle-center,.battle-sidebar {
  min-width:0
}

.battle-field-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:5px;
  margin:10px 2px 2px;
  padding:0 4px;
  color:#afa5be;
  font:800 10px Consolas,'Courier New',monospace;
  letter-spacing:1.1px;
}

.battle-field-heading .attack-count {
  color:var(--green);
  letter-spacing:.4px
}

.battle .field {
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  align-content:center;
  gap:9px;
  padding:12px 3px;
  min-height:155px;
  overflow:visible;
}

.battle .field .card {
  flex:0 0 108px;
  width:108px;
  min-width:0;
  max-width:108px;
  min-height:148px
}

.battle .field .card .card-art {
  height:61px;
  min-height:61px
}

.field-empty {
  margin:auto;
  text-align:center
}

.enemy-hand {
  height:auto;
  min-height:43px;
  flex-wrap:wrap;
  align-items:center
}

.enemy-hand .card-back {
  flex:0 0 25px;
  width:25px;
  min-width:25px;
  height:35px
}

.battle-hint {
  margin:12px auto;
  max-width:680px;
  font:800 12px/1.6 Consolas,'Courier New',monospace;
  color:#e2f4c6
}

.battle-hint button {
  margin:5px
}

/* Always-visible hand: cards wrap onto new rows, never clip or require horizontal scrolling. */
.hand-dock {
  width:100%;
  min-width:0;
  margin-top:14px;
  padding:13px 12px 12px;
  background:linear-gradient(170deg,#30203d,#1b1426);
  border:3px solid #6d587b;
  box-shadow:6px 7px 0 #080710;
}

.hand-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:10px;
}

.hand-heading {
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:10px;
  width:100%;
}

.hand-heading .eyebrow {
  font-size:13px;
  color:#fff3c0
}

.hand-count {
  font:800 11px Consolas,'Courier New',monospace;
  color:#afa5be
}

.hand-resources {
  display:flex;
  flex-wrap:wrap;
  gap:7px
}

.hand-mana,.hand-play-count {
  display:inline-flex;
  align-items:center;
  padding:7px 9px;
  border:1px solid #6f6281;
  background:#130d1e;
  font:800 11px Consolas,'Courier New',monospace;
  white-space:nowrap;
}

.hand-mana {
  color:#91d9ff;
  border-color:#629fb8
}

.hand-play-count {
  color:var(--green);
  border-color:#8bb54c
}

.battle .hand {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-content:start;
  align-items:stretch;
  width:100%;
  min-width:0;
  gap:11px;
  margin:0;
  padding:16px 0 8px;
  overflow:visible;
}

.battle .hand .card {
  flex:0 0 118px;
  width:118px;
  min-width:0;
  max-width:118px;
  min-height:168px;
  height:168px;
  max-height:168px;
  margin:0;
  padding:6px;
}

.battle .hand .card-art {
  height:61px;
  min-height:61px;
  margin-bottom:6px
}

.battle .hand .art-symbol {
  font-size:39px
}

.battle .hand .card-name {
  font-size:12px;
  line-height:13px;
  min-height:25px;
  max-height:26px;
  white-space:normal;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-clamp:2;
  overflow:hidden;
}

.battle .hand .card-meta {
  font-size:8px;
  margin:0 1px 5px;
  gap:3px;
  min-height:9px;
  align-items:center
}

.battle .hand .card-meta>span:first-child {
  display:none
}

.battle .hand .card-text {
  font:9px/1.22 Consolas,'Courier New',monospace;
  min-height:0;
  max-height:25px;
  margin:0 2px 5px;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-clamp:2;
  overflow:hidden;
}

.battle .hand .stats {
  font-size:13px;
  margin-top:auto
}

.battle .hand .mana {
  width:23px;
  height:25px;
  font-size:15px;
  top:7px;
  left:7px
}

.hand-empty {
  text-align:center;
  margin:20px
}

.hand-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  padding:11px 2px 1px;

}

.hand-legend {
  display:flex;
  flex-wrap:wrap;
  gap:9px 14px;
  font:800 9px Consolas,'Courier New',monospace;
  color:#b5a9bf
}

.hand-legend span {
  display:inline-flex;
  align-items:center;
  gap:6px
}

.legend-square {
  display:inline-block;
  width:10px;
  height:10px;
  border:2px solid #000;
  box-shadow:1px 1px 0 #000
}

.legend-square.can-play {
  background:var(--green)
}

.legend-square.cannot-play {
  background:#a85e77
}

.hand-end-turn {
  display:none
}

/* State badges are literal labels, not color-only indicators. */
.card .combat-card-status {
  position:absolute;
  z-index:4;
  top:6px;
  right:5px;
  max-width:82px;
  display:block;
  padding:5px 5px 4px;
  border:2px solid #0a0910;
  background:#51405b;
  color:#f2eaf4;
  box-shadow:2px 2px 0 #080710;
  font:800 9px/1 Consolas,'Courier New',monospace;
  letter-spacing:.1px;
  white-space:nowrap;
  text-align:center;
  pointer-events:none;
}

.card .combat-card-status.status-castable,
.card .combat-card-status.status-attack {
  background:var(--green);
  color:#0d1010
}

.card .combat-card-status.status-unaffordable {
  background:#8b536e;
  color:#fff6fa
}

.card .combat-card-status.status-waiting,
.card .combat-card-status.status-blocked {
  background:#51435c;
  color:#fff1e5
}

.card .combat-card-status.status-selected {
  background:#fff9ce;
  color:#16121c
}

.card .combat-card-status.status-target {
  background:var(--gold);
  color:#171019
}

.battle .card.castable,.battle .card.attack-ready {
  border-color:var(--green);
  opacity:1;
  filter:none;
  box-shadow:0 0 0 2px #d3fb5b66,3px 4px 0 #07060d;
  animation:combat-ready-pulse 2.4s ease-in-out infinite;
}

.battle .card.castable .mana {
  background:var(--green);
  color:#10120c
}

.battle .card.unaffordable {
  border-color:#a06580;
  filter:saturate(.62);
  opacity:.86;
  box-shadow:3px 4px 0 #080710;
}

.battle .card.unaffordable .mana {
  background:#8b536e;
  color:#fff4f6
}

.battle .card.waiting,.battle .card.blocked,.battle .card.attack-unavailable {
  filter:saturate(.68);
  opacity:.78;
  animation:none
}

.battle .card.waiting .mana,.battle .card.blocked .mana {
  background:#685975;
  color:#eee3ee
}

.battle .hand .card:disabled,.battle .totem-action:disabled,.battle .field .card:disabled {
  opacity:.78;
  cursor:not-allowed;
}

.battle .hand .card.unaffordable:disabled {
  opacity:.86
}

.battle .card.attack-ready {
  cursor:pointer
}

.battle .card.combat-targetable,.battle .hero.combat-targetable,.battle .enchant-slot.combat-targetable {
  border-color:var(--gold)!important;
  box-shadow:0 0 0 2px #ffc85788,0 0 18px #ffc85755;
  filter:none;
  opacity:1;
}

.battle .card.combat-targetable {
  animation:combat-target-pulse 1.8s ease-in-out infinite
}

.battle .combat-untargetable:disabled {
  opacity:.46;
  filter:grayscale(.5)
}

.battle .card.selected {
  border-color:#fff8c6;
  outline:3px solid #fff8c6;
  outline-offset:2px;
  animation:none;
  opacity:1;
  filter:none
}

.battle .hero {
  position:relative
}

.battle .hero.combat-targetable::after {
  content:'TARGET';
  position:absolute;
  right:-7px;
  top:-12px;
  color:#14101b;
  background:var(--gold);
  border:2px solid #080710;
  padding:3px 5px;
  font:800 9px Consolas,'Courier New',monospace;
}

.battle .hero:disabled {
  opacity:.55
}

.battle .totem-action .combat-card-status {
  top:36px;
  right:5px
}

.battle .totem-action .owned-label {
  top:6px;
  right:5px
}

.battle .totem-action.castable {
  animation:combat-ready-pulse 2.4s ease-in-out infinite
}

@keyframes combat-ready-pulse {
  0%,100% {
    box-shadow:0 0 0 2px #d3fb5b5b,3px 4px 0 #07060d
  }

  50% {
    box-shadow:0 0 0 3px #d3fb5bba,0 0 15px #d3fb5b3d,3px 4px 0 #07060d
  }

}

@keyframes combat-target-pulse {
  0%,100% {
    box-shadow:0 0 0 2px #ffc85788,0 0 10px #ffc85755
  }

  50% {
    box-shadow:0 0 0 3px #ffc857cc,0 0 21px #ffc85780
  }

}

@media(max-width:1100px) and (min-width:761px) {
  .battle-layout {
    grid-template-columns:105px minmax(0,1fr) 120px;
    gap:10px
  }

  .battle .field .card {
    flex-basis:96px;
    width:96px;
    max-width:96px
  }

  .battle .hand {
    gap:9px
  }

}

@media(max-width:760px) {
  .battle {
    padding:12px 9px 28px
  }

  .battle-layout {
    grid-template-columns:minmax(0,1fr);
    gap:13px
  }

  .battle-left,.battle-center,.battle-sidebar {
    grid-column:1;
    min-width:0;
    max-width:100%
  }

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

  .battle-left>div {
    min-width:0
  }

  .battle .field {
    justify-content:center;
    gap:7px;
    min-height:105px;
    overflow:visible;
    padding:10px 1px
  }

  .battle .field .card {
    flex:0 0 94px;
    width:94px;
    max-width:94px;
    min-height:130px
  }

  .battle .field .card-art {
    height:48px;
    min-height:48px
  }

  .battle .field .card-name {
    font-size:10px
  }

  .battle .field .card-text {
    display:none
  }

  .battle .field .card .combat-card-status {
    font-size:8px;
    padding:4px 3px
  }

  .battle-field-heading {
    font-size:9px
  }

  .battle-hint {
    font-size:11px
  }

  .hand-dock {
    padding:10px 9px;
    box-shadow:3px 4px 0 #080710
  }

  .hand-toolbar {
    gap:8px
  }

  .hand-heading .eyebrow {
    font-size:12px
  }

  .hand-mana,.hand-play-count {
    font-size:10px;
    padding:6px
  }

  .battle .hand {
    gap:9px 8px;
    padding:12px 0
  }

  .battle .hand .card {
    flex:0 0 108px;
    width:108px;
    max-width:108px;
    min-height:160px;
    height:160px;
    max-height:160px
  }

  .battle .hand .card-art {
    height:55px;
    min-height:55px
  }

  .battle .hand .card-name {
    font-size:11px
  }

  .hand-end-turn {
    display:inline-block;
    margin-left:auto;
    font-size:11px;
    padding:9px 12px
  }

  .battle-sidebar .turn-panel {
    max-width:none
  }

  .battle .totem-small {
    max-width:170px
  }

  .battle .hero {
    max-width:min(320px,100%)
  }

}

@media(max-width:440px) {
  .battle .hand .card {
    flex-basis:100px;
    width:100px;
    max-width:100px
  }

  .battle .hand {
    gap:8px 7px
  }

  .battle .hand .card .combat-card-status {
    font-size:8px;
    right:3px;
    padding:4px 3px
  }

  .hand-legend {
    font-size:8px
  }

  .battle .field .card {
    flex-basis:88px;
    width:88px;
    max-width:88px
  }

}

@media(prefers-reduced-motion:reduce) {
  .battle .card.castable,.battle .card.attack-ready,.battle .card.combat-targetable,.battle .totem-action.castable {
    animation:none
  }

}

/* Leave enough room for long rarity names on compact hand cards. */
.battle .hand .card-meta .element-dots {
  display:none
}

/* v1.2 — single-row overlapped hand, with accessible focus and touch reveal. */
.hand-dock {
  position:relative;
  overflow:visible;
  z-index:3
}

.hand-tip {
  font:800 9px Consolas,'Courier New',monospace;
  color:#cdb5e2;
  letter-spacing:.35px
}

.battle .hand {
  position:relative;
  display:block;
  isolation:isolate;
  box-sizing:border-box;
  width:100%;
  height:207px;
  min-height:207px;
  overflow:visible;
  padding:0;
  margin:0;
}

.battle .hand .hand-card {
  position:absolute;
  box-sizing:border-box;
  flex:none;
  left:0;
  /* layoutBattleHand places each card in pixels after render. */
  top:37px;
  width:118px;
  min-width:118px;
  max-width:118px;
  height:168px;
  min-height:168px;
  max-height:168px;
  z-index:calc(10 + var(--hand-index, 0));
  margin:0;
  cursor:pointer;
  transform-origin:center bottom;
  transition:transform .22s cubic-bezier(.18,1.3,.32,1),filter .2s ease,box-shadow .2s ease;
}

.battle .hand .hand-card .mana {
  top:5px;
  left:5px;
  width:23px;
  height:25px;
  font-size:15px;
  box-shadow:2px 3px 0 #050407;
}

/* Only the color-coded cost corner needs to be uncovered by adjacent cards. */
.battle .hand .hand-card .combat-card-status {
  opacity:0;
  transition:opacity .12s ease
}

.battle .hand .hand-card:where(.castable,.unaffordable,.waiting,.blocked) {
  opacity:1
}

.battle .hand .hand-card:where(.waiting,.blocked,.unaffordable) {
  filter:saturate(.8)
}

.battle .hand .hand-card:is(:hover,:focus-visible,.hand-peek-open) {
  z-index:100!important;
  transform:translateY(-35px) scale(1.1);
  opacity:1;
  filter:brightness(1.17) saturate(1);
  border-color:#fff2b6;
  box-shadow:0 0 0 3px #fff2b6,0 0 24px #e2baff77,10px 14px 0 #080710;
  animation:none;
}

.battle .hand .hand-card:is(:hover,:focus-visible,.hand-peek-open) .combat-card-status {
  opacity:1
}

.battle .hand .hand-card:focus-visible {
  outline:3px solid var(--gold);
  outline-offset:4px
}

.battle .hand .hand-card[aria-disabled="true"] {
  cursor:help
}

.battle .hand-empty {
  padding-top:75px;
  text-align:center;
  margin:0
}

@media(max-width:760px) {
  .battle .hand {
    height:192px;
    min-height:192px;
    padding:0;
    margin:0
  }

  .battle .hand .hand-card {
    width:106px;
    min-width:106px;
    max-width:106px;
    height:158px;
    min-height:158px;
    max-height:158px;
    top:32px
  }

  .battle .hand .hand-card .mana {
    width:21px;
    height:24px;
    font-size:14px;
    top:5px;
    left:4px
  }

  .hand-tip {
    font-size:8px
  }

}

@media(max-width:440px) {
  .battle .hand .hand-card {
    width:102px;
    min-width:102px;
    max-width:102px
  }

  .battle .hand .hand-card:is(:hover,:focus-visible,.hand-peek-open) {
    transform:translateY(-30px) scale(1.045)
  }

}

/* Sprite-sharp combat effects, drawn above a rerendered battlefield. */
.battle-fx-layer {
  position:fixed;
  inset:0;
  z-index:9999;
  pointer-events:none;
  overflow:hidden;
  contain:layout paint
}

.fx-attacker {
  position:absolute;
  z-index:1;
  transform-origin:center;
  animation:fx-card-lunge .62s cubic-bezier(.22,.85,.38,1) both
}

.fx-attacker .fx-clone,.fx-attacker .card {
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  box-sizing:border-box;
  opacity:1!important;
  filter:none!important;
  animation:none!important;
  box-shadow:4px 4px 0 #080710!important;
  transform:none!important
}

.fx-attacker .card-art {
  height:52px!important;
  min-height:52px!important
}

.fx-attacker .card .combat-card-status {
  display:none
}

.fx-slash,.fx-cast-glyph {
  position:absolute;
  z-index:2;
  line-height:1;
  color:#fff7bf;
  text-shadow:3px 3px 0 #35124e,-3px -2px 0 #de6fc5;
  transform:translate(-50%,-50%);
  will-change:transform,opacity
}

.fx-slash {
  font:900 66px/1 Consolas,'Courier New',monospace;
  animation:fx-slash-impact .48s steps(5,end) .22s both
}

.fx-cast-glyph {
  font:900 78px/1 Consolas,'Courier New',monospace;
  animation:fx-spell-flash .66s steps(7,end) both
}

.fx-spell .fx-cast-glyph {
  color:#92ecff;
  text-shadow:3px 3px 0 #2a2e74,-3px -3px 0 #b3f3ff
}

.fx-enchant .fx-cast-glyph {
  color:#ffc876;
  text-shadow:3px 3px 0 #7e326c,-3px -3px 0 #fff3ab
}

/* Opponent moves use the same pixel-art animations as your own actions. */
.fx-opponent .fx-slash {
  color:#ff8bac;
  text-shadow:3px 3px 0 #4b193c,-3px -2px 0 #ffc8a7;
}

.fx-projectile {
  position:absolute;
  z-index:3;
  font:900 30px/1 Consolas,'Courier New',monospace;
  color:#9bedff;
  text-shadow:2px 2px 0 #281b49;
  transform:translate(-50%,-50%);
  animation:fx-bolt-flight .46s steps(9,end) both;
  will-change:transform,opacity;
}

.fx-enchant .fx-projectile { color:#ffdf85; }
.fx-summon .fx-projectile { color:#d8a6ff; }
.fx-summon .fx-cast-glyph { color:#d8a6ff; text-shadow:3px 3px 0 #643573; }
.fx-cast-glyph { animation-delay:.22s; }

.fx-action-caption {
  position:absolute;
  z-index:4;
  transform:translate(-50%,-100%);
  max-width:min(260px,calc(100vw - 18px));
  padding:6px 10px;
  border:2px solid #ffaacb;
  background:#22122b;
  color:#ffe5e9;
  box-shadow:3px 3px 0 #09050c;
  text-align:center;
  text-transform:uppercase;
  overflow-wrap:anywhere;
  font:800 11px/1.3 Consolas,'Courier New',monospace;
  letter-spacing:.4px;
  animation:fx-caption-pop .85s steps(7,end) both;
}

.fx-ghost-card {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:14px;
  width:100%;
  height:100%;
  box-sizing:border-box;
  padding:9px;
  border:3px solid #ffa4c1;
  background:repeating-linear-gradient(135deg,#2f2441,#2f2441 9px,#49355b 9px,#49355b 18px);
  color:#fff0cb;
  box-shadow:4px 4px 0 #09050c;
  font:800 12px/1.3 Consolas,'Courier New',monospace;
  text-transform:uppercase;
}

.fx-ghost-card strong { max-width:100%; overflow-wrap:anywhere; }
.fx-ghost-cost {
  display:inline-grid;
  place-items:center;
  min-width:24px;
  height:24px;
  background:#f6e5ad;
  color:#1d1727;
  border:2px solid #191221;
}

@keyframes fx-bolt-flight {
  0% { opacity:0; transform:translate(-50%,-50%) scale(.35); }
  12% { opacity:1; transform:translate(-50%,-50%) scale(1.15); }
  80% { opacity:1; transform:translate(calc(-50% + var(--dx)),calc(-50% + var(--dy))) scale(1); }
  100% { opacity:0; transform:translate(calc(-50% + var(--dx)),calc(-50% + var(--dy))) scale(.1); }
}

@keyframes fx-caption-pop {
  0% { opacity:0; transform:translate(-50%,-70%) scale(.8); }
  15% { opacity:1; transform:translate(-50%,-100%) scale(1); }
  70% { opacity:1; transform:translate(-50%,-100%) scale(1); }
  100% { opacity:0; transform:translate(-50%,-130%) scale(.9); }
}

.fx-pixel {
  position:absolute;
  display:block;
  width:7px;
  height:7px;
  background:#ecfc88;
  border:1px solid #1b0d22;
  box-shadow:2px 2px 0 #080710;
  opacity:0;
  transform:translate(-50%,-50%);
  animation:fx-square-burst .52s steps(5,end) var(--delay,0ms) both;
  will-change:transform,opacity
}

.fx-pixel:nth-of-type(even) {
  background:#ff7ccd;
  width:5px;
  height:5px
}

.fx-spell .fx-pixel:nth-of-type(odd) {
  background:#88f5ff
}

.fx-enchant .fx-pixel:nth-of-type(odd) {
  background:#ffdf83
}

.fx-pixel.fx-star {
  width:12px;
  height:12px;
  clip-path:polygon(50% 0,66% 36%,100% 50%,65% 62%,50% 100%,36% 65%,0 50%,37% 35%);
  border:none
}

@keyframes fx-card-lunge {
  0% {
    opacity:0;
    transform:translate(0,0) scale(.85) rotate(-7deg)
  }

  15% {
    opacity:1;
    transform:translate(0,-14px) scale(1.08) rotate(-9deg)
  }

  68% {
    opacity:1;
    transform:translate(var(--dx93),var(--dy93)) scale(.97) rotate(5deg)
  }

  79% {
    opacity:1;
    transform:translate(var(--dx),var(--dy)) scale(.94) rotate(8deg)
  }

  100% {
    opacity:0;
    transform:translate(var(--dx),var(--dy)) scale(.72) rotate(12deg)
  }

}

@keyframes fx-square-burst {
  0% {
    opacity:0;
    transform:translate(-50%,-50%) scale(.3)
  }

  18% {
    opacity:1;
    transform:translate(-50%,-50%) scale(1.45)
  }

  74% {
    opacity:1;
    transform:translate(calc(-50% + var(--px)),calc(-50% + var(--py))) scale(1)
  }

  100% {
    opacity:0;
    transform:translate(calc(-50% + var(--px)),calc(-50% + var(--py))) scale(0)
  }

}

@keyframes fx-slash-impact {
  0% {
    opacity:0;
    transform:translate(-50%,-50%) scale(.2) rotate(-45deg)
  }

  25% {
    opacity:1;
    transform:translate(-50%,-50%) scale(1.2) rotate(0deg)
  }

  65% {
    opacity:1;
    transform:translate(-50%,-50%) scale(1) rotate(12deg)
  }

  100% {
    opacity:0;
    transform:translate(-50%,-50%) scale(1.2) rotate(25deg)
  }

}

@keyframes fx-spell-flash {
  0% {
    opacity:0;
    transform:translate(-50%,-50%) scale(.25) rotate(0deg)
  }

  27% {
    opacity:1;
    transform:translate(-50%,-50%) scale(1.15) rotate(45deg)
  }

  67% {
    opacity:.95;
    transform:translate(-50%,-50%) scale(.9) rotate(65deg)
  }

  100% {
    opacity:0;
    transform:translate(-50%,-50%) scale(1.4) rotate(90deg)
  }

}

@media(prefers-reduced-motion:reduce) {
  .battle .hand .hand-card,.battle .hand .hand-card:is(:hover,:focus-visible,.hand-peek-open) {
    transition:none;
    animation:none
  }

  .battle-fx-layer {
    display:none
  }

}

.battle .hand .hand-card:first-child {
  transform-origin:left bottom
}

.battle .hand .hand-card:last-child {
  transform-origin:right bottom
}

/* Touch target activation: keep the hovered/focused animation from shifting a
   button away from the finger before a tap completes (especially on iOS). */
@media (pointer: coarse) {
  .battle .field .card,
  .battle .hero,
  .battle .enchant-slot,
  .battle .hand .hand-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .battle .field .card:hover:not(:disabled),
  .battle .hero:hover:not(:disabled),
  .battle .enchant-slot:hover:not(:disabled) {
    transform: none;
  }

  .battle .field .card.combat-targetable:active,
  .battle .hero.combat-targetable:active,
  .battle .enchant-slot.combat-targetable:active {
    outline: 3px solid #fff2b6;
    outline-offset: 2px;
  }

  .battle .enchant-slot {
    min-height: 44px;
  }

}

@media (hover: hover) and (pointer: fine) {
    .battle .hand .hand-card {
        overflow: visible;
    }

    .battle .hand .hand-card:hover::after {
        content: "";
        position: absolute;
        top: calc(100% - 1px);
        left: 0;
        right: 0;
        height: 44px;
        pointer-events: auto;
        background: transparent;
    }
}

/* Retro arcade card information tooltip */

.battle-card-preview {
    position: fixed;
    z-index: 99999;
    pointer-events: none;

    box-sizing: border-box;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;

    padding: 15px;

    background: #1b1325;
    color: #f5ebdc;

    border: 3px solid #e8cc79;
    border-radius: 2px;
    box-shadow: 6px 6px 0 #08060d;

    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;

    overflow-wrap: anywhere;
}

.battle-card-preview[hidden] {
    display: none;
}

.preview-title {
    font-family: Impact, sans-serif;
    font-size: 19px;
    text-transform: uppercase;
    color: #fff1b8;
    margin-bottom: 7px;
}

.preview-meta {
    color: #b0ed75;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.preview-description {
    border-top: 2px solid #64516e;
    padding-top: 12px;

    font-size: 13px;
    line-height: 1.6;
    color: #ffffff;

    white-space: normal;
}

.preview-flavor {
    margin-top: 12px;
    padding-top: 9px;

    border-top: 1px dashed #64516e;

    color: #bfaecb;
    font-style: italic;
    font-size: 11px;
}