*,
*::before,
*::after {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

:root {
  --bg-top: #0f1729;
  --bg-bottom: #07111d;
  --bg-radial: rgba(87, 146, 255, 0.2);
  --panel: rgba(12, 19, 34, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f2f6ff;
  --text-soft: #9fb0cc;
  --accent: #77b7ff;
  --accent-strong: #2a7fff;
  --tile-top: #edf4ff;
  --tile-bottom: #95bfff;
  --tile-shadow: rgba(2, 18, 44, 0.45);
  --cell-size: clamp(64px, 11vw, 84px);
  --cell-gap: clamp(12px, 2.4vw, 18px);
  --cell-highlight-size: clamp(54px, 9.5vw, 72px);
  --tile-radius: clamp(16px, 2.5vw, 18px);
  --brand-logo-width: clamp(220px, 34vw, 300px);
  --brand-logo-max-height: clamp(88px, 14vw, 120px);
  --fab-foreground: rgba(242, 246, 255, 0.88);
  --fab-border: rgba(242, 246, 255, 0.55);
  --fab-hover-border: rgba(242, 246, 255, 0.76);
  --fab-background: rgba(12, 19, 34, 0.16);
  --fab-hover-background: rgba(12, 19, 34, 0.28);
  --footer-text: #8ea4cb;
  --fab-offset: clamp(12px, 2vw, 16px);
}

body[data-theme="light"] {
  --bg-top: #f8fbff;
  --bg-bottom: #edf3fb;
  --bg-radial: rgba(101, 153, 255, 0.08);
  --text-main: #111722;
  --text-soft: #4f5e78;
  --panel-border: rgba(9, 16, 30, 0.08);
  --fab-foreground: rgba(18, 24, 36, 0.92);
  --fab-border: rgba(18, 24, 36, 0.48);
  --fab-hover-border: rgba(18, 24, 36, 0.72);
  --fab-background: rgba(255, 255, 255, 0.38);
  --fab-hover-background: rgba(255, 255, 255, 0.6);
  --footer-text: #51617d;
  --tile-shadow: rgba(33, 58, 104, 0.22);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, var(--bg-radial), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

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

button,
a,
[role="button"],
.tile,
.brand-button,
.primary-button,
.theme-fab,
.info-fab,
.back-fab {
  -webkit-touch-callout: none;
  user-select: none;
}

.shell {
  width: 100%;
  margin: 0 auto;
  padding: 18px 0 40px;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.info-modal[hidden] {
  display: none;
}

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.info-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 24, 0.42);
  backdrop-filter: blur(4px);
}

.info-modal-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  border-radius: 24px;
  background: rgba(12, 19, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 48px rgba(4, 10, 24, 0.28);
  color: var(--text-main);
}

body[data-theme="light"] .info-modal-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(17, 24, 36, 0.08);
  box-shadow: 0 18px 42px rgba(37, 56, 92, 0.16);
}

.info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.info-modal-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.info-modal-text {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.info-modal-text + .info-modal-text {
  margin-top: 12px;
}

body[data-theme="light"] .info-modal-text {
  color: #4f5e78;
}

.back-fab,
.theme-fab,
.info-fab {
  position: fixed;
  top: var(--fab-offset);
  z-index: 20;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fab-foreground);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.back-fab {
  left: var(--fab-offset);
}

.theme-fab {
  left: var(--fab-offset);
}

.info-fab {
  right: var(--fab-offset);
}

.back-fab::before,
.theme-fab::before,
.info-fab::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  border: 2.5px solid var(--fab-border);
  background: var(--fab-background);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.back-fab:hover::before,
.theme-fab:hover::before,
.info-fab:hover::before {
  border-color: var(--fab-hover-border);
  background: var(--fab-hover-background);
}

.back-fab:focus-visible,
.theme-fab:focus-visible,
.info-fab:focus-visible {
  outline: none;
}

.back-fab:focus-visible::before,
.theme-fab:focus-visible::before,
.info-fab:focus-visible::before {
  border-color: rgba(119, 183, 255, 0.95);
  box-shadow:
    0 0 0 3px rgba(42, 127, 255, 0.22),
    0 4px 16px rgba(0, 0, 0, 0.15);
}

.back-glyph {
  position: relative;
  width: 12px;
  height: 12px;
  display: block;
  z-index: 1;
}

.back-glyph::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.theme-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  display: block;
  z-index: 1;
  margin: 0;
  transform: translate(-50%, -50%);
}

body[data-theme="dark"] .theme-glyph {
  border-radius: 999px;
  background: #eff9f4;
}

body[data-theme="light"] .theme-glyph {
  border-radius: 999px;
  background: #111722;
}

body[data-theme="light"] .theme-glyph::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--bg-top);
  transform: translate(-18%, -50%);
}

