.mtg-page {
  --mtg-blue: #0e5fa8;
  --mtg-green: #1ea96b;
  --mtg-white: #ffffff;
  --mtg-ink: #113047;
  --mtg-soft: #eaf4ff;
  --mtg-warning: #f97316;
  --mtg-control-left: url('../img/ui/control_left.png');
  --mtg-control-right: url('../img/ui/control_right.png');
  --mtg-control-jump: url('../img/ui/control_jump.png');
  --mtg-control-clean: url('../img/ui/control_clean.png');
  background:
    radial-gradient(circle at 20% 10%, rgba(30, 169, 107, 0.22), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(14, 95, 168, 0.25), transparent 34%),
    linear-gradient(180deg, #f7fcff 0%, #edf6ff 40%, #e7f2ff 100%);
  color: var(--mtg-ink);
  min-height: 100vh;
  padding-bottom: 56px;
}

.mtg-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

.mtg-hero {
  padding: 30px 0 18px;
}

.mtg-hero-card {
  background: linear-gradient(130deg, #0e5fa8, #1683ba 48%, #1ea96b);
  color: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(8, 57, 103, 0.25);
}

.mtg-title {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
  font-weight: 800;
}

.mtg-subtitle {
  margin: 0 0 18px;
  max-width: 760px;
  font-size: 17px;
  opacity: 0.95;
}

.mtg-video-wrap {
  margin-bottom: 18px;
}

.mtg-video-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.mtg-video {
  width: 100%;
  max-width: 820px;
  height: min(45vw, 360px);
  border: 0;
  border-radius: 14px;
  background: #093458;
}

.mtg-game {
  padding: 6px 0 0;
}

.mtg-alert {
  border-radius: 12px;
  padding: 12px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  margin-bottom: 16px;
}

.mtg-howto {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(14, 95, 168, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(13, 49, 78, 0.08);
}

.mtg-howto-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: #0d3d64;
}

.mtg-howto-list {
  margin: 0;
  padding-left: 18px;
  color: #16466a;
  font-size: 13px;
  line-height: 1.45;
}

.mtg-howto-list li + li {
  margin-top: 4px;
}

.mtg-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mtg-stat {
  background: var(--mtg-white);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 8px 26px rgba(13, 49, 78, 0.1);
}

.mtg-stat-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.72;
}

.mtg-stat strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.mtg-speed {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(17, 48, 71, 0.72);
}

.mtg-progress {
  margin-bottom: 12px;
}

.mtg-progress-label {
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 700;
}

.mtg-progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(14, 95, 168, 0.14);
  overflow: hidden;
}

.mtg-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #1ea96b, #66d789);
  transition: width 220ms ease;
}

.mtg-game-shell {
  position: relative;
  background: var(--mtg-white);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 14px 38px rgba(13, 49, 78, 0.14);
}

.mtg-game-canvas {
  width: 100%;
  min-height: 320px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #bfe5ff 0%, #f0fbff 100%);
  touch-action: none;
}

.mtg-game-canvas canvas {
  display: block;
  width: 100%;
  height: auto;
}

