:root {
  --ink: #2a180b;
  --deep-blue: #063d8f;
  --hero-blue: #0b78df;
  --foam: #f9fdff;
  --gold: #ffc93d;
  --gold-deep: #d98918;
  --wood: #b96f2e;
  --wood-dark: #7a3f18;
  --paper: #ffe9bc;
  --paper-light: #fff4d8;
  --paper-edge: #b47438;
  --red: #e14d32;
  --shadow: 0 16px 28px rgba(0, 64, 125, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: #0794e9;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.adventure-page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(18px, 2.2vw, 28px) 18px 22px;
  isolation: isolate;
  animation: pageIn 560ms ease-out both;
}

.adventure-page::before {
  position: absolute;
  inset: 0;
  z-index: -3;
  content: "";
  background-image: url("./assets/one-piece-background.png");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(1.08) contrast(1.02);
  transform: scale(1.005);
}

.adventure-page::after {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    radial-gradient(circle at 50% 16%, rgba(0, 153, 255, 0.06), transparent 30%),
    linear-gradient(180deg, rgba(0, 120, 210, 0.03) 0%, rgba(0, 120, 210, 0.08) 100%);
  pointer-events: none;
}

.scene-shine {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 18%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 61% 20%, rgba(255, 255, 255, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 73% 34%, rgba(255, 255, 255, 0.62) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 74%, rgba(255, 255, 255, 0.68) 0 2px, transparent 3px);
  animation: shimmer 4.5s ease-in-out infinite;
}

.hero-sign {
  position: relative;
  z-index: 2;
  width: min(756px, 78vw);
  margin: clamp(22px, 3.2vh, 36px) auto 0;
  padding-top: 28px;
  text-align: center;
  filter: drop-shadow(0 18px 18px rgba(0, 57, 117, 0.28));
}

.rope {
  position: absolute;
  top: -44px;
  width: 13px;
  height: 168px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      145deg,
      #fff3cb 0 8px,
      #b98b55 8px 14px,
      #5c351c 14px 16px
    );
  box-shadow: inset -2px 0 0 rgba(55, 31, 15, 0.22);
}

.rope-left {
  left: 32px;
  transform: rotate(-8deg);
}

.rope-right {
  right: 32px;
  transform: rotate(8deg);
}

.ship-wheel {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 4;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 8px solid #bf741f;
  border-radius: 50%;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
  background:
    radial-gradient(circle, #16213a 0 42%, transparent 43%),
    conic-gradient(from 15deg, #f6b24d 0 10%, #9d551b 10% 20%, #f6b24d 20% 30%, #9d551b 30% 40%, #f6b24d 40% 50%, #9d551b 50% 60%, #f6b24d 60% 70%, #9d551b 70% 80%, #f6b24d 80% 90%, #9d551b 90% 100%);
  box-shadow: 0 8px 0 #7d3f15, 0 15px 18px rgba(33, 19, 10, 0.28);
  transform: translate(-50%, -3px);
}

.wood-plaque {
  position: relative;
  display: grid;
  min-height: 224px;
  place-items: center;
  padding: 42px 44px 28px;
  border: 17px solid #fff2be;
  border-radius: 19px;
  font-family: Georgia, "Times New Roman", serif;
  background:
    linear-gradient(180deg, rgba(255, 244, 191, 0.24), transparent 34%),
    repeating-linear-gradient(
      180deg,
      #c87932 0 31px,
      #a95b24 31px 36px,
      #d58a3c 36px 67px,
      #874617 67px 72px
    );
  box-shadow:
    inset 0 0 0 3px rgba(92, 47, 14, 0.2),
    inset 0 -14px 0 rgba(107, 50, 15, 0.18),
    0 8px 0 #693412;
}

.wood-plaque::before,
.wood-plaque::after {
  position: absolute;
  top: 56px;
  width: 22px;
  height: 22px;
  content: "";
  border: 4px solid #fff1b7;
  border-radius: 50%;
  background: #6a3815;
}

.wood-plaque::before {
  left: 26px;
}

.wood-plaque::after {
  right: 26px;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 4.9vw, 72px);
  font-weight: 1000;
  line-height: 0.96;
  letter-spacing: 0;
  color: #fff;
  -webkit-text-stroke: 7px var(--deep-blue);
  paint-order: stroke fill;
  text-shadow:
    0 6px 0 #054b9f,
    0 10px 0 #052d71,
    6px 10px 0 rgba(0, 0, 0, 0.18);
}

.tool-board {
  position: relative;
  z-index: 3;
  width: min(720px, calc(100vw - 28px));
  margin: clamp(160px, 16vh, 190px) auto 0;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 30px) clamp(22px, 2.6vw, 38px);
}

.tool-card {
  position: relative;
  display: grid;
  min-height: clamp(132px, 14.5vw, 162px);
  padding: 14px 12px 13px;
  border: 4px solid var(--paper-edge);
  border-radius: 24px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.78) 0 9px, transparent 10px),
    radial-gradient(circle at 84% 14%, rgba(190, 120, 56, 0.17) 0 8px, transparent 9px),
    linear-gradient(145deg, rgba(255, 248, 222, 0.98), rgba(250, 211, 151, 0.96));
  box-shadow:
    inset 0 0 0 3px rgba(255, 252, 233, 0.55),
    inset 0 -12px 0 rgba(173, 100, 42, 0.13),
    0 8px 0 #8d5528,
    var(--shadow);
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.tool-card::before {
  position: absolute;
  inset: 8px;
  content: "";
  border: 2px dashed rgba(126, 74, 34, 0.2);
  border-radius: 17px;
  pointer-events: none;
}

