@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Manrope:wght@500;600;700;800;900&display=swap');

:root {
  --ink: #17212b;
  --muted: #66727f;
  --subtle: #8a97a6;
  --black: #000;
  --bg: #f5f7fb;
  --card: #ffffff;
  --card-soft: #f9fbff;
  --line: #dfe6ee;
  --line-strong: #b7c3cf;
  --shadow: 0 18px 50px rgba(25, 38, 52, 0.12);
  --shadow-soft: 0 10px 28px rgba(25, 38, 52, 0.08);
  --blue: #2f8df5;
  --red: #ff6757;
  --yellow: #f5bd24;
  --green: #37b96f;
  --rock: #bfb3aa;
  --hp-green: #23c16b;
  --hp-yellow: #f3bf24;
  --hp-red: #ef4444;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(77, 145, 255, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(55, 185, 111, 0.12), transparent 24rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 52%, #eef3f8 100%);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 141, 245, 0.14);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  background: #fff;
  color: #cacaca;
}

.hidden {
  display: none !important;
}

.admin-body {
  min-height: 100vh;
}

.admin-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.admin-login-card {
  max-width: 560px;
  margin: 10vh auto 0;
}

.admin-card h1,
.admin-card p {
  margin: 0;
}

.admin-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.admin-panel {
  display: grid;
  gap: 18px;
}

.admin-panel-head,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-actions {
  justify-content: flex-end;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  background: #fff;
  color: var(--muted);
  font-weight: 950;
  cursor: pointer;
}

.admin-tab.active {
  border-color: rgba(42, 111, 255, 0.4);
  background: linear-gradient(135deg, rgba(42, 111, 255, 0.16), rgba(100, 60, 255, 0.12));
  color: var(--text);
}

.admin-tab-panel {
  display: grid;
  gap: 16px;
}

.admin-grant-card {
  display: grid;
  gap: 14px;
  max-width: 720px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: #fff;
}

.admin-grant-card h2,
.admin-users-toolbar h2 {
  margin: 0;
}

.admin-grant-card label,
.admin-users-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-grant-card input,
.admin-users-toolbar select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 850;
}

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

.admin-users-toolbar,
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-pagination {
  justify-content: flex-end;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
}

.admin-table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  background: var(--card-soft);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-table th button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.admin-table th button.active {
  color: var(--text);
}

.admin-table code {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 750;
}

.admin-number-input {
  width: 120px;
  min-height: 40px;
  border-radius: 12px;
  padding: 8px 10px;
}

.admin-save-button {
  min-height: 40px;
  padding: 8px 12px;
}

.admin-empty {
  color: var(--muted);
  text-align: center !important;
  font-weight: 850;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 118px;
}

.is-battling .shell {
  padding-top: 10px;
}

.is-battling .hero {
  display: none;
}

.is-battling .bottom-nav {
  display: none;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(223, 230, 238, 0.9);
  border-radius: 34px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.94)),
    radial-gradient(circle at 88% 18%, rgba(47, 141, 245, 0.14), transparent 18rem);
  box-shadow: var(--shadow-soft);
}

.hero::after {
  content: '';
  position: absolute;
  right: 34px;
  bottom: -62px;
  width: 190px;
  height: 190px;
  border: 28px solid rgba(47, 141, 245, 0.08);
  border-radius: 50%;
}

.hero h1,
.hero p {
  position: relative;
  margin: 0;
  z-index: 1;
}

.hero h1 {
  max-width: 860px;
  margin-top: 8px;
  font-size: clamp(2.35rem, 5vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.hero p:last-child {
  max-width: 720px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 650;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel,
.battle-hud {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.auth-panel,
.setup-panel {
  margin-top: 22px;
  padding: 22px;
  border-radius: 26px;
}

.auth-panel {
  max-width: 520px;
  margin-inline: auto;
}

.setup-panel {
  display: block;
  min-height: calc(100vh - 154px);
}

.app-view {
  margin-top: 16px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(560px, calc(100% - 22px));
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 54px rgba(23, 33, 43, 0.22);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.coin-balance {
  display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 9px 14px;
    /* border: 1px solid rgba(18, 184, 180, 0.34); */
    border-radius: 999px;
    color: #075f62;
    background: linear-gradient(135deg, rgb(242 242 242 / 95%), rgb(255 255 255 / 92%));
    box-shadow: var(--shadow-soft);
    font-weight: 950;
}

.coin-balance span {
  color: #0f766e;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  color: var(--black);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 400;
}

.nav-icon {
  font-size: 1.18rem;
  line-height: 1;
}

.nav-button.is-active {
  box-shadow: 0 10px 22px rgba(23, 33, 43, 0.18);
}

.mode-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-soft);
}

.mode-actions,
.join-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.room-controls {
  display: grid;
  gap: 12px;
}

.hint {
  font-size: 0.92rem;
}

.setup-head,
.collection-head,
.log-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.booster-status-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 0.9fr) auto;
  align-items: center;
  gap: 16px;
  margin: 16px 0 12px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(223, 230, 238, 0.92);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
}

.booster-status-main,
.booster-timer-card,
.booster-claim-button {
  position: relative;
  z-index: 1;
}

.booster-status-main {
  display: grid;
  gap: 7px;
}

.booster-status-main p,
.booster-timer-head span,
.booster-timer-head strong {
  margin: 0;
}

.booster-count-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.booster-count-line strong {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
}

.booster-count-line span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.booster-timer-card {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(223, 230, 238, 0.9);
  border-radius: 22px;
  background: rgba(249, 251, 255, 0.88);
}

.booster-timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booster-timer-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.booster-timer-head strong {
  color: #17212b;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 1000;
  white-space: nowrap;
}

.booster-progress-track {
  height: 13px;
  padding: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf3;
}

.booster-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d72ff5, #37b96f);
  box-shadow: 0 0 18px rgba(47, 141, 245, 0.32);
  transition: width 260ms ease;
}

.booster-claim-button {
  min-width: 190px;
  background: linear-gradient(135deg, #2f8df5, #17212b);
  white-space: nowrap;
}

.sort-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card-soft);
}

.sort-panel span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.sort-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--ink);
  background: #e8eef5;
  font-size: 0.78rem;
  font-weight: 950;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.sort-button:hover {
  transform: translateY(-1px);
}

.sort-button.is-active {
  color: #fff;
  background: #17212b;
  box-shadow: 0 10px 18px rgba(23, 33, 43, 0.18);
}

.pagination-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.pagination-button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  color: #fff;
  background: var(--black);
  font-weight: 950;
}

.pagination-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.pagination-summary,
.pagination-range {
  color: var(--ink);
  font-weight: 950;
}

.pagination-range {
  color: var(--muted);
  font-size: 0.86rem;
}

.card-list-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--card-soft);
  text-align: center;
}

.setup-head p,
.collection-head h2,
.log-heading h2,
.panel h2,
.battle-hud h2 {
  margin: 0;
}

.setup-panel h2,
.panel h2 {
  margin-bottom: 14px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
  gap: 12px;
  align-items: start;
}

