* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #1b2438 0%, #222e47 45%, #192235 100%);
  color: #eef5ff;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  padding: 18px 20px 44px;
}

.page-wrap {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.top-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(20, 27, 43, 0.84);
  border: 1px solid rgba(190, 222, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(8, 13, 26, 0.35);
}

.title-block h1 {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.4px;
}

.title-block p {
  margin-top: 4px;
  font-size: 13px;
  color: #b7d2f2;
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: #eef7ff;
  background: rgba(58, 118, 186, 0.35);
  border: 1px solid rgba(140, 206, 255, 0.42);
  transition: background 0.15s, transform 0.12s;
}

.nav-link-btn:hover {
  background: rgba(74, 142, 218, 0.55);
  transform: translateY(-1px);
}

/* Interactive Control Bar */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 10px 16px;
  background: rgba(20, 27, 43, 0.78);
  border: 1px solid rgba(190, 222, 255, 0.18);
  border-radius: 10px;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ctrl-label {
  font-size: 12px;
  color: #9ec3eb;
  font-weight: 600;
  margin-right: 2px;
}

.seg-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(190, 222, 255, 0.22);
  background: rgba(38, 50, 76, 0.65);
  color: #e4f1ff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.seg-btn:hover {
  background: rgba(56, 76, 116, 0.85);
  border-color: rgba(154, 216, 255, 0.55);
}

.seg-btn.active {
  background: linear-gradient(135deg, #3c8be0, #5b6ee1);
  border-color: #bce8ff;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(72, 134, 224, 0.4);
}

/* 2x2 Style Cards Grid */
.styles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.style-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(22, 30, 48, 0.88);
  border: 2px solid rgba(190, 222, 255, 0.2);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 10px 26px rgba(8, 13, 26, 0.36);
}

.style-card[data-style-id="pt_exact"] {
  grid-column: 1 / -1;
}

.style-card[data-style-id="pt_exact"] .stage-wrap {
  height: 236px;
}

.style-card:hover {
  border-color: rgba(146, 212, 255, 0.55);
  transform: translateY(-2px);
}

.style-card.selected {
  border-color: #ffd866;
  box-shadow: 0 0 0 2px rgba(255, 216, 102, 0.25), 0 12px 32px rgba(10, 18, 36, 0.5);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  background: rgba(15, 21, 35, 0.72);
  border-bottom: 1px solid rgba(190, 222, 255, 0.14);
}

.card-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.style-letter {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #d76cf2, #ff6fa8);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-title-wrap h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.res-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(130, 194, 255, 0.16);
  border: 1px solid rgba(150, 210, 255, 0.28);
  color: #bfe4ff;
  white-space: nowrap;
}

.stage-wrap {
  position: relative;
  width: 100%;
  height: 214px;
  background: #dcecf8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.stage-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.char-labels {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
  padding: 0 26px;
}

.char-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(20, 26, 40, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #f6fbff;
}

.char-pill.twi { color: #e8c7ff; }
.char-pill.pinkie { color: #ffc7e0; }

.card-footer {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.style-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: #cfe0f5;
}

.card-bottom-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.style-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #d6e7fa;
}

.pick-btn {
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid rgba(255, 218, 120, 0.5);
  background: rgba(255, 206, 94, 0.16);
  color: #ffe89e;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.pick-btn:hover {
  background: rgba(255, 206, 94, 0.3);
  color: #ffffff;
}

.style-card.selected .pick-btn {
  background: linear-gradient(135deg, #ffd45c, #ff9955);
  border-color: #fff5c4;
  color: #1c1426;
  text-shadow: none;
}

/* Interactive Mini Sandbox Playground */
.sandbox-section {
  background: rgba(22, 30, 48, 0.9);
  border: 1px solid rgba(190, 222, 255, 0.22);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(8, 13, 26, 0.42);
}

.sandbox-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  background: rgba(15, 21, 35, 0.78);
  border-bottom: 1px solid rgba(190, 222, 255, 0.15);
}

.sandbox-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sandbox-title h3 {
  font-size: 15px;
  color: #ffffff;
}

.active-style-pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255, 212, 96, 0.2);
  border: 1px solid rgba(255, 218, 118, 0.55);
  color: #ffe99e;
  font-weight: 700;
}

.sandbox-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sandbox-stage-wrap {
  position: relative;
  width: 100%;
  height: 270px;
  background: #d8eaf7;
}

#sandbox-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.sandbox-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(20, 26, 40, 0.72);
  border: 1px solid rgba(210, 232, 255, 0.22);
  font-size: 11.5px;
  color: #edf6ff;
  pointer-events: none;
}

@media (max-width: 860px) {
  .styles-grid {
    grid-template-columns: 1fr;
  }
}
