:root {
  --paper: #f0f5ff;
  --ink: #0f1d2e;
  --line: rgba(15, 29, 46, 0.14);
  --sea: #1a4f79;
  --brand: #3b82f6;
  --brand-deep: #2563eb;
  --brand-soft: #93c5fd;
  --accent: #f59e0b;
  --accent-deep: #d97706;
  --panel: rgba(248, 252, 255, 0.92);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 48px rgba(10, 30, 60, 0.24);
  --shadow-sm: 0 4px 16px rgba(10, 30, 60, 0.12);
  --shadow-lg: 0 24px 64px rgba(8, 24, 52, 0.32);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  background:
    radial-gradient(ellipse at 25% 0%, rgba(59, 130, 246, 0.18), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(147, 197, 253, 0.15), transparent 30%),
    linear-gradient(160deg, #091a30 0%, #0f2e52 30%, #1a4878 58%, #2563eb 100%);
  background-attachment: fixed;
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100%;
}

button,
input,
select {
  font: inherit;
}

img {
  display: block;
}

.screen {
  min-height: 100vh;
  width: 100%;
}

.primary-button,
.secondary-button,
.tool-button,
.swatch-button,
.menu-icon-button,
.saved-board-card {
  border: 0;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    filter var(--transition);
}

.primary-button:hover,
.secondary-button:hover,
.tool-button:hover,
.swatch-button:hover,
.menu-icon-button:hover,
.saved-board-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.primary-button:active,
.secondary-button:active,
.tool-button:active,
.swatch-button:active,
.menu-icon-button:active,
.saved-board-card:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(0.97);
}

.primary-button {
  padding: 8px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  color: white;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 28px rgba(14, 92, 166, 0.28);
}

.secondary-button {
  padding: 7px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  border: 1px solid var(--line);
}

.home {
  padding: 0;
}

.home-shell {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.home-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(20px, 3vw, 40px);
  background: rgba(9, 26, 48, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  max-height: 15vh;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: inherit;
  text-decoration: none;
}

.home-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.home-brand h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
}

.home-banner-button {
  min-width: 190px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 8px 24px rgba(217, 119, 6, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #1a1000;
}

.home-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.home-banner-select-wrap {
  min-width: min(290px, 100%);
  color: inherit;
  display: flex;
  align-items: center;
}

.home-banner-select {
  min-height: 48px;
  min-width: 0;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  outline: none;
}

.home-banner-select option {
  color: var(--ink);
}

.home-scroll-frame {
  padding: 24px clamp(18px, 4vw, 48px);
  min-height: 0;
  overflow: hidden;
}

.home-content-card {
  width: min(1080px, 100%);
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  padding: clamp(28px, 4vw, 48px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 30% -10%, rgba(59, 130, 246, 0.08), transparent 40%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.06), transparent 30%),
    linear-gradient(180deg, rgba(12, 36, 64, 0.94) 0%, rgba(9, 26, 48, 0.97) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #e8f0ff;
  border: 1px solid rgba(147, 197, 253, 0.1);
  box-shadow: var(--shadow-lg);
}

.home-content-card::-webkit-scrollbar {
  width: 10px;
}

.home-content-card::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(232, 245, 255, 0.28);
}

.home-section + .home-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(214, 237, 255, 0.16);
}

.home-intro {
  display: grid;
  gap: 20px;
}

.home-section-heading {
  max-width: 66ch;
}

.home-section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.home-section-heading p,
.tool-usage-list div,
.feature-card p {
  margin: 0;
  color: rgba(237, 247, 255, 0.88);
  line-height: 1.55;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
  align-items: stretch;
}