.mtg-controls-main {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mtg-button {
  border: 0;
  border-radius: 12px;
  background: #d8e7f7;
  color: #0d3655;
  font-weight: 700;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.mtg-button:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

.mtg-button:active {
  transform: translateY(0);
}

.mtg-button--primary {
  background: linear-gradient(90deg, #1ea96b, #2fc278);
  color: #fff;
}

.mtg-button--secondary {
  margin-top: 12px;
  width: 100%;
  background: linear-gradient(90deg, #0e5fa8, #1683ba);
  color: #fff;
}

.mtg-mobile-controls {
  display: none;
}

.mtg-mobile-controls--overlay {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: none;
  pointer-events: none;
}

.mtg-mobile-controls--overlay .mtg-control-btn {
  pointer-events: auto;
  position: absolute;
}

.mtg-control-btn {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  min-height: 56px;
  background-color: rgba(7, 81, 140, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.55);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 30px;
  color: transparent;
  font-size: 0;
  box-shadow: 0 6px 16px rgba(8, 39, 66, 0.45);
  transition: transform 0.1s ease, filter 0.1s ease, opacity 0.1s ease;
}

.mtg-control-btn:hover {
  filter: brightness(1.05);
}

.mtg-control-btn:active,
.mtg-control-btn.is-active {
  transform: scale(0.95);
}

.mtg-control-btn.is-cooldown {
  filter: grayscale(1) brightness(0.78);
  opacity: 0.72;
}

.mtg-control-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mtg-control-btn--left { background-image: var(--mtg-control-left); }
.mtg-control-btn--right { background-image: var(--mtg-control-right); }
.mtg-control-btn--jump { background-image: var(--mtg-control-jump); }
.mtg-control-btn--clean { background-image: var(--mtg-control-clean); }

.mtg-mobile-help {
  display: none;
  margin-top: 10px;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(14, 95, 168, 0.08);
  color: #16466a;
  font-size: 12px;
  line-height: 1.3;
}

.mtg-control-btn--left {
  left: 10px;
  bottom: 10px;
}

.mtg-control-btn--right {
  left: 76px;
  bottom: 10px;
}

.mtg-control-btn--jump {
  right: 76px;
  bottom: 10px;
}

.mtg-control-btn--clean {
  right: 10px;
  bottom: 10px;
}

.mtg-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 18, 34, 0.6);
  padding: 16px;
}

.mtg-modal.is-open {
  display: flex;
}

.mtg-modal-dialog {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.mtg-modal-close {
  position: absolute;
  right: 8px;
  top: 4px;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 24px;
  line-height: 1;
}

.mtg-modal-title {
  margin: 4px 0 12px;
  font-size: 28px;
  line-height: 1.08;
  color: #083965;
}

.mtg-modal-metrics {
  background: #f6fbff;
  border: 1px solid #d5e9fb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.mtg-modal-metrics > div {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}

.mtg-modal-metrics strong {
  color: #0f4f86;
}

.mtg-form {
  display: grid;
  gap: 10px;
}

.mtg-form-row span {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
  font-weight: 700;
}

.mtg-form-row input {
  width: 100%;
  border: 1px solid #c8dced;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
}

.mtg-form-row input:focus {
  outline: none;
  border-color: #1ea96b;
  box-shadow: 0 0 0 2px rgba(30, 169, 107, 0.18);
}

.mtg-form-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mtg-claim-message {
  margin-top: 10px;
  min-height: 20px;
  font-weight: 700;
  color: #0d5b97;
}

.mtg-claim-message.is-error {
  color: #c2410c;
}

.mtg-hidden {
  display: none;
}

@media (max-width: 900px) {
  .mtg-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mtg-stat strong {
    font-size: 24px;
  }
}

@media (max-width: 700px) {
  .mtg-hero {
    padding-top: 20px;
  }

  .mtg-hero-card {
    padding: 18px;
  }

  .mtg-subtitle {
    font-size: 15px;
  }

  .mtg-howto {
    padding: 9px 10px;
  }

  .mtg-howto-title {
    font-size: 14px;
  }

  .mtg-howto-list {
    font-size: 12px;
    padding-left: 16px;
  }

  .mtg-video {
    height: 52vw;
  }

  .mtg-dashboard {
    grid-template-columns: 1fr;
  }

  .mtg-controls-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mtg-mobile-controls--overlay {
    display: block;
  }

  .mtg-mobile-help {
    display: block;
  }
}

@media (max-width: 420px) {
  .mtg-control-btn {
    width: 52px;
    height: 52px;
    min-height: 52px;
    background-size: 27px;
  }

  .mtg-control-btn--right {
    left: 70px;
  }

  .mtg-control-btn--jump {
    right: 70px;
  }
}
