* {
  box-sizing: border-box;
}


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


body {
  background: #f4f3f0;
  color: #35332f;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}


button,
input {
  font: inherit;
}


a {
  color: inherit;
  text-decoration: none;
}


.world-shell {
  width: 100%;
  max-width: 520px;

  min-height: 100vh;

  margin: 0 auto;

  padding:
    calc(28px + env(safe-area-inset-top))
    22px
    calc(45px + env(safe-area-inset-bottom));
}


/* Header */

.world-header {
  display: flex;
  align-items: center;

  gap: 14px;

  margin-bottom: 25px;
}


.back-button {
  width: 38px;
  height: 38px;

  flex: 0 0 auto;

  border: 0;
  border-radius: 50%;

  background: #e5e3dd;

  color: #65625c;

  font-size: 25px;

  cursor: pointer;
}


.world-header span,
.intro-card > span,
.info-card > span {
  color: #aaa69d;

  font-size: 8px;
  font-weight: 700;

  letter-spacing: 0.17em;
}


.world-header h1 {
  margin: 3px 0 0;

  font-size: 24px;
  font-weight: 600;
}


/* Intro */

.intro-card,
.today-card,
.rules-card,
.info-card {
  border:
    1px solid rgba(55, 52, 47, 0.06);

  background:
    rgba(255, 255, 255, 0.72);
}


.intro-card {
  padding: 20px;

  margin-bottom: 14px;

  border-radius: 22px;
}


.intro-card h2 {
  margin: 5px 0 8px;

  font-size: 19px;
  font-weight: 600;
}


.intro-card p,
.info-card p {
  margin: 0;

  color: #8f8b83;

  font-size: 10px;
  line-height: 1.7;
}


/* Rules */

.rules-card {
  padding: 0 18px;

  border-radius: 22px;
}


.rule-row {
  padding: 20px 0;
}


.rule-row +
.rule-row {
  border-top:
    1px solid rgba(70, 66, 60, 0.07);
}


.rule-name {
  margin-bottom: 16px;
}


.rule-name span {
  display: block;

  margin-bottom: 4px;

  color: #aaa69e;

  font-size: 7px;
  font-weight: 700;

  letter-spacing: 0.16em;
}


.rule-name strong {
  color: #55524c;

  font-size: 14px;
  font-weight: 600;
}


/* Range */

.range-inputs {
  display: flex;
  align-items: flex-end;

  gap: 10px;
}


.range-inputs label {
  flex: 1;
}


.range-inputs label > span {
  display: block;

  margin-bottom: 6px;

  color: #aaa79f;

  font-size: 8px;
}


.range-inputs label > div {
  display: flex;
  align-items: center;

  padding: 9px 10px;

  border:
    1px solid #dedbd4;

  border-radius: 12px;

  background: #ffffff;
}


.range-inputs input {
  width: 100%;
  min-width: 0;

  padding: 0;

  border: 0;
  outline: 0;

  background: transparent;

  color: #55524d;

  font-size: 17px;
}


.range-inputs em {
  color: #908d86;

  font-size: 10px;
  font-style: normal;
}


.range-line {
  padding-bottom: 11px;

  color: #aaa79f;
}


/* Buttons */

.primary-button {
  width: 100%;

  margin-top: 16px;

  padding: 13px;

  border: 0;
  border-radius: 15px;

  background: #55534d;

  color: white;

  cursor: pointer;
}


.save-message {
  min-height: 17px;

  margin: 9px 0 0;

  text-align: center;

  color: #88857e;

  font-size: 9px;
}


.secondary-link {
  display: block;

  margin-top: 12px;
  padding: 14px 16px;

  border-radius: 16px;

  background:
    rgba(255, 255, 255, 0.55);

  color: #6e6b64;

  font-size: 10px;

  text-align: center;
}


/* Today's odds */

.today-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  padding: 20px;

  margin-bottom: 14px;

  border-radius: 22px;
}


.today-card span {
  color: #aaa69e;

  font-size: 8px;
  font-weight: 700;

  letter-spacing: 0.14em;
}


.today-card h2 {
  margin: 5px 0 0;

  font-size: 22px;
  font-weight: 600;
}


.today-badge {
  padding: 6px 9px;

  border-radius: 999px;

  background: #e5e8df;

  color: #747a6d;

  font-size: 7px;
  font-weight: 700;
}


.odds-list {
  display: flex;
  flex-direction: column;

  gap: 10px;
}


.odds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 82px;

  padding: 17px 19px;

  border:
    1px solid rgba(55, 52, 47, 0.06);

  border-radius: 19px;

  background:
    rgba(255, 255, 255, 0.72);
}


.odds-name span {
  display: block;

  margin-bottom: 5px;

  color: #aaa69f;

  font-size: 8px;
}


.odds-name strong {
  color: #5e5b55;

  font-size: 13px;
  font-weight: 600;
}


.odds-value {
  display: flex;
  align-items: baseline;

  gap: 3px;
}


.odds-value strong {
  color: #494741;

  font-size: 28px;
  font-weight: 400;
}


.odds-value span {
  color: #8d8a83;

  font-size: 10px;
}


.info-card {
  margin-top: 15px;
  padding: 18px;

  border-radius: 20px;
}


.info-card p {
  margin-top: 8px;
}

/* =========================
   今日概率
   ========================= */

.today-probability-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-top: 15px;
  padding-top: 14px;

  border-top:
    1px solid rgba(70, 66, 60, 0.06);
}


.today-probability-row > span {
  color: #aaa79f;

  font-size: 9px;
}