.feature-card {
  display: grid;
  align-content: start;
  padding: 22px;
  border-radius: var(--radius-md);
  background: rgba(239, 248, 255, 0.07);
  border: 1px solid rgba(232, 245, 255, 0.1);
  min-height: 100%;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  background: rgba(239, 248, 255, 0.13);
  border-color: rgba(232, 245, 255, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.feature-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.feature-card-head img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}

.feature-card h3 {
  margin: 0;
  color: white;
}

.tool-usage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.tool-usage-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(239, 248, 255, 0.05);
  border: 1px solid rgba(232, 245, 255, 0.08);
  min-height: 100%;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.tool-usage-item:hover {
  transform: translateY(-2px);
  background: rgba(239, 248, 255, 0.1);
  border-color: rgba(232, 245, 255, 0.16);
}

.tool-usage-item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.tool-hero-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  align-items: stretch;
}

.tool-hero-chip {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding: 16px 10px;
  border-radius: var(--radius-md);
  background: rgba(239, 248, 255, 0.06);
  border: 1px solid rgba(232, 245, 255, 0.08);
  text-align: center;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.tool-hero-chip:hover {
  transform: translateY(-2px);
  background: rgba(239, 248, 255, 0.12);
  border-color: rgba(232, 245, 255, 0.18);
}

.tool-hero-chip img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.tool-hero-chip span {
  font-size: 0.9rem;
  color: rgba(237, 247, 255, 0.88);
}

.saved-board-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.saved-board-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(239, 248, 255, 0.16);
  color: white;
  text-align: left;
  border: 1px solid rgba(232, 245, 255, 0.14);
}

.saved-board-card span {
  color: rgba(237, 247, 255, 0.76);
}

.home-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 24px 14px;
  color: rgba(16, 34, 53, 0.8);
  text-align: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  max-height: 15vh;
}

.home-footer-main {
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: 0;
}

.home-footer-link {
  display: inline-flex;
  align-items: center;
}

.home-footer-link img {
  height: 84px;
  width: auto;
}

.home-footer-disclaimer {
  margin: 2px 0 0;
  max-width: 480px;
  font-size: 0.76rem;
  line-height: 1.35;
  color: rgba(16, 34, 53, 0.72);
}

.home-support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(16, 34, 53, 0.12);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 46, 83, 0.12);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
  white-space: nowrap;
}

.home-support-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 46, 83, 0.16);
}

.home-support-link-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--brand-deep);
  box-shadow: 0 10px 24px rgba(9, 62, 117, 0.16);
}

.home-support-link-header:hover {
  box-shadow: 0 12px 28px rgba(9, 62, 117, 0.2);
}

.hero {
  width: min(760px, calc(100% - 32px));
  margin: auto;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 28px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(235, 246, 255, 0.9)),
    var(--paper);
  border: 1px solid rgba(23, 127, 222, 0.18);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.hero p {
  margin: 0 0 24px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.designer {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.03), transparent 60%),
    linear-gradient(180deg, rgba(12, 36, 64, 0.96), rgba(9, 26, 48, 0.98));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: white;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
}

.toolbar-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.toolbar-brand-copy span {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.74;
}

.toolbar-brand-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 1.2rem;
}

.toolbar-section {
  display: grid;
  grid-template-columns: repeat(2, 46px);
  gap: 10px;
  width: 100%;
  justify-content: center;
  justify-items: center;
}

.toolbar-button-grid {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  gap: 10px;
  grid-column: 1 / -1;
  width: max-content;
  margin: 0 auto;
  justify-content: center;
}

.toolbar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.72;
  width: 100%;
  text-align: center;
  grid-column: 1 / -1;
}

.toolbar-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  width: 100%;
}

.toolbar-section--nav .toolbar-field {
  width: 100%;
  justify-self: stretch;
}

.toolbar-input-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.72;
}

.toolbar-select,
.toolbar-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 51, 91, 0.34);
  color: white;
  outline: none;
}

.toolbar-select option {
  color: var(--ink);
}

.toolbar-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.tool-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tool-button.is-active {
  background: rgba(255, 250, 238, 0.94);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

.tool-button.is-disabled,
.tool-button:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none;
}

