:root {
  --wine-900: #160708;
  --wine-800: #290b0f;
  --wine-700: #481118;
  --wine-600: #6d1721;
  --wine-500: #982231;
  --accent-red: #d4454f;
  --accent-gold: #eec38c;
  --text-main: #fff5f1;
  --text-soft: #e4c5bf;
  --glass: rgba(19, 7, 9, 0.56);
  --glass-strong: rgba(17, 5, 7, 0.78);
  --line: rgba(255, 208, 198, 0.22);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  font-family: "Rajdhani", sans-serif;
  color: var(--text-main);
  background: #060102;
}

body.is-game {
  background: #10140f;
}

button,
input {
  font: inherit;
}

.background-shell {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.background-full {
  position: absolute;
  inset: 0;
  background-image: url("./Pokeworldfundo.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.is-active {
  display: flex;
}

.screen-start {
  align-items: center;
  justify-content: center;
}

.ghost-enter-button {
  border: 0;
  background: transparent;
  color: #fff;
  font-family: "Cinzel", serif;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  padding: 18px 26px;
  cursor: pointer;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.55), 0 0 40px rgba(212, 69, 79, 0.45);
  transition: transform 180ms ease, text-shadow 180ms ease, color 180ms ease;
}

.ghost-enter-button:hover {
  transform: translateY(-4px) scale(1.02);
  color: #ffe1d8;
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.72), 0 0 44px rgba(212, 69, 79, 0.8);
}

.auth-panel,
.section-frame,
.soon-panel {
  width: min(92vw, 1080px);
  border: 1px solid var(--line);
  background:
    linear-gradient(155deg, rgba(120, 24, 37, 0.12), rgba(10, 4, 5, 0.8)),
    rgba(10, 4, 5, 0.54);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(92vw, 374px);
  min-height: min(92vw, 374px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: 10px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.auth-tab,
.primary-button {
  border: 1px solid rgba(255, 216, 206, 0.18);
  background: linear-gradient(180deg, rgba(144, 31, 45, 0.82), rgba(57, 10, 16, 0.96));
  color: var(--text-main);
  padding: 10px 12px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.auth-tab {
  background: rgba(255, 255, 255, 0.04);
}

.auth-tab.is-active,
.primary-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 226, 219, 0.42);
  box-shadow: 0 10px 30px rgba(123, 21, 31, 0.35);
}

.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.is-active {
  display: grid;
}

.auth-form h1 {
  margin: 0 0 4px;
  font-family: "Cinzel", serif;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  letter-spacing: 0.08em;
}

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

.auth-form span {
  color: var(--text-soft);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.auth-form input {
  width: 100%;
  border: 1px solid rgba(255, 224, 216, 0.12);
  background: rgba(10, 3, 4, 0.7);
  color: var(--text-main);
  padding: 10px 12px;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(240, 163, 149, 0.65);
  box-shadow: 0 0 0 3px rgba(196, 72, 80, 0.18);
}

.remember-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 2px;
  flex-direction: row;
  flex-wrap: nowrap;
  width: auto;
  max-width: 100%;
}

.auth-form label.remember-line {
  display: inline-flex;
  grid-template-columns: none;
}

.remember-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
}

.remember-line span {
  display: inline-block;
  white-space: nowrap;
  line-height: 1;
  margin: 0;
}

.status-message {
  min-height: 28px;
  margin: 10px 0 0;
  color: var(--accent-gold);
  letter-spacing: 0.03em;
}

.status-message[data-tone="error"] {
  color: #ff8e97;
}

.status-message[data-tone="success"] {
  color: #f0cd96;
}

.section-frame,
.soon-panel {
  padding: 32px;
  border-radius: 18px;
}

.section-heading {
  text-align: center;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #ff9da6;
  font-family: "Cinzel", serif;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.section-heading h2,
.soon-panel h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(2rem, 3.8vw, 3.2rem);
}

.subtext,
#chosen-trainer-text {
  margin: 12px auto 0;
  max-width: 720px;
  color: var(--text-soft);
  font-size: 1.08rem;
}

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

