:root {
  --text: #f7f9ff;
  --sub: #c8d0f2;
  --panel: rgba(255, 255, 255, 0.12);
  --panel-border: rgba(255, 255, 255, 0.18);
  --control-bg: rgba(14, 20, 42, 0.9);
  --control-text: #f7f9ff;
  --control-border: rgba(255, 255, 255, 0.3);
  --accent: #7d66ff;
  --accent-2: #2bd9fe;
  --good: #2dd69f;
  --danger: #ff6b7a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --bg: radial-gradient(circle at 20% 12%, #343f8b 0%, #171c3a 45%, #0c1020 100%);
  --texture-a: rgba(255, 255, 255, 0.08);
  --texture-b: rgba(255, 255, 255, 0.03);
  --nature-1: rgba(126, 247, 255, 0.1);
  --nature-2: rgba(255, 192, 203, 0.08);
  --texture-layer-1: radial-gradient(circle at 14% 18%, var(--nature-1), transparent 34%);
  --texture-layer-2: radial-gradient(circle at 82% 14%, var(--nature-2), transparent 30%);
  --texture-layer-3: repeating-radial-gradient(circle at 50% 50%, var(--texture-b) 0 1px, transparent 1px 5px);
  --texture-overlay: linear-gradient(120deg, transparent 0%, var(--texture-a) 40%, transparent 80%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background: var(--texture-layer-1), var(--texture-layer-2), var(--texture-layer-3);
  opacity: 0.9;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: var(--texture-overlay);
  mix-blend-mode: soft-light;
  opacity: 0.5;
}

body.theme-01 { --accent: #7d66ff; --accent-2: #2bd9fe; --bg: radial-gradient(circle at 20% 12%, #343f8b 0%, #171c3a 45%, #0c1020 100%); --nature-1: rgba(106, 205, 255, 0.2); --nature-2: rgba(205, 190, 255, 0.16); }
body.theme-02 { --accent: #ff8a65; --accent-2: #ffd166; --bg: radial-gradient(circle at 15% 5%, #6c273a 0%, #2a1d2f 45%, #12131c 100%); --nature-1: rgba(255, 186, 131, 0.2); --nature-2: rgba(255, 245, 178, 0.12); }
body.theme-03 { --accent: #00c9a7; --accent-2: #6ecbff; --bg: radial-gradient(circle at 20% 10%, #1b544d 0%, #17343a 48%, #0f1d21 100%); --nature-1: rgba(151, 245, 221, 0.2); --nature-2: rgba(187, 233, 255, 0.16); }
body.theme-04 { --accent: #ff5fa2; --accent-2: #8f7dff; --bg: radial-gradient(circle at 20% 8%, #4f1f5f 0%, #271b3e 50%, #121124 100%); --nature-1: rgba(255, 170, 223, 0.2); --nature-2: rgba(195, 183, 255, 0.14); }
body.theme-05 { --accent: #22c55e; --accent-2: #bef264; --bg: radial-gradient(circle at 20% 8%, #214c2f 0%, #1b2f25 48%, #101916 100%); --nature-1: rgba(174, 255, 201, 0.18); --nature-2: rgba(224, 255, 173, 0.12); }
body.theme-06 { --accent: #f97316; --accent-2: #fb7185; --bg: radial-gradient(circle at 15% 10%, #5f2f1b 0%, #301f20 45%, #151216 100%); --nature-1: rgba(255, 178, 138, 0.2); --nature-2: rgba(255, 186, 210, 0.14); }
body.theme-07 { --accent: #38bdf8; --accent-2: #818cf8; --bg: radial-gradient(circle at 20% 5%, #17406a 0%, #1b2950 48%, #101526 100%); --nature-1: rgba(157, 231, 255, 0.18); --nature-2: rgba(191, 199, 255, 0.16); }
body.theme-08 { --accent: #f43f5e; --accent-2: #f59e0b; --bg: radial-gradient(circle at 18% 5%, #5b1f33 0%, #331e2f 50%, #17131d 100%); --nature-1: rgba(255, 169, 191, 0.18); --nature-2: rgba(255, 219, 145, 0.14); }
body.theme-09 { --accent: #06b6d4; --accent-2: #34d399; --bg: radial-gradient(circle at 18% 8%, #14545d 0%, #19363d 48%, #0f1c20 100%); --nature-1: rgba(143, 239, 255, 0.2); --nature-2: rgba(166, 255, 218, 0.13); }
body.theme-10 { --accent: #a855f7; --accent-2: #06b6d4; --bg: radial-gradient(circle at 15% 10%, #402160 0%, #261f46 48%, #121424 100%); --nature-1: rgba(217, 156, 255, 0.16); --nature-2: rgba(143, 238, 255, 0.14); }
body.theme-11 { --accent: #ff4d6d; --accent-2: #ff8fa3; --bg: radial-gradient(circle at 16% 8%, #5a1627 0%, #2c1220 48%, #140d16 100%); --nature-1: rgba(255, 135, 156, 0.2); --nature-2: rgba(255, 190, 202, 0.14); --texture-a: rgba(255, 88, 126, 0.12); --texture-b: rgba(180, 72, 99, 0.1); }
body.theme-12 { --accent: #ff3b30; --accent-2: #ffa94d; --bg: radial-gradient(circle at 18% 10%, #4d0f0f 0%, #2a1410 48%, #140f0c 100%); --nature-1: rgba(255, 126, 110, 0.2); --nature-2: rgba(255, 180, 120, 0.14); --texture-a: rgba(238, 96, 74, 0.12); --texture-b: rgba(175, 89, 67, 0.1); }

body.texture-01 { --texture-layer-3: repeating-radial-gradient(circle at 50% 50%, var(--texture-b) 0 1px, transparent 1px 5px); --texture-overlay: linear-gradient(120deg, transparent 0%, var(--texture-a) 40%, transparent 80%); }
body.texture-02 { --texture-layer-3: repeating-linear-gradient(130deg, var(--texture-b) 0 2px, transparent 2px 9px); --texture-overlay: linear-gradient(160deg, transparent 0%, var(--texture-a) 30%, transparent 72%); }
body.texture-03 { --texture-layer-3: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 6px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 6px); --texture-overlay: radial-gradient(circle at 20% 20%, var(--texture-a), transparent 58%); }
body.texture-04 { --texture-layer-3: radial-gradient(circle at 12% 82%, var(--texture-b) 0 2px, transparent 2px), radial-gradient(circle at 74% 76%, var(--texture-b) 0 2px, transparent 2px); --texture-overlay: linear-gradient(90deg, transparent 0%, var(--texture-a) 50%, transparent 100%); }

.app { max-width: 1040px; margin: 0 auto; padding: clamp(12px, 3.5vw, 22px); }
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.title { font-size: 32px; font-weight: 800; letter-spacing: 0.6px; }
.subtitle { margin-top: 4px; color: var(--sub); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fold-menu { display: flex; align-items: center; gap: 8px; position: relative; }
.fold-menu::after { content: ""; position: absolute; left: 0; top: 100%; width: 420px; height: 12px; }
.fold-trigger {
  border-radius: 12px; border: 1px solid var(--control-border); background: rgba(255, 255, 255, 0.08);
  color: var(--control-text); padding: 10px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.fold-panel {
  position: absolute; left: 0; top: 100%; display: flex; gap: 8px; opacity: 0; visibility: hidden;
  transform: translateY(-4px); transition: opacity 0.18s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none; z-index: 8; padding: 6px; border-radius: 12px; background: rgba(8, 12, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(6px);
}
.fold-menu.expanded .fold-panel { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; transition-delay: 0s; }
button, select, input { font: inherit; }
.btn, .toolbar-select, .input, .select { border-radius: 12px; border: 1px solid var(--control-border); background: var(--control-bg); color: var(--control-text); padding: 10px 12px; }
.toolbar-select { min-width: 160px; }
.toolbar-select.pending { visibility: hidden; }
.toolbar.ready .toolbar-select.pending { visibility: visible; }
.btn { cursor: pointer; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; box-shadow: var(--shadow); transition: transform 0.16s ease; }
.btn:hover { transform: translateY(-1px); }
#openConfig { background: rgba(255, 255, 255, 0.22); border: 1px solid rgba(255, 255, 255, 0.32); color: #ffffff; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
#openConfig:hover { background: rgba(255, 255, 255, 0.3); }
.hint-buttons { display: flex; gap: 8px; align-items: center; }
.hint-btn { border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.14); color: #fff; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 16px; transition: transform 0.16s ease, background 0.16s ease; }
.hint-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.22); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(140deg, rgba(255, 255, 255, 0.1), transparent 42%), repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 7px); opacity: 0.6; }
.label { font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.value { font-size: 26px; font-weight: 800; line-height: 1.2; word-break: break-word; }
.value.money { color: #ffd977; text-shadow: 0 0 12px rgba(255, 217, 119, 0.35); }
.value.small { font-size: 20px; font-weight: 700; }
.status-pill { display: inline-block; margin-top: 10px; padding: 7px 12px; border-radius: 999px; font-size: 13px; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.26); }
.fx-wrap { position: relative; min-height: 200px; border-radius: 18px; overflow: hidden; border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.07); }
.fx-layer { position: absolute; inset: 0; pointer-events: none; }
.floating-coin { position: absolute; animation: floatUp 1.1s ease forwards; opacity: 0; }
.rain-coin { position: fixed; top: -28px; z-index: 40; pointer-events: none; user-select: none; animation-name: coinRainFall; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes floatUp { 0% { transform: translateY(0) scale(0.8); opacity: 0; } 18% { opacity: 1; } 100% { transform: translateY(-70px) scale(1.2); opacity: 0; } }
@keyframes coinRainFall { 0% { transform: translate3d(0, -5vh, 0) rotate(0deg); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate3d(var(--drift, 0px), 110vh, 0) rotate(480deg); opacity: 0; } }
.bar-track { width: 92%; margin: 84px auto 0; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s linear; }
.ring { width: 126px; height: 126px; margin: 36px auto 0; border-radius: 50%; border: 10px solid rgba(255, 255, 255, 0.2); position: relative; transform: rotate(-90deg); }
.ring::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 10px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent-2); transform: rotate(var(--ring-angle, 0deg)); transition: transform 0.3s linear; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; transform: rotate(90deg); font-size: 20px; font-weight: 800; }
.muted { color: var(--sub); font-size: 12px; margin-top: 8px; }
.fx-wrap .muted { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin-top: 0; z-index: 2; animation: breathing 2.4s ease-in-out infinite; }
@keyframes breathing { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.hidden { display: none !important; }
.config-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; z-index: 50; padding: 14px; overflow-y: auto; }
.config-panel { width: min(760px, 100%); max-height: min(88vh, 820px); overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 18px; padding: 18px; background: #121a35; border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: var(--shadow); }
.config-title { margin: 0 0 14px; font-size: 24px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--sub); }
.input:focus, .select:focus, .toolbar-select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.22); }
.tip { color: var(--sub); font-size: 12px; margin: 3px 0 6px; }
.footer-actions { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; padding-top: 10px; background: linear-gradient(to top, #121a35 68%, rgba(18, 26, 53, 0)); }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: min(390px, 90vw); background: rgba(16, 24, 44, 0.95); color: #fff; border: 1px solid rgba(255, 255, 255, 0.15); border-left: 4px solid var(--good); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); transition: 0.2s ease; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.site-footer { text-align: center; margin-top: 18px; padding: 12px 0 8px; color: var(--sub); font-size: 12px; }
.site-footer a { color: #9ee7ff; text-decoration: none; border-bottom: 1px dashed rgba(158, 231, 255, 0.45); padding-bottom: 1px; transition: color 0.2s ease, border-color 0.2s ease; }
.site-footer a:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.6); }
.info-modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; padding: 14px; }
.info-panel { width: min(560px, 100%); border-radius: 16px; background: #131a35; border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: var(--shadow); padding: 16px; }
.info-title { margin: 0 0 10px; font-size: 22px; }
.info-body { margin: 0; color: var(--sub); line-height: 1.7; white-space: pre-line; }
.info-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

@media (max-width: 700px) {
  .app { padding: 12px; }
  .header { align-items: stretch; }
  .toolbar { width: 100%; justify-content: space-between; }
  .config-modal { place-items: start center; padding: 8px; }
  .config-panel { max-height: calc(100vh - 16px); padding: 14px; }
  .row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .hint-buttons { gap: 6px; }
  .hint-btn { width: 34px; height: 34px; font-size: 15px; }
  .value { font-size: 22px; }
  .value.small { font-size: 18px; }
  .toolbar-select { min-width: 138px; width: 100%; }
  .fold-menu { position: relative; }
  .fold-menu::after { display: none; }
  .fold-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px); width: min(92vw, 320px);
    display: grid; grid-template-columns: 1fr; opacity: 0; visibility: hidden; transform: translateY(-4px); pointer-events: none;
  }
  .fold-menu.expanded .fold-panel { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
}