.tool-button img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.tool-button-text {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.toolbar-section--nav {
  grid-template-columns: repeat(3, 46px);
  justify-content: center;
  justify-items: stretch;
}

.toolbar-section--pieces {
  grid-template-columns: repeat(3, 46px);
}

.toolbar-section--actions {
  grid-template-columns: repeat(3, 46px);
}

.toolbar-section--colors {
  grid-template-columns: repeat(4, 32px);
  justify-content: center;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 32px);
  gap: 8px;
  width: fit-content;
  grid-column: 1 / -1;
  justify-self: center;
  margin: 0 auto;
}

.swatch-button {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid transparent;
}

.swatch-button.is-active {
  border-color: rgba(255, 250, 238, 0.95);
  box-shadow: 0 0 0 2px rgba(29, 39, 48, 0.4);
}

.toolbar-bottom {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.toolbar-action-button {
  width: 100%;
  min-height: 40px;
}

.toolbar-action-button--primary {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 52%, #2563eb 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.toolbar-action-button--duplicate {
  background: linear-gradient(180deg, #93c5fd 0%, #60a5fa 52%, #3b82f6 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 10px 24px rgba(37, 99, 235, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.toolbar-action-button--delete {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(180, 44, 44, 0.28);
  color: #7b1f1f;
  font-weight: 700;
}

.toolbar-search {
  display: grid;
  gap: 6px;
}

.toolbar-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.toolbar-search-input {
  min-width: 0;
  font-size: 0.9rem;
}

.toolbar-search-input::placeholder {
  font-size: 0.78rem;
}

.toolbar-search-button {
  white-space: nowrap;
}

.save-pill {
  min-width: 72px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink);
}

.toolbar-save-frame {
  padding: 12px;
  border-radius: 18px;
  background: rgba(6, 45, 86, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.toolbar-save {
  width: 100%;
}

.designer-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.designer-titlebar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 24px 8px;
  background: #1a4f79;
}

.designer-title-input {
  width: min(520px, 100%);
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid rgba(16, 34, 53, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 46, 83, 0.08);
  outline: none;
}

.designer-title-input::placeholder {
  color: rgba(16, 34, 53, 0.46);
}

.board-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(26, 79, 121, 0.28), rgba(26, 79, 121, 0.55));
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.board-svg {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--sea);
  cursor: default;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-drag: none;
}

.download-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(9, 26, 48, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition:
    transform var(--transition),
    background-color var(--transition),
    border-color var(--transition);
}

.download-button:hover {
  transform: translateY(-1px);
  background: rgba(9, 26, 48, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

.download-button:active {
  transform: translateY(0) scale(0.95);
}

.download-button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.download-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.board-svg.is-drawing {
  cursor: crosshair;
}

.board-svg,
.board-svg * {
  -webkit-user-drag: none;
}

.move-glow-outline {
  animation: moveGlowPulse 1.2s ease-in-out infinite;
  filter:
    drop-shadow(0 0 8px rgba(255, 224, 118, 0.9))
    drop-shadow(0 0 18px rgba(255, 224, 118, 0.55));
}

.move-glow-base {
  stroke: rgba(255, 214, 92, 0.96);
}

.move-glow-highlight {
  stroke: rgba(255, 255, 255, 0.98);
}

@keyframes moveGlowPulse {
  0%,
  100% {
    opacity: 0.62;
    filter:
      drop-shadow(0 0 6px rgba(255, 224, 118, 0.72))
      drop-shadow(0 0 14px rgba(255, 224, 118, 0.42));
  }

  50% {
    opacity: 1;
    filter:
      drop-shadow(0 0 10px rgba(255, 224, 118, 0.98))
      drop-shadow(0 0 22px rgba(255, 224, 118, 0.68));
  }
}

.context-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
  min-width: 220px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 250, 238, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.context-menu.context-menu--compact {
  grid-template-columns: repeat(auto-fit, 38px);
  min-width: 0;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
}

.context-menu[hidden] {
  display: none;
}

.view-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
  white-space: nowrap;
}

.view-option-row:hover {
  background: rgba(16, 34, 53, 0.08);
}

.view-option-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid rgba(16, 34, 53, 0.3);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  color: var(--brand-deep);
  flex-shrink: 0;
}