.trainer-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(26, 9, 11, 0.68), rgba(12, 5, 6, 0.92));
  overflow: hidden;
  min-height: 294px;
  padding: 0;
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.trainer-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(255, 226, 219, 0.42);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.38);
}

.trainer-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 294px;
  object-fit: cover;
}

.trainer-glow {
  position: absolute;
  inset: auto -20% -22% -20%;
  height: 170px;
  filter: blur(28px);
  opacity: 0.75;
  transition: transform 220ms ease;
}

.trainer-card:hover .trainer-glow {
  transform: scale(1.08);
}

.trainer-card-plant .trainer-glow {
  background: radial-gradient(circle, rgba(87, 202, 113, 0.7), transparent 68%);
}

.trainer-card-fire .trainer-glow {
  background: radial-gradient(circle, rgba(255, 115, 63, 0.72), transparent 68%);
}

.trainer-card-rock .trainer-glow {
  background: radial-gradient(circle, rgba(227, 180, 103, 0.72), transparent 68%);
}

.trainer-info {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 18px;
  background: linear-gradient(180deg, transparent, rgba(8, 2, 3, 0.95));
  text-align: left;
}

.trainer-info strong {
  font-family: "Cinzel", serif;
  font-size: 1.28rem;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.trainer-type {
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.trainer-type-plant {
  color: #69dd7f;
}

.trainer-type-fire {
  color: #ff9a52;
}

.trainer-type-rock {
  color: #d8b284;
}

.trainer-tooltip {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  background: rgba(12, 5, 7, 0.42);
  border: 1px solid rgba(255, 226, 219, 0.22);
  backdrop-filter: blur(14px);
  color: #fff7f2;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.trainer-card:hover .trainer-tooltip,
.trainer-card:focus-visible .trainer-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-title {
  color: #ffd7b2;
  font-family: "Cinzel", serif;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
}

.highlight-plus {
  color: #61e07b;
  font-style: normal;
  font-weight: 700;
}

.highlight-chance {
  color: #ffbc7a;
  font-style: normal;
  font-weight: 700;
}

.highlight-bonus {
  color: #ff8ea0;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.screen-soon {
  text-align: center;
}

.soon-panel {
  width: min(92vw, 700px);
}

.soon-panel h2 {
  background: linear-gradient(90deg, #fff5f1, #ffb0a9, #f7d19a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gender-frame {
  width: min(92vw, 760px);
}

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

.gender-card {
  min-height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(26, 9, 11, 0.72), rgba(12, 5, 6, 0.94));
  color: var(--text-main);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.gender-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 226, 219, 0.42);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.gender-card strong {
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gender-preview {
  width: 96px;
  height: 96px;
  background-repeat: no-repeat;
  background-size: 1530px 597px;
  image-rendering: pixelated;
  transform: scale(1.25);
}

.gender-preview-male {
  background-image: url("./Character/trainermale.png");
  background-position: 0 -96px;
}

.gender-preview-female {
  background-image: url("./Character/trainerfemale.png");
  background-position: 0 -96px;
}

.screen-game {
  display: none;
  padding: 0;
  overflow: hidden;
  background: #203b24;
}

.screen-game.is-active {
  display: block;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.game-hud {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 11, 9, 0.74);
  backdrop-filter: blur(12px);
  padding: 9px 12px;
  color: #fff;
}

.game-hud strong {
  color: #f3d08f;
}

.game-hud span {
  color: #c9d6c4;
}

.coords-hud {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  min-width: 170px;
  border: 1px solid rgba(238, 195, 140, 0.34);
  background: linear-gradient(180deg, rgba(23, 28, 24, 0.88), rgba(8, 11, 9, 0.78));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  color: #f3d08f;
  padding: 8px 14px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.game-menu-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 6;
  width: 46px;
  height: 42px;
  display: grid;
  place-content: center;
  gap: 5px;
  border: 1px solid rgba(238, 195, 140, 0.34);
  background: rgba(8, 11, 9, 0.78);
  cursor: pointer;
}

.game-menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #f3d08f;
}

.game-menu {
  position: fixed;
  top: 66px;
  right: 14px;
  z-index: 7;
  width: min(320px, calc(100vw - 28px));
  display: none;
  gap: 14px;
  border: 1px solid rgba(238, 195, 140, 0.28);
  background: rgba(13, 18, 20, 0.94);
  backdrop-filter: blur(16px);
  color: #f5f7f2;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.game-menu.is-open {
  display: grid;
}

.game-menu-head,
.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-menu-head strong {
  color: #f3d08f;
  font-size: 1.25rem;
}

.game-menu-head button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f5f7f2;
  padding: 7px 9px;
  cursor: pointer;
}

.settings-field,
.settings-group {
  display: grid;
  gap: 8px;
}

.settings-field span,
.settings-group > span,
.settings-toggle span {
  color: #c9d6c4;
  font-weight: 700;
}

.graphics-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.graphics-options label {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  text-align: center;
}

.quick-slots {
  position: fixed;
  left: 14px;
  top: 76px;
  z-index: 4;
  display: grid;
  gap: 8px;
}

.quick-slot {
  position: relative;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(238, 195, 140, 0.28);
  background:
    radial-gradient(circle at 50% 28%, rgba(238, 195, 140, 0.18), transparent 58%),
    linear-gradient(180deg, rgba(27, 36, 31, 0.92), rgba(9, 13, 11, 0.92));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 6px;
}

.quick-slot:hover,
.quick-slot.is-active {
  border-color: #eec38c;
  box-shadow: 0 0 18px rgba(238, 195, 140, 0.28), 0 10px 22px rgba(0, 0, 0, 0.32);
}

.quick-slot.is-active::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(117, 222, 133, 0.72);
  pointer-events: none;
}

.quick-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quick-slot-empty {
  cursor: default;
  opacity: 0.48;
}

.quick-slot-empty::before {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
}

.mobile-controls {
  --control-scale: 1;
  position: fixed;
  inset: auto 18px 18px 18px;
  z-index: 4;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.mobile-controls.is-active {
  display: flex;
}

.joystick-pad {
  position: relative;
  width: calc(156px * var(--control-scale));
  height: calc(156px * var(--control-scale));
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.action-buttons button {
  border: 1px solid rgba(238, 195, 140, 0.34);
  background: rgba(8, 11, 9, 0.72);
  color: #f3d08f;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.joy-zone {
  position: absolute;
  z-index: 1;
  width: calc(52px * var(--control-scale));
  height: calc(52px * var(--control-scale));
  display: grid;
  place-items: center;
  color: #f3d08f;
  border: 1px solid rgba(238, 195, 140, 0.34);
  background: rgba(8, 11, 9, 0.72);
  font-size: calc(1.8rem * var(--control-scale));
  line-height: 1;
  box-shadow: none;
  pointer-events: none;
}

.joystick-pad::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(27, 36, 31, 0.88), rgba(9, 13, 11, 0.88));
  clip-path: polygon(
    33.333% 0,
    66.666% 0,
    66.666% 33.333%,
    100% 33.333%,
    100% 66.666%,
    66.666% 66.666%,
    66.666% 100%,
    33.333% 100%,
    33.333% 66.666%,
    0 66.666%,
    0 33.333%,
    33.333% 33.333%
  );
  border: 1px solid rgba(238, 195, 140, 0.34);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.joystick-pad::after {
  content: "";
  position: absolute;
  left: calc(52px * var(--control-scale));
  top: calc(52px * var(--control-scale));
  width: calc(52px * var(--control-scale));
  height: calc(52px * var(--control-scale));
  background: rgba(238, 195, 140, 0.12);
  pointer-events: none;
}

.joy-up {
  top: 0;
  left: calc(52px * var(--control-scale));
  border-bottom-color: transparent;
}

.joy-left {
  top: calc(52px * var(--control-scale));
  left: 0;
  border-right-color: transparent;
}

.joy-right {
  top: calc(52px * var(--control-scale));
  right: 0;
  border-left-color: transparent;
}

.joy-down {
  bottom: 0;
  left: calc(52px * var(--control-scale));
  border-top-color: transparent;
}

.action-buttons {
  display: flex;
  gap: calc(14px * var(--control-scale));
  pointer-events: auto;
}

.action-buttons button {
  width: calc(64px * var(--control-scale));
  height: calc(64px * var(--control-scale));
  border-radius: 50%;
  font-size: calc(1.45rem * var(--control-scale));
  font-weight: 800;
}

@media (max-width: 520px), (max-height: 720px) {
  .mobile-controls {
    --control-scale: clamp(0.58, 24vw, 0.82);
    inset: auto 10px 10px 10px;
  }
}

@media (max-width: 380px), (max-height: 560px) {
  .mobile-controls {
    --control-scale: 0.58;
  }
}

.map-editor {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 5;
  width: min(420px, 92vw);
  height: 100vh;
  display: none;
  grid-template-rows: auto auto auto auto auto auto auto minmax(0, 1fr);
  gap: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(13, 18, 20, 0.94);
  color: #f5f7f2;
  padding: 16px;
  backdrop-filter: blur(16px);
}

.map-editor.is-open {
  display: grid;
}

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

.editor-head div {
  display: grid;
}

.editor-head strong {
  font-size: 1.4rem;
}

.editor-head span,
.tile-help {
  color: #b5c2bb;
}

.editor-head button,
.layer-buttons button,
.collision-buttons button,
.editor-tools button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f5f7f2;
  padding: 9px 10px;
  cursor: pointer;
}

.editor-head button:hover,
.layer-buttons button:hover,
.collision-buttons button:hover,
.editor-tools button:hover,
.layer-buttons button.is-active,
.collision-buttons button.is-active,
.editor-tools button.is-active {
  border-color: #eec38c;
  background: rgba(238, 195, 140, 0.16);
}

.editor-save-card {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(105, 199, 131, 0.36);
  background: rgba(42, 95, 57, 0.28);
  padding: 10px 12px;
}

.editor-save-card span {
  color: #bde5c6;
}

.layer-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.layer-buttons button {
  min-width: 0;
  padding: 8px 4px;
  font-size: 0.86rem;
}

.editor-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.collision-buttons button {
  min-width: 0;
  font-weight: 700;
}

.collision-buttons button[data-collision="col1"] {
  border-color: rgba(255, 84, 84, 0.65);
  color: #ffd3d3;
}

.collision-buttons button[data-collision="col1"].is-active {
  background: rgba(255, 84, 84, 0.24);
}

.collision-buttons button[data-collision="col2"] {
  border-color: rgba(101, 157, 255, 0.68);
  color: #d8e6ff;
}

.collision-buttons button[data-collision="col2"].is-active {
  background: rgba(101, 157, 255, 0.24);
}

.collision-buttons button[data-collision="col3"] {
  border-color: rgba(55, 215, 199, 0.68);
  color: #d2fffb;
}

.collision-buttons button[data-collision="col3"].is-active {
  background: rgba(55, 215, 199, 0.24);
}

.brush-preview-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 86px;
  min-height: 86px;
  max-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  overflow: hidden;
}

.brush-preview-card strong {
  color: #f3d08f;
}

.brush-preview-wrap {
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(45deg, #252b2b 25%, transparent 25%),
    linear-gradient(-45deg, #252b2b 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #252b2b 75%),
    linear-gradient(-45deg, transparent 75%, #252b2b 75%),
    #161b1b;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#brush-preview-canvas {
  display: block;
  image-rendering: pixelated;
  max-width: none;
  max-height: none;
}

.tileset-scroll {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #111;
}

#tileset-canvas {
  display: block;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

@media (max-width: 980px) {
  body {
    overflow-y: auto;
  }

  .screen {
    position: relative;
    min-height: 100vh;
  }

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

  .trainer-card,
  .trainer-card img {
    min-height: 260px;
  }

  body.is-game {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .auth-panel,
  .section-frame,
  .soon-panel {
    padding: 20px;
  }

  .auth-panel {
    min-height: 0;
  }

  .ghost-enter-button {
    font-size: 1.05rem;
    letter-spacing: 0.18em;
  }

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