.choice-card {
  display: flex;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.creature-card-choice {
  cursor: pointer;
}

.card-preview {
  width: var(--card-preview-width, 174px);
  height: var(--card-preview-height, 261px);
}

.card-scale {
  width: 512px;
  height: 768px;
  transform: scale(var(--card-scale));
  transform-origin: top left;
}

.card-wrap {
  position: relative;
  width: 512px;
  height: 768px;
  border-radius: 40px;
  overflow: hidden;
  user-select: none;
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
  font-style: normal;
  color: #111;
  box-shadow: 0px 39px 76px 0px rgb(0 0 0 / 23%);
}

.card-wrap.is-legend-card {
  color: #fff;
}

.card-e-pattern {
  position: absolute;
  width: 512px;
  height: 768px;
  top: 0;
  left: 0;
  z-index: 1;
  object-fit: cover;
  pointer-events: none;
}

.card-e-name {
  width: 100%;
  text-align: center;
  font-size: 45px;
}

.card-e-img {
  position: relative;
  width: 450px;
  height: 450px;
  margin-left: 31px;
  z-index: 3;
  margin-top: 25px;
}

.card-e-type {
  position: absolute;
  width: 110px;
  height: 110px;
  z-index: 2;
  top: 48px;
  left: 16px;
}

.card-e-params-wrap {
  display: flex;
  position: relative;
  width: 100%;
  height: 140px;
  margin-top: 15px;
  align-content: center;
  justify-content: center;
  gap: 25px;
  z-index: 3;
}

.card-e-params {
  display: flex;
  width: 284px;
  height: 100%;
  border-radius: 30px;
  border: 3px solid rgb(0, 0, 0, 0.2);
  justify-content: space-evenly;
  align-items: center;
}

.card-e-lvl {
  display: flex;
  width: 135px;
  height: 100%;
  border-radius: 30px;
  border: 3px solid rgb(0, 0, 0, 0.2);
  justify-content: space-evenly;
  align-items: center;
}

.is-legend-card .card-e-params,
.is-legend-card .card-e-lvl {
  border-color: rgba(255, 255, 255, 0.32);
}

.card-e-params-item {
  display: flex;
  width: 100px;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.card-e-params-item-icon {
  width: 100px;
  height: 40px;
}

.card-e-params-item-text-lvl {
  font-size: 32px;
}

.card-e-lvl-progress {
  margin-top: -2px;
  font-size: 20px;
  font-weight: 900;
  opacity: 0.72;
}

.card-logo {
  position: absolute;
  left: 31px;
  bottom: 21px;
  background: url('/assets/card_logo.png');
  background-size: contain;
  width: 210px;
  height: 32px;
  background-repeat: no-repeat;
}

.is-legend-card .card-logo {
  background-image: url('/assets/card_logo_white.png');
}

.card-rare {
  display: flex;
  position: absolute;
  right: 31px;
  bottom: 18px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.card-rare-text {
  font-size: 32px;
  text-transform: uppercase;
}

.card-rare-icon {
  width: 42px;
  height: 42px;
}

.booster-reveal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.booster-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 26, 0.68);
  backdrop-filter: blur(10px);
}

.booster-panel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: min(100%, 520px);
  padding: 22px;
}

.booster-panel h2,
.booster-panel p {
  margin: 0;
}

.booster-card-slot .card-preview {
  --card-preview-width: 317px;
  --card-preview-height: 476px;
  filter: drop-shadow(0 18px 28px rgba(23, 33, 43, 0.22));
  animation: card-reveal 420ms cubic-bezier(0.18, 0.9, 0.2, 1.1);
}

.booster-loading {
  display: grid;
  place-items: center;
  gap: 12px;
  width: 220px;
  min-height: 376px;
  color: #fff;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.38);
}

.booster-loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: booster-loading-spin 850ms linear infinite;
}

.booster-pack {
  position: relative;
  width: 220px;
  height: 376px;
  overflow: hidden;
  background: url(assets/booster_first.png);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  animation: booster-shake 1550ms ease-in-out infinite;
  z-index: 2;
}

.booster-shadow {
  position: absolute;
  top: 0;
  left: 0;
  background: rgb(0 0 0 / 51%);
  width: 220px;
  height: 367px;
  filter: blur(54px);
  z-index: 1;
  
}

.is-revealing-booster {
  overflow: hidden;
}

@keyframes card-reveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes booster-shake {
  0% {
    transform: translate(0, 0) rotate(-1deg) scale(1);
  }

  42% {
    transform: translate(-5px, -2px) rotate(15deg) scale(1.34);
  }

  51% {
    transform: translate(3px, 1px) rotate(12deg) scale(0.99);
  }


  100% {
    transform: translate(0, 0) rotate(-15deg) scale(1);
  }
}

@keyframes booster-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.choice-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-weight: 900;
}

.choice-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.choice-img {
  display: block;
  width: 100%;
  max-width: 120px;
  height: auto;
  margin: 0 auto 8px;
  border-radius: 14px;
}

.primary-button,
.ghost-button,
.action-button {
  border: 0;
  border-radius: 16px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button {
  min-height: 52px;
  padding: 10px 18px;
  color: #fff;
  background: linear-gradient(135deg, #17212b, #2f4052);
  box-shadow: 0 12px 24px rgba(23, 33, 43, 0.18);
}

#startBattle {
  grid-column: 1 / -1;
}

.ghost-button {
  min-height: 44px;
  padding: 9px 14px;
  color: var(--ink);
  background: #eef3f8;
  box-shadow: inset 0 0 0 1px var(--line);
}

.danger-button {
  color: #9f1d1d;
  background: #fff0f0;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.card-actions {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 16;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: min(980px, calc(100% - 28px));
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(23, 33, 43, 0.24);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.card-actions-summary {
  display: grid;
  gap: 2px;
}

.card-actions-summary strong {
  font-size: 1.05rem;
}

.card-actions-summary span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.card-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: #eef3f8;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.card-viewer {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  perspective: 1200px;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: #fff;
}

.viewer-panel {
  position: relative;
  display: grid;
  place-items: center;
  gap: 18px;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tilt-card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --tilt-perspective: 980px;
  --tilt-scale: 1;
  --glare-x: 50%;
  --glare-y: 40%;
  --glare-opacity: 0.2;
  --shadow-x: 0px;
  position: relative;
  transform: perspective(var(--tilt-perspective)) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(var(--tilt-scale));
  transform-style: preserve-3d;
  transition: transform 180ms ease, filter 180ms ease;
  filter: drop-shadow(var(--shadow-x) 28px 42px rgba(0, 0, 0, 0.42));
  touch-action: none;
  cursor: grab;
}

.tilt-card.is-dragging {
  cursor: grabbing;
  transition: none;
}

.tilt-card .card-preview {
  pointer-events: none;
}

.viewer-card-slot {
  width: 369px;
  height: 553px;
}

.card-glare {
  position: absolute;
  inset: 0;
  width: 369px;
  height: 553px;
  border-radius: 29px;
  pointer-events: none;
  background:
    linear-gradient(108deg,
      transparent 0%,
      transparent calc(var(--glare-x) - 34%),
      rgba(255, 255, 255, 0.12) calc(var(--glare-x) - 22%),
      rgba(255, 255, 255, 0.66) var(--glare-x),
      rgba(255, 255, 255, 0.2) calc(var(--glare-x) + 16%),
      transparent calc(var(--glare-x) + 34%),
      transparent 100%),
    linear-gradient(155deg, rgba(255, 255, 255, 0.28), transparent 34%, rgba(255, 255, 255, 0.16) 62%, transparent 100%),
    repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.09) 0 2px, transparent 2px 10px),
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.26), transparent 58%);
  mix-blend-mode: screen;
  opacity: var(--glare-opacity);
  transition: opacity 160ms ease;
}

.tilt-card.is-dragging .card-glare {
  transition: none;
}

.is-viewing-card {
  overflow: hidden;
}

.viewer-return-button,
.favorite-viewer-button {
  min-width: 210px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  color: #17212b;
  background: #fff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  font-weight: 1000;
}

.favorite-viewer-button {
  background: #fff8df;
  color: #7a4b00;
}

.favorite-viewer-button::before {
  content: '☆';
  margin-right: 8px;
}