.view-option-label {
  flex: 1;
  font-weight: 500;
}

.menu-icon-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 14px;
  background: white;
  border: 1px solid rgba(29, 39, 48, 0.1);
}

.menu-icon-button img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.context-menu.context-menu--compact .menu-icon-button {
  width: 38px;
  height: 38px;
  padding: 4px;
  border-radius: 10px;
}

.menu-icon-button img.menu-icon-button-image--award {
  width: 30px;
  height: 30px;
}

.designer-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 250, 238, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-width: 320px;
  font-size: 0.92rem;
}

.designer-toast[hidden] {
  display: none;
}

.player-panel-stack {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.player-panel {
  display: grid;
}

.player-panel.is-drag-source {
  opacity: 0.78;
}

.player-panel.is-drag-target .player-panel-card {
  box-shadow:
    0 0 0 2px rgba(255, 224, 118, 0.72),
    0 0 20px rgba(255, 224, 118, 0.34);
}

.player-panel-name {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: center;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 700;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-shadow:
    -1px 0 0 #000,
    1px 0 0 #000,
    0 -1px 0 #000,
    0 1px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000 !important;
  margin-bottom: 0;
  pointer-events: none;
}

.player-panel-card {
  display: grid;
  grid-template-columns: 56px 50px 50px 40px 40px;
  grid-template-rows: 12px auto;
  align-items: start;
  gap: 3px;
  padding: 5px 8px 4px;
  border-radius: 10px;
  background: rgba(228, 222, 209, 0.92);
  border: 1px solid rgba(16, 34, 53, 0.14);
  box-shadow: 0 10px 24px rgba(15, 46, 83, 0.18);
}

.player-panel-player {
  position: relative;
  display: grid;
  place-items: center;
  grid-column: 1;
  grid-row: 2;
  width: 56px;
  height: 50px;
  padding: 0;
  background: none;
  border: 0;
}

.player-panel-bg {
  width: 56px;
  height: 50px;
  object-fit: contain;
}

.player-panel-avatar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -55%);
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.player-panel-ribbon {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 34px;
  height: 15px;
  transform: translateX(-50%);
}

.player-panel-ribbon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-panel-ribbon span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #111;
  text-shadow: none;
}

.player-counter-card,
.player-stat-card {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: start;
  grid-row: 2;
  min-height: 50px;
}

.player-counter-card {
  width: 50px;
}

.player-stat-card {
  width: 40px;
}

.player-counter-card img,
.player-stat-card img {
  object-fit: contain;
}

.player-counter-card > img {
  width: 42px;
  height: 50px;
}

.player-stat-card > img {
  width: 30px;
  height: 30px;
}

.player-counter-badge {
  position: absolute;
  top: 0;
  right: 8px;
  width: 17px;
  height: 17px;
}

.player-counter-badge img {
  width: 100%;
  height: 100%;
}

.player-counter-badge span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.64rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 1px rgba(16, 34, 53, 0.55);
}

.player-stat-card span {
  margin-top: 1px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.player-counter-control {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(10, 30, 46, 0.46);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 140ms ease, background-color 140ms ease;
}

.player-counter-control--inc {
  top: 0;
}

.player-counter-control--dec {
  bottom: 0;
}

.player-counter-card:hover .player-counter-control,
.player-stat-card:hover .player-counter-control {
  opacity: 1;
}

.player-counter-control:hover {
  background: rgba(10, 30, 46, 0.62);
}

.shortcut-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 25, 43, 0.48);
}

.shortcut-dialog[hidden] {
  display: none;
}