.info-glyph {
  position: relative;
  width: 10px;
  height: 18px;
  display: block;
  z-index: 1;
  transform: translateY(1px);
}

.info-glyph::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 3px;
  background: currentColor;
  transform: translateX(-50%);
}

.info-glyph::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 10px;
  background: currentColor;
  transform: translateX(-50%);
}

.brand-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: clamp(18px, 3vw, 28px);
  margin-bottom: clamp(36px, 6vw, 52px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-button:focus-visible {
  outline: none;
}

.brand-button:focus-visible .brand-logo {
  filter:
    drop-shadow(0 10px 24px rgba(0, 0, 0, 0.22))
    drop-shadow(0 0 0.5px rgba(119, 183, 255, 0.95))
    drop-shadow(0 0 12px rgba(42, 127, 255, 0.28));
}

.brand-logo {
  width: var(--brand-logo-width);
  height: auto;
  max-height: var(--brand-logo-max-height);
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.22));
}

body[data-theme="light"] .brand-logo {
  filter: brightness(0) saturate(100%) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.08));
}

.action-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px 0;
}

.product-blurb {
  max-width: 420px;
  text-align: center;
  color: var(--text-soft);
}

.product-blurb p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.product-blurb p + p {
  margin-top: 6px;
}

button,
input {
  font: inherit;
}

.primary-button {
  border: 0;
  cursor: pointer;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  color: white;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #58a4ff, #1a6dff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 28px rgba(14, 89, 220, 0.35);
}

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

.grid-frame {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: clamp(8px, 1.6vw, 12px) clamp(12px, 2vw, 18px) 18px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
}

.site-footer {
  width: 100%;
  padding: 12px 16px 12px;
  text-align: center;
  flex: 0 0 auto;
  transform: translateY(10px);
}

.site-footer p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--footer-text);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-separator {
  margin: 0 0.3em;
}

.policy-shell {
  width: 100%;
  min-height: 100vh;
  padding: 88px 20px 32px;
  display: flex;
  justify-content: center;
}

.policy-card {
  width: min(760px, 100%);
  border-radius: 28px;
  padding: 28px 28px 24px;
  background: rgba(10, 18, 32, 0.58);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 48px rgba(4, 10, 24, 0.18);
  backdrop-filter: blur(10px);
}

.privacy-page {
  background: #ffffff;
  color: #111111;
}

.privacy-page .policy-card {
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow: none;
  backdrop-filter: none;
}

.policy-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.policy-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.policy-updated {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.privacy-page .policy-updated {
  color: #555555;
}

.policy-section + .policy-section {
  margin-top: 24px;
}

.policy-section h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.policy-section p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-main);
}

.privacy-page .policy-title,
.privacy-page .policy-section h2,
.privacy-page .policy-section p,
.privacy-page .policy-list,
.privacy-page .back-link {
  color: #111111;
}

.privacy-page .back-fab {
  color: rgba(17, 17, 17, 0.9);
}

.privacy-page .back-fab::before {
  border-color: rgba(17, 17, 17, 0.35);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.policy-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-main);
  line-height: 1.6;
}

.policy-list li + li {
  margin-top: 8px;
}

.board-area {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: start;
  overflow: visible;
  min-height: 0;
  padding-top: clamp(12px, 2vw, 20px);
}

.grid-shell {
  position: relative;
  flex: 0 0 auto;
  left: auto;
  margin-inline: auto;
  transform-origin: top center;
}

.grid-cells,
.tile-grid {
  position: absolute;
  inset: 0;
}

.grid-cells {
  z-index: 0;
  pointer-events: none;
}

.panel-cell {
  position: absolute;
  width: var(--cell-highlight-size);
  height: var(--cell-highlight-size);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)),
    rgba(137, 182, 241, 0.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    inset 0 0 0 1px rgba(145, 190, 245, 0.028);
}

body[data-theme="light"] .panel-cell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(235, 242, 252, 0.88)),
    rgba(120, 160, 220, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 1px rgba(108, 145, 208, 0.26),
    0 8px 16px rgba(30, 52, 94, 0.08);
}

.tile-grid {
  z-index: 1;
  pointer-events: none;
}

.tile {
  position: relative;
  width: var(--cell-size);
  min-height: var(--cell-size);
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border-radius: var(--tile-radius);
  color: #14233e;
  text-align: center;
  cursor: grab;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 160ms ease;
  transition-property: left, top, transform, box-shadow, opacity;
  transition-duration: 460ms, 460ms, 180ms, 180ms, 160ms;
  transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1), cubic-bezier(0.2, 0.7, 0.2, 1), ease, ease, ease;
  overflow: visible;
  user-select: none;
  touch-action: none;
}

