:root {
  --blue-900: #0d3a9e;
  --blue-700: #1457d9;
  --blue-500: #2f7cf0;
  --blue-300: #8dbaf7;
  --blue-100: #e6f0fe;
  --text-muted: #7b8798;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--blue-900);
  background: linear-gradient(180deg, #2f86f0 0%, #6aaaf5 40%, #cfe3fc 75%, #eef5fe 100%) fixed;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 20px 24px;
}

/* ===== 搜索 ===== */
.search { width: min(760px, 100%); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 10px 0 18px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(20, 87, 217, .18);
}

.search-icon {
  display: flex;
  color: var(--text-muted);
  padding: 0;
}

#searchInput {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  color: var(--blue-900);
  padding: 0 6px;
}

#searchInput::placeholder { color: #9aa5b5; }

.engines {
  display: flex;
  align-items: center;
  gap: 4px;
}

.engine {
  position: relative;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue-700);
  transition: background .15s;
}

.engine:hover { background: var(--blue-100); }

.engine.active { background: var(--blue-100); box-shadow: inset 0 0 0 1px #d4e4fc; }

.engine.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 26px;
  height: 3px;
  margin-left: -13px;
  border-radius: 2px;
  background: var(--blue-700);
}

.engine-google { font-family: "Product Sans", Arial, sans-serif; font-size: 17px; }
.engine-google span:nth-child(1), .engine-google span:nth-child(4) { color: #4285f4; }
.engine-google span:nth-child(2), .engine-google span:nth-child(6) { color: #ea4335; }
.engine-google span:nth-child(3) { color: #fbbc05; }
.engine-google span:nth-child(5) { color: #34a853; }

/* ===== 面板 ===== */
.panel {
  width: min(900px, 100%);
  margin-top: 36px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(20, 87, 217, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid #dde8f8;
}

.tab {
  position: relative;
  padding: 20px 0 18px;
  font-size: 22px;
  font-weight: 600;
  color: #6b7686;
  transition: color .15s;
}

.tab:hover { color: var(--blue-700); }
.tab.active { color: var(--blue-900); }

.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 62px;
  height: 4px;
  margin-left: -31px;
  border-radius: 2px;
  background: var(--blue-700);
}

.pane { padding: 24px; }
.pane[hidden] { display: none; }

/* ===== 卡片 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px;
}

.card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 12px;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  color: var(--blue-900);
  text-decoration: none;
  background: linear-gradient(180deg, #fff 0%, #eef5fe 100%);
  border: 1px solid #e1ecfc;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(47, 124, 240, .12), inset 0 1px 0 #fff;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.card:hover {
  transform: translateY(-3px);
  background: linear-gradient(180deg, #f6faff 0%, #e2eefd 100%);
  box-shadow: 0 10px 22px rgba(47, 124, 240, .22), inset 0 1px 0 #fff;
}

.card:active { transform: translateY(-1px); }

/* ===== 格言 ===== */
.maxim-today {
  padding: 28px 20px;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, #eef5fe 100%);
  border: 1px solid #e1ecfc;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(47, 124, 240, .12);
}

.maxim-text {
  margin: 0;
  font-size: 24px;
  line-height: 1.6;
  font-weight: 700;
  color: var(--blue-900);
}

.maxim-source {
  margin: 10px 0 0;
  min-height: 1.2em;
  color: var(--text-muted);
}

.maxim-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.pill {
  padding: 8px 22px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--blue-700);
  background: #fff;
  box-shadow: inset 0 0 0 1px #cfe0fa;
  transition: background .15s, color .15s;
}

.pill:hover { background: var(--blue-700); color: #fff; }

.maxim-list { margin-top: 20px; }

.maxim-group + .maxim-group { margin-top: 18px; }

.maxim-group h3 {
  margin: 0 0 8px;
  padding-left: 10px;
  font-size: 16px;
  border-left: 4px solid var(--blue-500);
}

.maxim-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.6;
}

.maxim-item:hover { background: var(--blue-100); }
.maxim-item .src { margin-left: auto; flex-shrink: 0; color: var(--text-muted); font-size: 14px; }

.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
}

/* ===== 其他 ===== */
.footer {
  margin-top: auto;
  padding-top: 32px;
  font-size: 12px;
}

.footer a { color: #5f7da8; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(13, 58, 158, .92);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .page { padding-top: 28px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .tab { font-size: 18px; }
  .card { min-height: 72px; font-size: 16px; }
  .engine { padding: 6px 8px; font-size: 13px; }
  .engine-google { font-size: 15px; }
  .pane { padding: 16px; }
  .maxim-text { font-size: 20px; }
}

@media (max-width: 420px) {
  .search-box { padding-left: 12px; }
  .engine { padding: 6px 5px; }
  .tab { font-size: 16px; }
  .tab.active::after { width: 40px; margin-left: -20px; }
}