.shortcut-dialog-card {
  width: min(440px, 100%);
  padding: 22px;
  border-radius: 24px;
  background: rgba(248, 252, 255, 0.97);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.shortcut-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.shortcut-dialog-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.shortcut-close {
  border: 0;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}

.shortcut-dialog-card--confirm {
  width: min(420px, 100%);
}

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

.confirm-dialog-copy {
  margin: 0 0 20px;
  line-height: 1.55;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-dialog-button {
  min-width: 120px;
}

.confirm-dialog-button--danger {
  background: rgba(255, 237, 237, 0.98);
  border-color: rgba(180, 44, 44, 0.28);
  color: #7b1f1f;
  font-weight: 700;
}

.shortcut-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

kbd {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(16, 34, 53, 0.08);
  border: 1px solid rgba(16, 34, 53, 0.14);
  font-family: inherit;
  font-weight: 700;
}

/* ── Hero Board Demo ─────────────────────────────────────────── */

.home-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}

.home-hero-copy {
  display: grid;
  gap: 18px;
}

.home-hero-copy h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: white;
}

.home-hero-copy p {
  margin: 0;
  color: rgba(237, 247, 255, 0.85);
  line-height: 1.6;
  font-size: clamp(0.92rem, 1.2vw, 1.05rem);
}

.home-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1a1000;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.35);
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    filter var(--transition);
  width: fit-content;
}

.home-hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(217, 119, 6, 0.5);
  filter: brightness(1.08);
}

.home-hero-cta:active {
  transform: translateY(0) scale(0.97);
}

.home-hero-cta-arrow {
  display: inline-block;
  transition: transform var(--transition);
}

.home-hero-cta:hover .home-hero-cta-arrow {
  transform: translateX(3px);
}

.board-demo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0c2440;
  border: 1px solid rgba(147, 197, 253, 0.1);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 60px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition), box-shadow var(--transition);
}

.board-demo-wrap--example {
  aspect-ratio: auto;
  cursor: pointer;
}

.board-demo-wrap--example:hover {
  transform: translateY(-3px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.3),
    inset 0 0 60px rgba(0, 0, 0, 0.2);
}

.board-demo-thumb {
  display: block;
  width: 100%;
  height: auto;
}

.board-demo-wrap--example {
  margin: 18px 0;
}

.board-demo-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.board-demo-wrap:hover .board-demo-zoom-hint {
  opacity: 1;
}

/* ── Lightbox ───────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 12, 24, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: zoom-out;
  animation: lightboxFadeIn 0.2s ease-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-img {
  display: block;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.board-demo-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hex tiles animate in with staggered delays */