.tile-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 3;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #ff4b4b;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  cursor: default;
  transform: scale(0.7);
  box-shadow: 0 8px 16px rgba(140, 19, 19, 0.26);
  transition: transform 180ms ease, opacity 180ms ease;
}

.tile.is-positioned {
  position: absolute;
  pointer-events: auto;
}

.tile:hover {
  transform: translateY(-3px);
}

.tile:active {
  cursor: grabbing;
}

.tile.is-dragging {
  z-index: 5;
  cursor: grabbing;
  opacity: 0.92;
  transform: scale(1.06);
  transition: none;
}

.tile.is-menu-open {
  z-index: 6;
  transform: scale(1.14);
}

.tile.is-menu-open .tile-delete {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.tile-shadow {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  bottom: 2px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    0 12px 22px rgba(1, 10, 25, 0.38),
    0 3px 0 rgba(70, 110, 170, 0.4);
  transition: box-shadow 180ms ease;
}

body[data-theme="light"] .tile-shadow {
  box-shadow:
    0 14px 28px rgba(33, 58, 104, 0.22),
    0 3px 0 rgba(113, 147, 200, 0.34);
}

.tile:hover .tile-shadow {
  box-shadow:
    0 16px 26px rgba(1, 10, 25, 0.42),
    0 4px 0 rgba(70, 110, 170, 0.45);
}

body[data-theme="light"] .tile:hover .tile-shadow {
  box-shadow:
    0 18px 30px rgba(33, 58, 104, 0.24),
    0 4px 0 rgba(113, 147, 200, 0.34);
}

.tile:active .tile-shadow {
  box-shadow:
    0 8px 14px rgba(1, 10, 25, 0.28),
    0 2px 0 rgba(70, 110, 170, 0.34);
}

.tile.is-dragging .tile-shadow {
  box-shadow:
    0 24px 36px rgba(1, 10, 25, 0.46),
    0 6px 0 rgba(70, 110, 170, 0.38);
}

.tile-rotor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(180deg, #dcecff 0%, #7aaaf0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -14px 18px rgba(21, 73, 142, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    0 0 0 2px rgba(255, 255, 255, 0.14);
  will-change: transform;
  backface-visibility: hidden;
  transform-origin: center center;
  overflow: hidden;
}

.tile.is-path-rotating .tile-rotor {
  animation: tile-path-rotate 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
  animation-delay: var(--path-rotate-delay, 0ms);
}

body[data-theme="light"] .tile-rotor {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -14px 18px rgba(28, 54, 102, 0.12),
    inset 0 0 0 2px rgba(255, 255, 255, 0.62),
    0 0 0 2px rgba(52, 76, 122, 0.18);
}

.tile-icon-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: var(--tile-radius);
  background: #ffffff;
  overflow: hidden;
}

.tile-icon-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.tile-icon {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: var(--tile-radius);
  object-fit: cover;
}

.tile-fallback {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: var(--tile-radius);
  font-size: 2rem;
  font-weight: 700;
  color: white;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.34), transparent 32%),
    linear-gradient(180deg, #3e8eff, #1d4c9b);
}

.tile-rotor::before {
  content: "";
  position: absolute;
  inset: 2px 2px auto 2px;
  height: 44%;
  border-radius: 16px 16px 12px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.2) 58%, rgba(255, 255, 255, 0));
  pointer-events: none;
}

.tile-rotor::after {
  content: "";
  position: absolute;
  inset: auto 2px 2px 2px;
  height: 24px;
  border-radius: 0 0 16px 16px;
  background:
    linear-gradient(180deg, rgba(18, 46, 94, 0), rgba(18, 46, 94, 0.16)),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

@keyframes tile-path-rotate {
  0% {
    transform: rotate(0deg) translateY(0);
  }
  100% {
    transform: rotate(360deg) translateY(0);
  }
}

@media (max-width: 700px) {
  .shell {
    height: 100svh;
    padding-top: 8px;
  }

  .back-fab {
    top: 12px;
    left: 12px;
    width: 46px;
    height: 46px;
  }

  .info-fab {
    top: 12px;
    right: 12px;
    width: 46px;
    height: 46px;
  }

  .theme-fab {
    top: 12px;
    left: 12px;
    width: 46px;
    height: 46px;
  }

  .brand-header {
    margin-top: 18px;
    margin-bottom: 36px;
  }

  .action-row {
    padding-bottom: 4px;
  }

  .product-blurb {
    max-width: 340px;
  }

  .product-blurb p {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .primary-button {
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.95rem;
  }

  .grid-frame {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 8px;
  }

  .site-footer {
    transform: none;
    padding-top: 6px;
    padding-bottom: 10px;
  }
}