.today-probability-button {
  min-width: 76px;

  padding: 7px 11px;

  border: 0;
  border-radius: 999px;

  background:
    rgba(75, 72, 66, 0.055);

  color: #68655e;

  font-size: 9px;
  font-weight: 500;

  cursor: pointer;
}


.today-probability-button:hover {
  background:
    rgba(75, 72, 66, 0.085);
}

/* =========================
   Liminal Settings
   ========================= */

.settings-menu {
  overflow: hidden;

  border:
    1px solid rgba(55, 52, 47, 0.06);

  border-radius: 22px;

  background:
    rgba(255, 255, 255, 0.72);
}


.settings-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;

  padding: 17px 19px;

  border: 0;

  background: transparent;

  text-align: left;

  cursor: pointer;
}


/*
  Settings 中已经接入页面的整行导航。

  明确让链接本身成为命中层，避免行内文字或箭头
  在部分浏览器中成为独立的触控目标。
*/

a.settings-menu-item[href="data-management.html"] {
  position: relative;
  z-index: 1;

  cursor: pointer;
  pointer-events: auto;

  touch-action: manipulation;
  -webkit-tap-highlight-color:
    transparent;
}


a.settings-menu-item[href="data-management.html"] > * {
  pointer-events: none;
}


.settings-menu-item +
.settings-menu-item {
  border-top:
    1px solid rgba(70, 66, 60, 0.065);
}


.settings-menu-item span {
  display: block;

  margin-bottom: 4px;

  color: #aaa69e;

  font-size: 7px;
  font-weight: 700;

  letter-spacing: 0.15em;
}


.settings-menu-item strong {
  color: #5a5751;

  font-size: 12px;
  font-weight: 500;
}


.settings-menu-item em {
  color: #aaa79f;

  font-size: 20px;
  font-style: normal;
  font-weight: 300;
}


.settings-note {
  margin: 15px 4px 0;

  color: #aaa79f;

  font-size: 9px;
  line-height: 1.7;
}


/* Rules 图标 */

.rules-icon {
  background: #e7e1e8;
}

/* =========================
   Rules · 领域分区
   ========================= */

.rules-domain {
  margin-top: 22px;
}


.domain-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  padding: 0 5px;

  margin-bottom: 10px;
}


.domain-heading > div > span {
  display: block;

  margin-bottom: 3px;

  color: #aaa69e;

  font-size: 8px;
  font-weight: 700;

  letter-spacing: 0.18em;
}


.domain-heading h2 {
  margin: 0;

  color: #55524c;

  font-size: 13px;
  font-weight: 600;
}


.domain-count {
  padding-bottom: 1px;

  color: #bbb8b0;

  font-size: 7px;
  font-weight: 600;

  letter-spacing: 0.1em;
}


/*
  每个领域自己拥有一张规则容器
*/

.rules-domain .rules-card {
  margin: 0;
}


/*
  第一条规则不需要额外边线
*/

.rules-domain .rule-row:first-child {
  border-top: 0;
}


/*
  领域之间留出更明显的呼吸空间
*/

.rules-domain + .rules-domain {
  margin-top: 27px;
}

/* =========================
   Rules · 人物切换
   ========================= */

.person-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin: 5px 0 9px;
}


.person-select-wrap {
  position: relative;

  display: inline-flex;
  align-items: center;
}


.person-select {
  appearance: none;
  -webkit-appearance: none;

  min-width: 120px;

  padding:
    2px
    30px
    2px
    0;

  border: 0;
  outline: 0;

  background: transparent;

  color: #35332f;

  font-size: 22px;
  font-weight: 600;

  cursor: pointer;
}


.person-select-arrow {
  position: absolute;

  right: 2px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 20px;
  height: 20px;

  pointer-events: none;

  color: #aaa79f;

  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}


/*
  浏览器下拉菜单里的文字
*/

.person-select option {
  color: #35332f;

  font-size: 14px;

  background: #ffffff;
}


/* =========================
   Mobile · Phase 1
   ========================= */

@media (max-width: 767px) {

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .world-shell {
    min-height: 100dvh;
    overflow-x: clip;
    padding-right:
      max(16px, env(safe-area-inset-right));
    padding-left:
      max(16px, env(safe-area-inset-left));
  }

  .world-header {
    min-width: 0;
  }

  .world-header > div {
    min-width: 0;
  }

  .world-header h1 {
    overflow-wrap: anywhere;
  }

  .back-button,
  .primary-button,
  .secondary-link,
  .today-probability-button,
  .settings-menu-item {
    min-height: 44px;
    touch-action: manipulation;
  }

  .back-button {
    width: 44px;
    height: 44px;
  }

  .rule-row,
  .rule-name,
  .range-inputs,
  .range-inputs label,
  .settings-menu-item,
  .settings-menu-item > div,
  .person-switch-row,
  .person-select-wrap {
    min-width: 0;
  }

  .rule-name span,
  .rule-name strong,
  .settings-menu-item strong,
  .settings-menu-item span,
  .settings-note,
  .info-card p {
    overflow-wrap: anywhere;
  }

  .range-inputs {
    grid-template-columns:
      minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .range-inputs input,
  .person-select {
    font-size: 16px;
  }

  .settings-menu-item {
    padding-top: 13px;
    padding-bottom: 13px;
  }

}


@media (max-width: 374px) {

  .world-shell {
    padding-right:
      max(12px, env(safe-area-inset-right));
    padding-left:
      max(12px, env(safe-area-inset-left));
  }

  .range-inputs {
    gap: 5px;
  }

}
