:root {
  --bg-top: #fff3f5;
  --bg-mid: #ffe1ec;
  --bg-bottom: #dff3ff;
  --ink: #2d3b4e;
  --muted: #6a7989;
  --panel: rgba(255, 255, 255, 0.85);
  --accent: #ff7a90;
  --accent-2: #7ac7ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-mid) 50%, var(--bg-bottom));
}

#waifu {
  z-index: 100 !important;
  pointer-events: none;
}

#waifu canvas,
#waifu .waifu-tips,
#waifu .waifu-tool {
  pointer-events: auto;
}

.page {
  width: min(1100px, 95vw);
  margin: 0 auto;
  padding: 20px 0 60px;
  position: relative;
  z-index: 10;
}

.card {
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  margin-bottom: 20px;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.nav-links {
  display: flex;
  gap: 15px;
}

.nav-links a {
  text-decoration: none;
  color: inherit;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-bottom: 20px;
}

.intro {
  padding: 40px;
}

.hero-art {
  background: linear-gradient(135deg, #fff, #ffeef2);
  display: grid;
  place-items: center;
}

.hero-emoji {
  font-size: 80px;
}

h1 {
  font-size: 56px;
  margin: 0;
  line-height: 1.1;
}

.accent-text {
  color: var(--accent);
}

.lead {
  font-size: 18px;
  color: var(--muted);
  margin-top: 15px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.section-card {
  padding: 25px;
}

.section-card h2 {
  margin-top: 0;
  font-size: 22px;
  color: var(--accent);
}

.section-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.game-section {
  padding: 30px;
}

.game-header {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-canvas-wrap {
  position: relative;
  height: 320px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid #eee;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#gameOverlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: 0.3s;
}

#gameOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-tag-container {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  z-index: 40;
}

.game-tag {
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.game-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 16px 40px;
  border-radius: 50px;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 10px 30px rgba(255, 122, 144, 0.4);
}

.game-btn:hover {
  transform: scale(1.1);
  background: #ff5a75;
}

.game-help {
  margin-top: 15px;
  color: var(--ink);
  font-weight: bold;
  text-shadow: 0 2px 4px #fff;
}

.game-refresh-btn {
  border: 1px solid rgba(255, 122, 144, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 233, 239, 0.95));
  color: var(--accent);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 122, 144, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.game-refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(255, 122, 144, 0.2);
}

.game-refresh-btn:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}


.footer {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 14px;
}

/* NEW: Skill Stack */
.section-container, .dashboard-container, .msg-board-container {
  padding: 30px;
  margin-bottom: 20px;
}

.section-title {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #eee, transparent);
}

.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-tag {
  background: linear-gradient(135deg, #fff, #f0f7ff);
  border: 1px solid #e1e8ef;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.3s;
  cursor: default;
}

.skill-tag:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 5px 15px rgba(255, 122, 144, 0.15);
}

/* NEW: Dashboard */
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.status-item {
  background: #fff;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid #f0f0f0;
  text-align: center;
}

.status-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.status-value {
  font-weight: 800;
  font-size: 18px;
  color: var(--accent-2);
}

/* NEW: Message Board */
.msg-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 10px;
}

.msg-item {
  background: rgba(255, 255, 255, 0.5);
  padding: 15px;
  border-radius: 16px;
  margin-bottom: 10px;
  border: 1px solid #fdfdfd;
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}

.msg-name {
  font-weight: bold;
  color: var(--accent);
}

.msg-date {
  color: #ccc;
}

.msg-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.msg-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-form input, .msg-form textarea {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  outline: none;
  transition: 0.2s;
}

.msg-form input:focus, .msg-form textarea:focus {
  border-color: var(--accent);
}

.msg-form textarea {
  height: 80px;
  resize: none;
}

@media (max-width: 850px) {
  .status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  .hero,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .game-canvas-wrap {
    height: 280px;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .game-refresh-btn {
    width: 100%;
    justify-content: center;
  }
}


.update-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 360px);
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 122, 144, 0.25);
  background: rgba(45, 59, 78, 0.92);
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.update-toast:not([hidden]) {
  display: flex;
}

.update-toast-btn {
  flex: none;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent), #ff5a75);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.update-toast-btn:hover {
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .update-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    justify-content: space-between;
  }
}