.favorite-viewer-button.is-active {
  color: #17212b;
  background: linear-gradient(135deg, #f5bd24, #ffe88a);
}

.favorite-viewer-button.is-active::before {
  content: '★';
}

.viewer-return-button:hover,
.favorite-viewer-button:hover {
  transform: translateY(-1px);
}

.craft-shell {
  padding-bottom: 58px;
}

.craft-hero h1 {
  max-width: 760px;
}

.craft-layout {
  display: grid;
  gap: 18px;
  margin-top: 22px;
  padding: 20px;
  border-radius: 28px;
}

.craft-topline,
.craft-preview-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.craft-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 12px;
  align-items: start;
}

.craft-slot,
.craft-pick {
  border: 0;
}

.craft-slot {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 214px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--muted);
  background: #f7fbff;
  font-weight: 950;
}

.craft-slot:not(.is-empty) {
  border-style: solid;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.craft-preview-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-soft);
}

.craft-preview-panel h2,
.craft-preview-panel p {
  margin: 0;
}

.craft-chances {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  min-width: min(100%, 420px);
  text-align: center;
}

.chance-row {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.chance-row span,
.craft-chances p {
  color: var(--black);
  font-size: 0.78rem;
  font-weight: 900;
}

.chance-row strong {
  font-size: 1.08rem;
}

.craft-chances p {
  margin: 0;
}

.craft-collection .craft-pick:disabled {
  cursor: not-allowed;
}

.craft-reward-note {
    margin: 10px 0 14px;
    padding: 12px 14px;
    /* border: 1px solid rgb(91 118 118 / 30%); */
    border-radius: 18px;
    color: #444444;
    background: rgb(240 240 240 / 86%);
    font-weight: 900;
}

.market-hero,
.market-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.market-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-radius: 30px;
  background: url();
}

.market-hero h2,
.market-hero p {
  margin: 0;
}

.market-wallet {
  display: grid;
  gap: 4px;
  min-width: 170px;
  border-radius: 22px;
  color: #17212b;
  text-align: right;
}

.market-wallet span {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.market-wallet strong {
  font-size: 1.35rem;
}

.market-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 16px;
  margin-top: 16px;
}

.market-panel {
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.market-item-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.market-free-grid {
  margin-bottom: 8px;
}

.market-free-card {
  background:
    radial-gradient(circle at 88% 0%, rgba(20, 184, 166, 0.16), transparent 9rem),
    #fff;
}

.market-free-card.is-claimed {
  opacity: 0.72;
}

.market-free-card .market-item-icon {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.market-item-top,
.market-buy-row,
.inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-5-boosters {
  width: 120px;
  height: 120px;
  background: url(assets/5boostersicon.png);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.market-item-icon {
  display: inline-grid;
  place-items: center;
  width: 55px;
  height: 55px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #17212b, #2f8df5);
  font-weight: 1000;
}

.market-owned {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--black);
  background: #f7f7f7;
}

.market-item-card h3,
.market-item-card p {
  margin: 0;
}

.market-item-card p,
.inventory-row small {
  color: var(--muted);
}

.market-inline-link {
  color: #0f766e;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inventory-list {
  display: grid;
  gap: 10px;
}

.inventory-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.inventory-row div {
  display: grid;
  gap: 2px;
  flex: 1;
}

.inventory-row b {
  font-size: 1.15rem;
}

.battle-menu-head {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 8%, rgba(47, 141, 245, 0.14), transparent 16rem),
    #fff;
}

.battle-menu-head h2,
.battle-menu-head p {
  margin: 0;
}

.battle-selected-card {
  display: flex;
  justify-content: center;
  margin: 18px 0 10px;
}

.battle-choice-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  max-height: 330px;
  overflow: auto;
  padding: 4px;
}

.battle-pick.is-picked {
  box-shadow: 0 14px 34px rgba(23, 33, 43, 0.2), inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.battle-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.battle-mode-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  border-radius: 24px;
  padding: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.battle-mode-card span {
  font-size: 1.1rem;
  font-weight: 1000;
}

.battle-mode-card small {
  color: var(--muted);
  font-weight: 800;
}

.battle-join-card .join-row {
  margin-top: 8px;
}

.pvp-code-button {
  display: block;
  width: min(100%, 360px);
  margin: 14px auto 0;
  border: 0;
  border-radius: 24px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(135deg, #17212b, #2f8df5);
  box-shadow: 0 16px 38px rgba(47, 141, 245, 0.24);
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.profile-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.profile-card h2,
.profile-card h3,
.profile-card p {
  margin: 0;
}

.profile-uid-card {
  display: grid;
  gap: 6px;
  width: 100%;
  border-radius: 22px;
  padding: 16px;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 28px rgba(47, 141, 245, 0.1);
  background: #fff;
}

.profile-uid-card span,
.profile-uid-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-uid-card strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(0.92rem, 3vw, 1.18rem);
  letter-spacing: 0.04em;
}

.profile-uid-card:disabled {
  cursor: wait;
  opacity: 0.68;
}

.profile-referral-card {
  box-shadow: 0 12px 28px rgba(55, 185, 111, 0.1);
}

.profile-referral-card strong {
  font-size: clamp(0.82rem, 2.6vw, 1.04rem);
  letter-spacing: 0.01em;
}

.profile-referral-reward {
  margin-top: -8px !important;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
  background: #000;
  border-radius: 20px;
  padding: 10px;
}

.profile-language-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card-soft);
}

.profile-language-card h3 {
  font-size: 1rem;
}

.language-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.language-option {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.language-option.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--ink);
}

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

.profile-stat-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card-soft);
}

.profile-stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-stat-card strong {
  font-size: 2rem;
}

.battle-layout {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.battle-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(260px, 1fr);
  grid-template-rows: minmax(185px, auto) minmax(215px, auto);
  gap: 16px;
  min-height: 520px;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    radial-gradient(ellipse at 76% 30%, rgba(47, 141, 245, 0.11), transparent 28rem),
    radial-gradient(ellipse at 24% 76%, rgba(55, 185, 111, 0.12), transparent 26rem),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 48%, #eef5fb 100%);
  box-shadow: var(--shadow);
}

.battle-stage .stat-list {
  display: none;
}

.battle-stage::before {
  content: '';
  position: absolute;
  inset: auto -10% 45% -44%;
  height: 42%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(230, 240, 248, 0.82));
  transform: skewY(-5deg);
}

.battle-stage::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(223, 230, 238, 0.72);
  border-radius: 28px;
  pointer-events: none;
}

.battle-hud,
.sprite-slot {
  position: relative;
  z-index: 1;
}

.battle-hud {
  width: min(100%, 360px);
  padding: 14px 15px;
  border-radius: 20px;
}

.enemy-hud {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: start;
}

.player-hud {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  justify-self: end;
}

.hud-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.side-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.battle-hud h2 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 9px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.combatant-name-text {
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rarity-icon {
  flex: 0 0 auto;
    width: 22px;
    height: 22px;
    object-fit: contain;
    margin-top: 1px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-height: 26px;
}

.type-pill,
.status-pill,
.rarity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.type-icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.rarity-pill {
  color: #17212b;
  text-transform: none;
}

.type-Water { background: var(--blue); }
.type-Fire { background: var(--red); }
.type-Electric { background: var(--yellow); color: var(--ink); }
.type-Grass { background: var(--green); }
.type-Rock { background: var(--rock); }

.status-pill {
  color: var(--ink);
  background: #eef3f8;
  box-shadow: inset 0 0 0 1px var(--line);
}

.hp-row span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.hp-track {
  height: 12px;
  padding: 2px;
  border-radius: 999px;
  background: #e7edf3;
  overflow: hidden;
}

.hp-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #21b864, #87e28a);
  transition: width 220ms ease, background 220ms ease;
}

.stat-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.stat-list div {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 12px;
  background: #f5f8fb;
}