.demo-hex {
  opacity: 0;
  transform-origin: center;
  animation: hexAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.demo-hex:nth-child(1) { animation-delay: 0.3s; }
.demo-hex:nth-child(2) { animation-delay: 0.5s; }
.demo-hex:nth-child(3) { animation-delay: 0.7s; }
.demo-hex:nth-child(4) { animation-delay: 0.9s; }
.demo-hex:nth-child(5) { animation-delay: 1.1s; }
.demo-hex:nth-child(6) { animation-delay: 1.3s; }
.demo-hex:nth-child(7) { animation-delay: 1.5s; }

/* Settlement pops in when cursor "clicks" at 26% of 6s + 1.6s delay = 3.16s */
.demo-settlement {
  opacity: 0;
  animation: settlementPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 3.1s forwards;
}

/* Road draws while cursor drags: starts at 30% of 6s + 1.6s = 3.4s */
.demo-road {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: roadDraw 0.7s ease-out 3.4s forwards;
}

/* Annotation draws during cursor swoop: starts at 60% of 6s + 1.6s = 5.2s */
.demo-annotation {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: annotationDraw 1.0s ease-out 5.2s forwards;
}

/* Number token fades in on hex */
.demo-number {
  opacity: 0;
  animation: numberFade 0.4s ease-out forwards;
}

.demo-number:nth-child(1) { animation-delay: 0.8s; }
.demo-number:nth-child(2) { animation-delay: 1.0s; }
.demo-number:nth-child(3) { animation-delay: 1.2s; }
.demo-number:nth-child(4) { animation-delay: 1.4s; }
.demo-number:nth-child(5) { animation-delay: 1.6s; }
.demo-number:nth-child(6) { animation-delay: 1.8s; }
.demo-number:nth-child(7) { animation-delay: 2.0s; }

@keyframes hexAppear {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-15deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes settlementPop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  60% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes roadDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes annotationDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes numberFade {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Animated cursor ────────────────────────────────────────── */

.demo-cursor {
  opacity: 0;
  animation: cursorMove 6s ease-in-out 1.6s forwards;
  pointer-events: none;
}

@keyframes cursorMove {
  0%   { transform: translate(370px, 160px); opacity: 0; }
  6%   { transform: translate(290px, 140px); opacity: 1; }
  /* Glide to settlement vertex */
  22%  { transform: translate(192px, 96px); opacity: 1; }
  26%  { transform: translate(192px, 96px) scale(0.82); }
  30%  { transform: translate(192px, 96px) scale(1); }
  /* Drag toward road end */
  44%  { transform: translate(225px, 115px); }
  48%  { transform: translate(225px, 115px) scale(0.82); }
  52%  { transform: translate(225px, 115px) scale(1); }
  /* Swoop for annotation */
  60%  { transform: translate(140px, 162px); }
  78%  { transform: translate(260px, 132px); }
  /* Exit right */
  92%  { transform: translate(380px, 100px); opacity: 1; }
  97%  { transform: translate(400px, 80px); opacity: 0; }
  100% { transform: translate(400px, 80px); opacity: 0; }
}

/* ── Section reveal animation ───────────────────────────────── */

.home-section {
  opacity: 0;
  transform: translateY(20px);
  animation: sectionReveal 0.6s ease-out forwards;
}

.home-section:nth-child(1) { animation-delay: 0.1s; }
.home-section:nth-child(2) { animation-delay: 0.3s; }
.home-section:nth-child(3) { animation-delay: 0.5s; }

@keyframes sectionReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Stats / social proof strip ─────────────────────────────── */

.home-stats-strip {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 4vw, 48px);
  padding: 20px 0;
  flex-wrap: wrap;
}

.home-stat {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.home-stat-value {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
}

.home-stat-label {
  font-size: 0.82rem;
  color: rgba(237, 247, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Quick-start steps ──────────────────────────────────────── */

.home-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.home-step {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  background: rgba(239, 248, 255, 0.06);
  border: 1px solid rgba(232, 245, 255, 0.08);
  text-align: center;
  transition: transform var(--transition), background-color var(--transition);
}

.home-step:hover {
  transform: translateY(-2px);
  background: rgba(239, 248, 255, 0.1);
}

.home-step-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: white;
  font-weight: 800;
  font-size: 1rem;
}

.home-step h4 {
  margin: 0;
  color: white;
  font-size: 1rem;
}

.home-step p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(237, 247, 255, 0.78);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .tool-hero-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-usage-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .board-demo-wrap {
    max-width: 480px;
    margin: 0 auto;
  }

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

  .home-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .home-banner {
    flex-direction: column;
    align-items: stretch;
    max-height: none;
  }

  .home-banner-actions {
    justify-content: stretch;
  }

  .home-banner-button {
    width: 100%;
  }

  .home-banner-select-wrap,
  .home-support-link-header {
    min-width: 0;
    width: 100%;
  }

  .tool-usage-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .designer {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .toolbar {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .toolbar-section--pieces {
    grid-template-columns: repeat(3, 46px);
  }

  .toolbar-section--actions {
    grid-template-columns: repeat(3, 46px);
  }

  .toolbar-section--colors {
    grid-template-columns: repeat(4, 32px);
  }
}

@media (max-width: 640px) {
  .home-scroll-frame {
    padding: 16px;
  }

  .home-content-card {
    padding: 20px;
  }

  .home-footer {
    max-height: none;
    padding-bottom: 18px;
  }

  .tool-hero-strip {
    grid-template-columns: 1fr 1fr;
  }

  .tool-hero-strip > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(240px, 100%);
  }

  .toolbar-search-row {
    grid-template-columns: 1fr;
  }

  .designer-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }

  .designer-titlebar {
    padding: 12px 16px 6px;
  }

  .designer-title-input {
    font-size: 1.05rem;
  }
}