.tool-card:hover,
.tool-card:focus-visible {
  filter: brightness(1.05) saturate(1.06);
  box-shadow:
    inset 0 0 0 3px rgba(255, 252, 233, 0.66),
    inset 0 -12px 0 rgba(173, 100, 42, 0.13),
    0 12px 0 #8d5528,
    0 24px 34px rgba(0, 68, 136, 0.34);
  transform: translateY(-8px) scale(1.025);
}

.tool-card:focus-visible {
  outline: 5px solid rgba(255, 211, 76, 0.92);
  outline-offset: 4px;
}

.tool-card.is-coming {
  filter: saturate(0.94);
}

.tool-icon {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 72px;
  place-items: center;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1;
  text-shadow:
    0 3px 0 rgba(255, 255, 255, 0.76),
    0 8px 12px rgba(76, 43, 17, 0.25);
}

.tool-title {
  position: relative;
  z-index: 1;
  align-self: end;
  margin: 0;
  color: #2c190d;
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 1000;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 2px 0 rgba(255, 249, 226, 0.9);
}

.tool-status {
  position: absolute;
  top: -13px;
  right: -12px;
  z-index: 2;
  min-height: 28px;
  padding: 5px 10px;
  border: 2px solid #fff4c9;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  background: linear-gradient(180deg, #ff7b4d, #d63d2d);
  box-shadow: 0 4px 0 #8f2d1f;
}

.tool-card.is-online .tool-status {
  background: linear-gradient(180deg, #48d37a, #159849);
  box-shadow: 0 4px 0 #0b6330;
}

.sr-description {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.footer {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 4;
  display: inline-flex;
  max-width: calc(100vw - 36px);
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 2px solid rgba(255, 244, 201, 0.72);
  border-radius: 999px;
  color: #073b76;
  font-size: 13px;
  font-weight: 900;
  background: rgba(255, 248, 221, 0.82);
  box-shadow: 0 8px 20px rgba(0, 73, 143, 0.22);
  backdrop-filter: blur(6px);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 66px;
  z-index: 8;
  max-width: min(330px, calc(100vw - 40px));
  padding: 14px 18px;
  border: 3px solid #fff4c9;
  border-radius: 999px;
  color: #073b76;
  font-size: 15px;
  font-weight: 1000;
  background: linear-gradient(180deg, #fff7d9, #ffd66c);
  box-shadow: 0 8px 0 #b96f1d, 0 18px 28px rgba(0, 73, 143, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 900px) {
  .adventure-page {
    min-height: 100svh;
    padding-inline: 12px;
  }

  .hero-sign {
    width: min(620px, 86vw);
  }

  .tool-board {
    margin-top: clamp(120px, 12vh, 150px);
    width: min(660px, calc(100vw - 24px));
  }

  .tools-grid {
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .adventure-page {
    min-height: 100svh;
    padding-top: 12px;
    overflow-y: auto;
  }

  .adventure-page::before {
    background-position: 47% top;
    background-size: auto 100%;
  }

  .hero-sign {
    width: min(430px, 92vw);
    padding-top: 20px;
  }

  .rope {
    top: -34px;
    width: 9px;
    height: 118px;
  }

  .rope-left {
    left: 18px;
  }

  .rope-right {
    right: 18px;
  }

  .ship-wheel {
    width: 62px;
    height: 62px;
    border-width: 5px;
    font-size: 22px;
  }

  .wood-plaque {
    min-height: 132px;
    padding: 28px 20px 18px;
    border-radius: 19px;
    border-width: 12px;
  }

  h1 {
    font-size: clamp(29px, 8.2vw, 42px);
    -webkit-text-stroke: 4px var(--deep-blue);
    text-shadow:
      0 4px 0 #054b9f,
      0 7px 0 #052d71,
      4px 7px 0 rgba(0, 0, 0, 0.18);
  }

  .tool-board {
    width: min(420px, calc(100vw - 22px));
    margin-top: 90px;
    padding-bottom: 86px;
  }

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

  .tool-card {
    min-height: 124px;
    border-width: 3px;
    border-radius: 20px;
    box-shadow:
      inset 0 0 0 2px rgba(255, 252, 233, 0.55),
      inset 0 -9px 0 rgba(173, 100, 42, 0.13),
      0 6px 0 #8d5528,
      var(--shadow);
  }

  .tool-icon {
    min-height: 62px;
    font-size: 39px;
  }

  .tool-title {
    font-size: 18px;
  }

  .footer {
    left: 12px;
    right: 12px;
    bottom: 10px;
    justify-content: center;
    border-radius: 18px;
    text-align: center;
  }

  .footer a {
    display: none;
  }

  .toast {
    right: 12px;
    bottom: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: scale(1.01);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0%,
  100% {
    opacity: 0.62;
  }

  50% {
    opacity: 1;
  }
}