.stat-list dt {
  color: var(--subtle);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.stat-list dd {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sprite-slot {
  display: grid;
  place-items: center;
  min-height: 170px;
  isolation: isolate;
}

.sprite-slot::before {
    content: '';
    position: absolute;
    width: 42vh;
    height: 10vh;
    border-radius: 50%;
    background: radial-gradient(circle, var(--creature-color, #dfe6ee) 0%, 
color-mix(in srgb, var(--creature-color, #dfe6ee) 44%, transparent) 44%, transparent 72%);
    opacity: 1;
    filter: blur(15px);
    pointer-events: none;
    z-index: 0;
    box-shadow: 0px 21px 94px -9px var(--creature-color);
}

.enemy-slot {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  justify-self: center;
  width: min(100%, 390px);
}

.enemy-slot::before {
  top: 168px;
}

.player-slot {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  justify-self: center;
  width: min(100%, 440px);
}

.player-slot::before {
  bottom: -20px;
}

.battle-shadow {
  position: absolute;
  bottom: 16px;
  width: 78%;
  max-width: 310px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(44, 63, 81, 0.18) 0%, rgba(44, 63, 81, 0.08) 52%, transparent 72%);
  transform: rotate(-2deg);
}

.enemy-slot .battle-shadow {
  bottom: -10px;
  width: 122%;
}

.fighter-img,
.battle-sprite {
  display: block;
  width: auto;
  height: auto;
  image-rendering: auto;
}

.battle-sprite {
  --hit-filter: brightness(0) saturate(100%) invert(31%) sepia(84%) saturate(2742%) hue-rotate(337deg) brightness(104%) contrast(94%);
  position: relative;
  z-index: 2;
  max-width: min(86%, 300px);
  max-height: 260px;
}

.player-sprite {
  --sprite-home: translate(-2%, 4%);
  --sprite-attack: translate(8%, -8%) scale(1.055);
  --sprite-hit-a: translate(-9%, 3%) rotate(-2deg);
  --sprite-hit-b: translate(4%, 5%) rotate(1.5deg);
  --sprite-hit-c: translate(-5%, 4%) rotate(-1deg);
  max-width: min(94%, 360px);
  max-height: 310px;
  transform: var(--sprite-home);
}

.enemy-sprite {
  --sprite-home: translate(2%, -2%);
  --sprite-attack: translate(-9%, 8%) scale(1.045);
  --sprite-hit-a: translate(11%, -3%) rotate(2deg);
  --sprite-hit-b: translate(-2%, -1%) rotate(-1.5deg);
  --sprite-hit-c: translate(8%, -2%) rotate(1deg);
  transform: var(--sprite-home);
}

.game-message-panel {
  position: relative;
  min-height: 90px;
  padding: 18px 56px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.game-message-panel p {
  min-height: 2.5em;
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 850;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.game-message-panel .pvp-turn-timer {
  min-height: 0;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0;
}

.message-cursor {
  position: absolute;
  right: 22px;
  bottom: 14px;
  color: var(--blue);
  font-size: 1rem;
  animation: blink-cursor 0.85s steps(1) infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0; }
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
}

.control-grid .panel,
.log-panel {
  border-radius: 24px;
  padding: 18px;
}

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

#attackButtons {
  max-height: 430px;
  padding-right: 8px;
  overflow: auto;
  padding-top: 10px;
  padding-bottom: 10px;
}

.action-button {
  min-height: 76px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px rgba(25, 38, 52, 0.06);
}

.action-button:hover:not(:disabled) {
  box-shadow: inset 0 0 0 1px var(--blue), 0 12px 24px rgba(47, 141, 245, 0.12);
}

.action-button strong,
.action-button span {
  display: block;
}

.action-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.battle-log {
  max-height: 360px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  background: #f7f9fc;
  list-style: none;
}

.battle-log li {
  font-weight: 750;
}

.log-entry {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(223, 230, 238, 0.95);
  border-left-width: 7px;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
}

.log-entry:last-child {
  margin-bottom: 0;
}

.log-kind {
  display: inline-flex;
  justify-content: center;
  min-width: 72px;
  padding: 4px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.log-text {
  overflow-wrap: anywhere;
}

.log-start,
.log-round,
.log-order,
.log-turn { background: rgba(255, 255, 255, 0.95); }
.log-start { border-left-color: #17212b; }
.log-round { border-left-color: #66727f; }
.log-order { border-left-color: #8b5cf6; }
.log-turn { border-left-color: #2f8df5; }
.log-attack { border-left-color: #f97316; background: #fff8f0; }
.log-damage { border-left-color: #ef4444; background: #fff4f4; }
.log-effectiveness { border-left-color: #06b6d4; background: #effcff; }
.log-heal { border-left-color: #22c55e; background: #f0fff6; }
.log-shield { border-left-color: #3b82f6; background: #f0f7ff; }
.log-trap { border-left-color: #9c7b62; background: #fbf7f2; }
.log-recoil { border-left-color: #db2777; background: #fff2f8; }
.log-charge { border-left-color: #f5bd24; background: #fffbeb; }
.log-status { border-left-color: #8b5cf6; background: #f8f5ff; }
.log-item { border-left-color: #22c55e; background: #f0fff6; }
.log-miss,
.log-skip,
.log-cancel,
.log-roll-fail { border-left-color: #94a3b8; background: #f8fafc; }
.log-roll-success { border-left-color: #14b8a6; background: #effefa; }
.log-win { border-left-color: #f5bd24; background: #fffbeb; }

.log-start .log-kind { background: #17212b; }
.log-round .log-kind { background: #66727f; }
.log-order .log-kind { background: #8b5cf6; }
.log-turn .log-kind { background: #2f8df5; }
.log-attack .log-kind { background: #f97316; }
.log-damage .log-kind { background: #ef4444; }
.log-effectiveness .log-kind { background: #06b6d4; }
.log-heal .log-kind { background: #22c55e; }
.log-shield .log-kind { background: #3b82f6; }
.log-trap .log-kind { background: #9c7b62; }
.log-recoil .log-kind { background: #db2777; }
.log-charge .log-kind { background: #f5bd24; color: var(--ink); }
.log-status .log-kind { background: #8b5cf6; }
.log-item .log-kind { background: #22c55e; }
.log-miss .log-kind,
.log-skip .log-kind,
.log-cancel .log-kind,
.log-roll-fail .log-kind { background: #94a3b8; }
.log-roll-success .log-kind { background: #14b8a6; }
.log-win .log-kind { background: #f5bd24; color: var(--ink); }

@media (max-width: 900px) {
  .setup-panel,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr auto;
  }

  .card-actions-buttons {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .card-actions-buttons button {
    flex: 1 1 160px;
  }

  .craft-slots {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .battle-mode-grid {
    grid-template-columns: 1fr;
  }

  .market-layout {
    grid-template-columns: 1fr;
  }

  .battle-stage {
    grid-template-columns: 1fr 1fr;
    min-height: 470px;
  }

  .battle-hud {
    width: 100%;
  }

  .battle-hud {
    width: min(100%, 320px);
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 16px, 1180px);
    padding-top: 8px;
  }

  .bottom-nav {
    bottom: 8px;
    border-radius: 22px;
  }

  .nav-button {
    min-height: 54px;
    border-radius: 16px;
    font-size: 0.64rem;
  }

  .hero,
  .setup-panel,
  .auth-panel,
  .craft-layout,
  .game-message-panel,
  .control-grid .panel,
  .log-panel {
    border-radius: 20px;
    padding: 14px;
  }

  .card-actions {
    bottom: 8px;
    width: calc(100% - 16px);
    border-radius: 20px;
  }

  .viewer-card-slot .card-preview,
  .tilt-card .card-preview {
    --card-scale: 0.56 !important;
    --card-preview-width: 287px !important;
    --card-preview-height: 430px !important;
  }

  .viewer-card-slot {
    width: 287px;
    height: 430px;
  }

  .card-glare {
    width: 287px;
    height: 430px;
    border-radius: 22px;
  }

  .craft-preview-panel {
    align-items: stretch;
  }



  .enemy-slot::before {
    top: 70px;
  }

  .player-slot::before{
    top: 124px;
  }


  .rarity-icon {
    width: 16px;
    height: 16px;
  }


  .battle-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(172px, auto) minmax(190px, auto);
    gap: 8px;
    min-height: 410px;
    border-radius: 24px;
  }

  .enemy-hud {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
  }

  .enemy-slot {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-self: center;
  }

  .player-slot {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    justify-self: center;
  }

  .player-hud {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    justify-self: end;
  }

  .battle-hud {
    width: min(100%, 188px);
    padding: 10px;
    border-radius: 16px;
  }

  .hud-heading {
    gap: 6px;
    margin-bottom: 5px;
  }

  .side-label {
    min-height: 18px;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .battle-hud h2 {
    margin-bottom: 7px;
    font-size: clamp(1rem, 5vw, 1.25rem);
  }

  .type-pill,
  .status-pill,
  .rarity-pill {
    min-height: 22px;
    padding: 2px 6px;
    font-size: 0.58rem;
  }

  .type-icon {
    width: 14px;
    height: 14px;
  }

  .hp-row span {
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  .hp-track {
    height: 10px;
  }

  .enemy-slot,
  .player-slot {
    min-height: 150px;
    width: 100%;
  }

  .battle-shadow {
    bottom: 10px;
    width: 88%;
    height: 40px;
  }

  .battle-sprite {
    max-width: 118%;
    max-height: 168px;
  }

  .player-sprite {
    --sprite-home: translate(-8%, 6%);
    --sprite-attack: translate(8%, -8%) scale(1.055);
    --sprite-hit-a: translate(-15%, 5%) rotate(-2deg);
    --sprite-hit-b: translate(-2%, 7%) rotate(1.5deg);
    --sprite-hit-c: translate(-11%, 6%) rotate(-1deg);
    max-width: 138%;
    max-height: 190px;
    transform: var(--sprite-home);
  }

.enemy-sprite {
  --sprite-home: translate(4%, -2%);
  --sprite-attack: translate(-9%, 8%) scale(1.045);
  --sprite-hit-a: translate(11%, -3%) rotate(2deg);
  --sprite-hit-b: translate(-2%, -1%) rotate(-1.5deg);
  --sprite-hit-c: translate(8%, -2%) rotate(1deg);
  transform: var(--sprite-home);
}

  .button-grid {
    grid-template-columns: 1fr;
  }

  .game-message-panel {
    min-height: 84px;
    padding: 14px 42px 14px 14px;
  }

  .log-entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .log-kind {
    justify-content: flex-start;
    width: fit-content;
  }
}

.battle-sprite.is-attacking,
.battle-sprite.is-hit,
.battle-sprite.is-statused,
.battle-sprite.is-healed {
  will-change: transform, filter, opacity;
}

.player-sprite.is-attacking,
.enemy-sprite.is-attacking {
  animation: attack-lunge 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.battle-sprite.hit-damage { --hit-filter: brightness(0) saturate(100%) invert(31%) sepia(84%) saturate(2742%) hue-rotate(337deg) brightness(104%) contrast(94%); }
.battle-sprite.hit-poison { --hit-filter: brightness(0) saturate(100%) invert(25%) sepia(91%) saturate(1764%) hue-rotate(267deg) brightness(92%) contrast(97%); }
.battle-sprite.hit-burn { --hit-filter: brightness(0) saturate(100%) invert(52%) sepia(94%) saturate(1927%) hue-rotate(1deg) brightness(104%) contrast(101%); }
.battle-sprite.hit-freeze { --hit-filter: brightness(0) saturate(100%) invert(72%) sepia(89%) saturate(1061%) hue-rotate(168deg) brightness(103%) contrast(101%); }
.battle-sprite.hit-sleep { --hit-filter: brightness(0) saturate(100%) invert(44%) sepia(48%) saturate(1516%) hue-rotate(225deg) brightness(95%) contrast(94%); }
.battle-sprite.hit-paralysis { --hit-filter: brightness(0) saturate(100%) invert(76%) sepia(82%) saturate(984%) hue-rotate(358deg) brightness(103%) contrast(103%); }
.battle-sprite.hit-trap { --hit-filter: brightness(0) saturate(100%) invert(47%) sepia(17%) saturate(852%) hue-rotate(338deg) brightness(89%) contrast(87%); }
.battle-sprite.heal-hp { --heal-glow: rgba(34, 197, 94, 0.48); --heal-glow-soft: rgba(134, 239, 172, 0.34); }
.battle-sprite.heal-cleanse { --heal-glow: rgba(56, 189, 248, 0.46); --heal-glow-soft: rgba(186, 230, 253, 0.34); }

.player-sprite.is-hit,
.enemy-sprite.is-hit {
  animation: hit-shake 360ms cubic-bezier(0.25, 0.9, 0.25, 1);
}

.player-sprite.is-statused,
.enemy-sprite.is-statused {
  animation: status-flash 420ms ease-out;
}

.player-sprite.is-healed,
.enemy-sprite.is-healed {
  animation: heal-pulse 520ms ease-out;
}

@keyframes attack-lunge {
  0% { transform: var(--sprite-home); }
  42% { transform: var(--sprite-attack); }
  100% { transform: var(--sprite-home); }
}

@keyframes hit-shake {
  0% { transform: var(--sprite-home); filter: drop-shadow(0 18px 18px rgba(25, 38, 52, 0.18)); }
  24% { transform: var(--sprite-hit-a); filter: var(--hit-filter) drop-shadow(0 0 22px rgba(239, 68, 68, 0.38)); }
  48% { transform: var(--sprite-hit-b); filter: var(--hit-filter) drop-shadow(0 0 22px rgba(239, 68, 68, 0.32)); }
  72% { transform: var(--sprite-hit-c); filter: drop-shadow(0 18px 18px rgba(25, 38, 52, 0.18)); }
  100% { transform: var(--sprite-home); filter: drop-shadow(0 18px 18px rgba(25, 38, 52, 0.18)); }
}

@keyframes status-flash {
  0%, 100% { transform: var(--sprite-home); filter: drop-shadow(0 18px 18px rgba(25, 38, 52, 0.18)); opacity: 1; }
  35% { transform: var(--sprite-home) scale(1.035); filter: var(--hit-filter) drop-shadow(0 0 24px rgba(139, 92, 246, 0.38)); opacity: 0.92; }
  65% { transform: var(--sprite-home) scale(0.985); filter: var(--hit-filter) drop-shadow(0 0 20px rgba(139, 92, 246, 0.26)); opacity: 1; }
}

@keyframes heal-pulse {
  0%, 100% { transform: var(--sprite-home); filter: drop-shadow(0 18px 18px rgba(25, 38, 52, 0.18)); opacity: 1; }
  22% { transform: var(--sprite-home) translateY(-5px) scale(1.035); filter: brightness(1.18) saturate(1.18) drop-shadow(0 0 22px var(--heal-glow)); opacity: 1; }
  48% { transform: var(--sprite-home) translateY(0) scale(1.07); filter: brightness(1.32) saturate(1.28) drop-shadow(0 0 34px var(--heal-glow-soft)); opacity: 1; }
  74% { transform: var(--sprite-home) scale(1.015); filter: brightness(1.12) saturate(1.12) drop-shadow(0 0 18px var(--heal-glow)); opacity: 1; }
}

/* Minimal black-and-white interface layer. Card template and battle sprite geometry stay intact. */
:root {
  --ink: #111111;
  --muted: #686864;
  --subtle: #969690;
  --bg: #e9e9e5;
  --card: #ffffff;
  --card-soft: #f6f6f3;
  --line: #deded8;
  --line-strong: #bdbdb5;
  --shadow: 0 28px 70px rgba(17, 17, 17, 0.13);
  --shadow-soft: 0 18px 44px rgba(17, 17, 17, 0.08);
  --blue: #111111;
  --red: #111111;
  --yellow: #d9d9d2;
  --green: #111111;
  --rock: #9f9f98;
  --hp-green: #111111;
  --hp-yellow: #111111;
  --hp-red: #111111;
  font-family: 'Manrope', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  background: var(--bg);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.92), transparent 34rem),
    linear-gradient(180deg, #f4f4f1 0%, #e7e7e1 100%);
  letter-spacing: -0.018em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 62%);
}

::selection {
  color: #fff;
  background: #111;
}

button,
input {
  font-family: inherit;
}

input {
  min-height: 52px;
  border: 1px solid #d7d7d0;
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

input::placeholder {
  color: #9a9a92;
}

input:focus {
  border-color: #111;
  box-shadow: 0 0 0 5px rgba(17, 17, 17, 0.08);
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.shell {
  width: min(1188px, calc(100% - 40px));
  padding: 28px 0 124px;
}

.is-battling .shell {
  padding-top: 18px;
}

.panel,
.battle-hud,
.battle-menu-head,
.profile-card,
.craft-preview-panel,
.sort-panel,
.game-message-panel,
.log-panel {
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.auth-panel,
.setup-panel {
  margin-top: 0;
  border-radius: 42px;
}

.auth-panel {
  display: grid;
  gap: 22px;
  max-width: 560px;
  min-height: min(760px, calc(100vh - 56px));
  align-content: center;
  padding: clamp(28px, 6vw, 58px);
  grid-auto-flow: row;
  justify-content: center;
  align-items: center;
  justify-items: center;
}

.auth-panel h2,
.setup-panel h2,
.collection-head h2,
.battle-menu-head h2,
.profile-card h2,
.panel h2,
.log-heading h2 {
  color: #111;
  font-weight: 900;
  letter-spacing: -0.075em;
}

.auth-panel h2 {
  margin: 0;
  font-size: clamp(3rem, 12vw, 6.8rem);
  line-height: 0.86;
}

.auth-panel p {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -0.02em;
}

.setup-panel {
  min-height: calc(100vh - 172px);
  padding: clamp(18px, 3vw, 34px);
}

.setup-head {
  margin-bottom: clamp(18px, 3vw, 30px);
  padding: 4px 2px;
}

.setup-head p {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.setup-head strong {
  color: #111;
  font-size: 1rem;
  letter-spacing: -0.03em;
  text-transform: none;
}

.app-view {
  margin-top: 0;
}

.collection-header {
  position: relative;
  display: flex;
  height: 150px;
  background: url(assets/booster_header.jpg);
  background-size: cover;
  background-position: left;
  background-repeat: no-repeat;
  align-content: flex-end;
  justify-content: flex-end;
  border-radius: 30px;
}

.collection-head,
.log-heading {
  gap: 18px;
  margin-bottom: 18px;
}

.collection-head h2,
.battle-menu-head h2,
.profile-card h2,
.panel h2,
.log-heading h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.92;
}

.eyebrow {
  color: #111;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.room-status,
.hint {
  color: #4f4f4f;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
  margin-top: 10px;
  margin-bottom: 10px;
}

.primary-button,
.ghost-button,
.action-button,
.sort-button,
.battle-mode-card,
.viewer-return-button,
.favorite-viewer-button,
.pvp-code-button,
.sheet-close {
  transition: transform 170ms ease, box-shadow 170ms ease, background 170ms ease, color 170ms ease, border-color 170ms ease;
}

.primary-button {
  min-height: 52px;
  border-radius: 999px;
  padding: 12px 22px;
  color: #fff;
  background: #111;
  box-shadow: 0 16px 34px rgba(17, 17, 17, 0.18);
  font-weight: 900;
}

.primary-cyan {
  background: #00ffb2;
  color: #000;
}

.primary-button:hover:not(:disabled) {
  background: #000;
  box-shadow: 0 20px 42px rgba(17, 17, 17, 0.24);
  color: #fff;
}

.ghost-button {
  min-height: 48px;
  border-radius: 999px;
  padding: 11px 18px;
  color: #111;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.12);
  font-weight: 850;
}

.ghost-button:hover:not(:disabled) {
  background: #fff;
  box-shadow: inset 0 0 0 1px #111, 0 12px 26px rgba(17, 17, 17, 0.09);
}

.danger-button {
  color: #111;
  background: #f1f1ec;
}

.danger-button:hover:not(:disabled) {
  color: #fff;
  background: #111;
}

.join-row {
  gap: 10px;
}

.join-row input {
  flex: 1 1 220px;
}

.sort-panel {
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  margin: 0 0 22px;
  padding: 7px;
  border-radius: 999px;
}

.sort-panel span {
  padding: 0 8px 0 10px;
  color: var(--subtle);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sort-button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  color: #666660;
  background: rgba(17, 17, 17, 0.05);
  font-size: 0.76rem;
  font-weight: 900;
}

.sort-button:hover {
  color: #111;
  background: rgba(17, 17, 17, 0.05);
}

.sort-button.is-active {
  color: #fff;
  background: #111;
  box-shadow: none;
}

.choice-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

.choice-card {
  position: relative;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 30px;
  background: transparent;
}

.choice-card:hover {
  border-color: rgba(17, 17, 17, 0.1);
  background: rgba(255, 255, 255, 0.42);
  transform: translateY(-3px);
}

.battle-pick.is-picked {
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 42px rgba(17, 17, 17, 0.12);
}

.bottom-nav {
  bottom: 18px;
  width: min(660px, calc(100% - 26px));
  gap: 5px;
  padding: 7px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 24px 58px rgba(17, 17, 17, 0.16);
  backdrop-filter: blur(22px);
}

.nav-button {
  min-height: 52px;
  border-radius: 999px;
  color: var(--black);
  font-size: 0.7rem;
  font-weight: 900;
}

.nav-icon {
  width: 32px;
  height: 32px;
  margin-top: 8px;
}

.booster-backdrop,
.viewer-backdrop {
  background: #fff;
}

.booster-panel {
  gap: 18px;
  max-width: min(100%, 540px);
  padding: clamp(20px, 4vw, 34px);
}

.booster-panel h2 {
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
  text-align: center;
}

.booster-pack span {
  color: #111;
  background: #fff;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.14em;
}

.card-actions {
  position: fixed;
  bottom: 92px;
  gap: 14px;
  padding: 16px 48px 12px 16px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 20px 48px rgba(17, 17, 17, 0.16);
  backdrop-filter: blur(24px);
}

.card-actions .primary-button,
.card-actions .ghost-button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.76rem;
  letter-spacing: -0.02em;
}

.card-actions-summary strong {
  color: #111;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.card-actions-summary span {
  color: var(--muted);
  font-size: 0.8rem;
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  color: #111;
  background: #f2f2ed;
  font-size: 1.2rem;
}

.sheet-close:hover {
  color: #fff;
  background: #111;
}

.viewer-return-button {
  min-height: 50px;
  border-radius: 999px;
  padding: 0 28px;
  color: #111;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 42px rgba(17, 17, 17, 0.22);
  font-family: 'Manrope', sans-serif;
  font-weight: 900;
}

.favorite-viewer-button {
  min-height: 50px;
  border-radius: 999px;
  padding: 0 28px;
  box-shadow: 0 18px 42px rgba(17, 17, 17, 0.18);
  font-family: 'Manrope', sans-serif;
  font-weight: 900;
}

.craft-slots {
  gap: clamp(10px, 2vw, 18px);
  margin-bottom: 18px;
}

.craft-slot {
  min-height: 220px;
  border: 1px dashed rgba(17, 17, 17, 0.22);
  border-radius: 30px;
  color: #777770;
  background: rgba(255, 255, 255, 0.46);
}

.craft-slot:not(.is-empty) {
  border-color: rgba(17, 17, 17, 0.12);
  color: #111;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 38px rgba(17, 17, 17, 0.08);
}

.craft-preview-panel {
  display: flex;
  margin: 0 0 24px;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 34px;
  flex-direction: column;
}

.craft-preview-panel h2 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 0.96;
  letter-spacing: -0.07em;
}

.craft-chances {
  gap: 10px;
}

.chance-row,
.profile-stat-card {
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.chance-row strong,
.profile-stat-card strong {
  color: #111;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.battle-menu-head {
  gap: 12px;
  padding: clamp(20px, 4vw, 36px);
  border-radius: 38px;
  background:
    radial-gradient(circle at 92% 10%, rgba(17, 17, 17, 0.08), transparent 18rem),
    rgba(255, 255, 255, 0.78);
}

.battle-menu-head .hint {
  max-width: 56rem;
}

.battle-selected-card {
  margin: 28px 0 18px;
}

.battle-choice-grid {
  max-height: 350px;
  padding: 10px;
  border: 1px solid rgba(17, 17, 17, 0.07);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.34);
}

.battle-mode-grid {
  gap: 14px;
  margin-top: 24px;
}

.battle-mode-card {
  min-height: 168px;
  border-radius: 32px;
  padding: 22px;
  color: #111;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.battle-mode-card:hover:not(:disabled) {
  transform: translateY(-3px);
  background: #fff;
  box-shadow: 0 24px 54px rgba(17, 17, 17, 0.13);
}

.battle-mode-card span {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

.battle-mode-card small {
  max-width: 18rem;
  color: #000000;
  font-size: 0.86rem;
  line-height: 1.45;
  background: rgb(255 255 255 / 67%);
  border-radius: 5px;
  padding: 1px 2px;
}

.battle-tutorial-card {
  grid-column: 1 / -1;
  justify-self: start;
  width: 100%;
  min-height: 82px;
  align-content: center;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 24px;
  box-shadow: 0 14px 32px rgba(17, 17, 17, 0.08);
}

.battle-tutorial-card:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 18px 38px rgba(17, 17, 17, 0.12);
}

.battle-tutorial-card span {
  font-size: 1rem;
}

.battle-tutorial-card small {
  max-width: 21rem;
  color: #4f4f4f;
  background: transparent;
  padding: 0;
}

.pvp-code-button {
  color: #fff;
  background: #111;
  box-shadow: 0 22px 50px rgba(17, 17, 17, 0.2);
}

.profile-card {
  gap: 24px;
  padding: clamp(22px, 4vw, 36px);
  border-radius: 38px;
}

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

.profile-stat-card {
  padding: 20px;
}

.profile-stat-card span {
  color: var(--subtle);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-stat-card strong {
  font-size: 3rem;
  line-height: 0.9;
}

.battle-layout {
  gap: 16px;
}

.battle-stage {
  border-color: rgba(17, 17, 17, 0.08);
  background:
    radial-gradient(ellipse at 76% 30%, rgba(255, 255, 255, 0.82), transparent 28rem),
    radial-gradient(ellipse at 24% 76%, rgba(17, 17, 17, 0.06), transparent 26rem),
    linear-gradient(180deg, #f7f7f3 0%, #ecece6 100%);
  box-shadow: var(--shadow);
}

.battle-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 24px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(4px);
  text-align: center;
  pointer-events: none;
}

.battle-result-overlay strong {
  color: var(--black);
  font-size: clamp(2.6rem, 9vw, 6.8rem);
  font-weight: 1000;
  line-height: 0.92;
  letter-spacing: -0.08em;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.battle-result-overlay span {
  padding: 9px 14px;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.9);
  font-weight: 950;
}

.battle-stage::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.58));
}

.battle-stage::after {
  border-color: rgba(17, 17, 17, 0.06);
}

.battle-hud {
  border-color: rgba(17, 17, 17, 0.1);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 40px rgba(17, 17, 17, 0.09);
}

.side-label {
  color: #8a8a84;
}

.battle-hud h2 {
  color: #111;
  font-weight: 900;
}

.type-pill,
.status-pill,
.rarity-pill {
  color: #111;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.12);
}

.type-Water,
.type-Fire,
.type-Electric,
.type-Grass,
.type-Rock {
  color: #111;
  background: rgba(255, 255, 255, 0.7);
}

.hp-row span {
  color: #777770;
}

.hp-track {
  background: rgba(17, 17, 17, 0.1);
}

.hp-fill {
  background: #111 !important;
}

.game-message-panel {
  min-height: 96px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
}

.game-message-panel p {
  color: #111;
  font-weight: 850;
}

.message-cursor {
  color: #111;
}

.control-grid {
  gap: 16px;
}

.control-grid .panel,
.log-panel {
  border-radius: 32px;
  padding: clamp(16px, 2.5vw, 24px);
}

.control-grid .panel h2,
.log-panel h2 {
  margin-bottom: 18px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.button-grid {
  gap: 10px;
}

.action-button {
  min-height: 84px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 24px;
  padding: 16px;
  color: #111;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: none;
}

.action-button:hover:not(:disabled) {
  border-color: #111;
  background: #fff;
  box-shadow: 0 16px 36px rgba(17, 17, 17, 0.1);
}

.action-button strong {
  font-weight: 900;
  letter-spacing: -0.045em;
}

.action-button span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

#attackButtons,
#itemButtons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.control-grid .panel .panel-heading-row h2 {
  margin: 0;
}

.attack-info-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #111;
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.18);
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 900;
}

.attack-info-button:hover {
  transform: translateY(-1px);
}

.item-icon-img,
.item-icon-fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.item-icon-img {
  object-fit: contain;
}

.item-icon-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 11px;
  background: #111;
  font-weight: 1000;
}

.market-item-icon {
  overflow: hidden;
  padding: 5px;
  background: #f4f4ef;
}

.attack-action-button {
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.action-button.attack-action-button strong {
  display: block;
  font-size: clamp(0.92rem, 1.5vw, 1.1rem);
  line-height: 1.08;
}

.attack-type-mark {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #111;
  background: rgba(17, 17, 17, 0.06);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-button .attack-type-mark {
  display: inline-flex;
  margin: 0;
  color: #111;
  font-size: 0.66rem;
  line-height: 1;
}

.attack-type-mark img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.item-action-button {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-action-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 15px;
  padding: 4px;
  background: #f4f4ef;
}

.item-action-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.action-button .item-action-body,
.action-button .item-action-body span {
  display: grid;
  margin: 0;
}

.item-action-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-action-body span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.attack-info-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.attack-info-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 17, 17, 0.48);
  backdrop-filter: blur(10px);
}

.attack-info-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(680px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 28px 78px rgba(17, 17, 17, 0.28);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.attack-info-panel::-webkit-scrollbar {
  display: none;
}

.attack-info-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.attack-info-head h2,
.attack-info-head p {
  margin: 0;
}

.attack-info-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: #111;
  background: #e8e8e8;
  font-size: 1.35rem;
  font-weight: 900;
}

.attack-info-close:hover {
  color: #fff;
  background: #111;
}

.attack-info-list {
  display: grid;
  gap: 10px;
}

.attack-info-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 22px;
}

.attack-info-card-head,
.attack-info-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attack-info-card-head strong {
  font-size: 1.08rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.attack-info-stats {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.attack-info-stats span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #111;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}

.attack-info-card p {
  margin: 0;
  color: var(--black);
  font-weight: 400;
}

.battle-tutorial-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 18px;
}

.battle-tutorial-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 17, 17, 0.5);
  backdrop-filter: blur(10px);
}

.battle-tutorial-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 34px;
  background:#fff;
  box-shadow: 0 28px 78px rgba(17, 17, 17, 0.3);
}

.battle-tutorial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(18px, 3vw, 28px) clamp(18px, 3vw, 30px) 0;
}

.battle-tutorial-head h2,
.battle-tutorial-head p {
  margin: 0;
}

.battle-tutorial-head h2 {
  margin-top: 4px;
  font-size: clamp(1.9rem, 5vw, 3.3rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.battle-tutorial-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: #111;
  background: #e8e8e8;
  font-size: 1.35rem;
  font-weight: 900;
}

.battle-tutorial-close:hover {
  color: #fff;
  background: #111;
}

.battle-tutorial-body {
  overflow: auto;
  padding: 18px clamp(18px, 3vw, 30px) 20px;
  color: #272722;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
}

.battle-tutorial-body p {
  margin: 0 0 12px;
}

.battle-tutorial-body p:last-child {
  margin-bottom: 0;
}

.battle-tutorial-body ul {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.battle-tutorial-body li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.battle-tutorial-body li::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #111;
}

.battle-tutorial-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(18px, 3vw, 30px) clamp(18px, 3vw, 28px);
  border-top: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(241, 241, 236, 0.72);
}

.battle-tutorial-nav {
  min-width: 112px;
}

.battle-tutorial-progress {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #777770;
  font-size: 0.78rem;
  font-weight: 900;
}

.battle-tutorial-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.battle-tutorial-dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(17, 17, 17, 0.2);
}

.battle-tutorial-dot.is-active {
  width: 24px;
  background: #111;
}

.is-viewing-battle-tutorial {
  overflow: hidden;
}

.battle-log {
  max-height: 390px;
  padding: 8px;
  border-color: rgba(17, 17, 17, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.42);
}

.log-entry,
.log-start,
.log-round,
.log-order,
.log-turn,
.log-attack,
.log-damage,
.log-effectiveness,
.log-heal,
.log-shield,
.log-trap,
.log-recoil,
.log-charge,
.log-status,
.log-item,
.log-miss,
.log-skip,
.log-cancel,
.log-roll-fail,
.log-roll-success,
.log-win {
  border-color: rgba(17, 17, 17, 0.08);
  border-left-color: #111;
  background: rgba(255, 255, 255, 0.76);
}

.log-kind,
.log-start .log-kind,
.log-round .log-kind,
.log-order .log-kind,
.log-turn .log-kind,
.log-attack .log-kind,
.log-damage .log-kind,
.log-effectiveness .log-kind,
.log-heal .log-kind,
.log-shield .log-kind,
.log-trap .log-kind,
.log-recoil .log-kind,
.log-charge .log-kind,
.log-status .log-kind,
.log-item .log-kind,
.log-miss .log-kind,
.log-skip .log-kind,
.log-cancel .log-kind,
.log-roll-fail .log-kind,
.log-roll-success .log-kind,
.log-win .log-kind {
  color: #fff;
  background: #111;
}

@media (max-width: 900px) {
  .shell {
    width: min(calc(100% - 28px), 1188px);
  }

  .booster-status-panel {
    grid-template-columns: 1fr 1fr;
  }

  .booster-claim-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .auth-panel {
    min-height: calc(100vh - 56px);
  }

  .battle-mode-grid {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr auto;
    bottom: 86px;
    border-radius: 22px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(calc(100% - 16px), 1188px);
    padding-top: 8px;
    padding-bottom: 108px;
  }

  .auth-panel,
  .setup-panel,
  .battle-menu-head,
  .profile-card,
  .craft-preview-panel,
  .game-message-panel,
  .control-grid .panel,
  .log-panel {
    border-radius: 28px;
    padding: 16px;
  }

  .auth-panel {
    min-height: calc(100vh - 16px);
    align-content: end;
    padding-bottom: 36px;
  }

  .admin-shell {
    width: min(calc(100% - 16px), 1180px);
    padding-top: 10px;
  }

  .admin-login-card {
    margin-top: 18px;
  }

  .admin-login-form {
    grid-template-columns: 1fr;
  }

  .admin-grant-grid {
    grid-template-columns: 1fr;
  }

  .admin-actions,
  .admin-actions button,
  .admin-tabs,
  .admin-tab,
  .admin-pagination,
  .admin-pagination button,
  .admin-users-toolbar,
  .admin-users-toolbar label {
    width: 100%;
  }

  .admin-pagination {
    justify-content: stretch;
  }

  .auth-panel h2 {
    font-size: clamp(2.6rem, 14vw, 4.2rem);
  }

  .join-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .collection-head,
  .setup-head,
  .log-heading {
    align-items: flex-start;
  }

  .collection-head h2,
  .battle-menu-head h2,
  .profile-card h2,
  .panel h2,
  .log-heading h2 {
    font-size: clamp(1.85rem, 8vw, 2.8rem);
  }

  .sort-panel {
    width: 100%;
    border-radius: 24px;
  }

  .booster-status-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 16px;
    border-radius: 26px;
  }

  .booster-timer-head {
    display: grid;
    gap: 4px;
  }

  .booster-claim-button {
    min-width: 0;
  }

  .sort-panel span {
    flex-basis: 100%;
    padding: 4px 8px 0;
  }

  .sort-button {
    flex: 1 1 auto;
  }

  .pagination-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 24px;
    grid-auto-flow: column;
    align-items: baseline;
  }

  .pagination-summary,
  .pagination-range {
    grid-column: 1 / -1;
    text-align: center;
  }

  .choice-grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 12px;
  }

  .choice-card {
    padding: 6px;
    border-radius: 24px;
  }

  .bottom-nav {
    bottom: 8px;
    width: calc(100% - 16px);
    border-radius: 24px;
  }

  .market-hero {
    display: grid;
    padding: 18px;
    background: url(assets/market_header.jpg);
    background-size: contain;
    background-position: right;
    background-repeat: no-repeat;
  }

  .market-wallet {
    text-align: left;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }

  .nav-button {
    min-height: 52px;
    border-radius: 18px;
    font-size: 0.62rem;
  }

  .card-actions {
    bottom: 78px;
    width: calc(100% - 16px);
    gap: 10px;
    padding: 16px 46px 10px 10px;
    border-radius: 20px;
  }

  .card-actions-summary strong {
    font-size: 0.92rem;
  }

  .card-actions-summary span {
    font-size: 0.72rem;
  }

  .card-actions-buttons button {
    flex: 1 1 calc(50% - 6px);
  }

  .craft-slot {
    min-height: 198px;
    border-radius: 24px;
  }

  .battle-choice-grid {
    border-radius: 26px;
  }

  .battle-mode-card {
    min-height: 142px;
    border-radius: 26px;
    padding: 18px;
  }

  .battle-tutorial-card {
    min-height: 76px;
  }

  .battle-tutorial-panel {
    max-height: calc(100vh - 24px);
    border-radius: 28px;
  }

  .battle-tutorial-footer {
    grid-template-columns: 1fr 1fr;
  }

  .battle-tutorial-progress {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .battle-tutorial-nav {
    min-width: 0;
  }

  .game-message-panel {
    min-height: 88px;
  }

  .action-button {
    min-height: 76px;
    border-radius: 22px;
  }
}
