.personal-space-page {
  background: linear-gradient(180deg, #f8f5ef 0%, #f0edf4 100%);
  color: #273149;
}

.personal-space-page .page-shell {
  padding: 82px 18px max(36px, calc(env(safe-area-inset-bottom) + 24px));
}

.personal-space-page .page-back {
  display: grid;
  background: rgba(255, 255, 255, 0.88);
  color: #29334c;
  box-shadow: 0 8px 24px rgba(23, 34, 65, 0.12);
}

.space-header {
  max-width: 360px;
  margin: 0 auto 22px;
}

.space-header > p,
.reflection-kicker {
  margin: 0 0 8px;
  color: #75669d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.space-header h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 31px;
  line-height: 1.15;
  font-weight: 500;
}

.space-header > span {
  display: block;
  margin-top: 10px;
  color: #667087;
  font-size: 14px;
  line-height: 1.6;
}

.space-primary,
.space-secondary,
.space-card-actions button,
.space-filters button,
.library-real-card {
  min-height: 48px;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.space-primary {
  border: 0;
  padding: 0 20px;
  background: #263452;
  color: #fff;
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(28, 40, 72, 0.18);
}

.space-secondary {
  border: 1px solid rgba(42, 52, 77, 0.16);
  padding: 0 18px;
  background: #fff;
  color: #34405b;
  font-weight: 700;
}

.space-primary:disabled,
.space-secondary:disabled,
.space-card-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.space-create {
  width: 100%;
  max-width: 360px;
  margin: 0 auto 14px;
  display: block;
}

.space-list {
  max-width: 360px;
  margin: 14px auto 0;
  display: grid;
  gap: 12px;
}

.space-card,
.space-form,
.library-detail,
.oracle-real-card,
.reflection-signal {
  border: 1px solid rgba(56, 65, 91, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 13px 34px rgba(28, 36, 70, 0.09);
}

.space-card {
  padding: 17px;
}

.space-card.is-complete {
  background: rgba(245, 244, 248, 0.88);
}

.space-card.is-complete h2 {
  color: #777e91;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.space-card-heading h2 {
  margin: 7px 0 0;
  font-size: 18px;
  line-height: 1.35;
}

.space-card-heading p {
  margin: 7px 0 0;
  color: #687287;
  font-size: 13px;
  line-height: 1.55;
}

.space-status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ece8f7;
  color: #67588e;
  font-size: 10px;
  font-weight: 800;
}

.space-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 15px;
}

.space-card-actions button {
  min-height: 44px;
  border: 1px solid rgba(48, 59, 83, 0.12);
  background: #f6f4f8;
  color: #33405b;
  font-size: 12px;
  font-weight: 700;
}

.space-card-actions button.is-danger {
  color: #9d4256;
}

.space-form {
  max-width: 360px;
  margin: 0 auto 14px;
  padding: 17px;
}

.space-card .space-form {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.space-form label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #4d5870;
  font-size: 12px;
  font-weight: 700;
}

.space-form input,
.space-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  border: 1px solid rgba(48, 59, 83, 0.18);
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  color: #273149;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.space-form textarea {
  min-height: 88px;
  resize: vertical;
}

.space-form input:focus-visible,
.space-form textarea:focus-visible,
.space-primary:focus-visible,
.space-secondary:focus-visible,
.space-card-actions button:focus-visible,
.space-filters button:focus-visible,
.library-real-card:focus-visible {
  outline: 3px solid rgba(65, 145, 211, 0.52);
  outline-offset: 2px;
}

.space-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.space-form-status {
  min-height: 18px;
  margin: 9px 0 0;
  color: #9d4256;
  font-size: 12px;
  line-height: 1.4;
}

.personal-space-empty,
.personal-space-loading {
  max-width: 360px;
  margin: 28px auto;
  padding: 28px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.75);
  color: #667087;
  text-align: center;
}

.personal-space-loading i {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 12px;
  border: 3px solid rgba(88, 75, 130, 0.15);
  border-top-color: #75669d;
  border-radius: 50%;
  animation: space-spin 0.8s linear infinite;
}

@keyframes space-spin {
  to { transform: rotate(360deg); }
}

.space-filters {
  max-width: 360px;
  margin: 0 auto 16px;
  padding: 4px;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  gap: 4px;
  border-radius: 17px;
  background: rgba(45, 54, 79, 0.08);
}

.space-filters::-webkit-scrollbar {
  display: none;
}

.space-filters button {
  flex: 0 0 auto;
  min-width: 62px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #687287;
  font-size: 12px;
  font-weight: 750;
  scroll-snap-align: start;
}

.space-filters button[aria-selected="true"] {
  background: #fff;
  color: #28344f;
  box-shadow: 0 6px 16px rgba(31, 42, 72, 0.1);
}

.library-real-grid {
  max-width: 360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.library-real-card {
  min-height: 190px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 217, 156, 0.76), transparent 32%),
    linear-gradient(145deg, #8ad3d2, #c6a6d2 56%, #e5a0b7);
  color: #24314c;
  text-align: left;
  box-shadow: 0 14px 30px rgba(35, 45, 80, 0.12);
}

.library-real-card:nth-child(2n) {
  background:
    radial-gradient(circle at 90% 10%, rgba(250, 212, 143, 0.35), transparent 32%),
    linear-gradient(145deg, #263a66, #715f92 58%, #bd819d);
  color: #fff;
}

.library-real-card > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

.library-real-card strong {
  margin-top: 20px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(16px, 5vw, 20px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.library-real-card small {
  margin-top: 8px;
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.5;
  opacity: 0.78;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.library-real-card i {
  margin-top: auto;
  padding-top: 12px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.library-detail {
  position: relative;
  max-width: 360px;
  box-sizing: border-box;
  margin: 0 auto 14px;
  padding: 22px;
}

.library-detail > span {
  color: #75669d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-detail h2 {
  margin: 8px 42px 0 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 25px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.library-detail p,
.library-detail blockquote {
  color: #667087;
  font-size: 13px;
  line-height: 1.6;
}

.library-detail blockquote {
  margin: 14px 0;
  padding: 13px 15px;
  border-left: 3px solid #8e78b5;
  border-radius: 0 12px 12px 0;
  background: #f4f1f8;
}

.library-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f0edf4;
  color: #37415a;
  font-size: 22px;
}

.library-detail-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.library-detail-actions .space-primary {
  width: 100%;
}

.library-empty {
  grid-column: 1 / -1;
}

.honest-reflection {
  width: min(100%, 370px);
  min-height: calc(100dvh - 118px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.reflection-orb {
  width: 132px;
  height: 132px;
  margin: 20px auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 231, 171, 0.72);
  border-radius: 50%;
  background: radial-gradient(circle, #fff0c4 0 8%, #e18faa 27%, #7568ae 51%, transparent 72%);
  color: #fff4cf;
  font-size: 30px;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.03), 0 0 42px rgba(251, 207, 139, 0.18);
}

.honest-reflection h1 {
  max-width: 330px;
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 500;
}

.reflection-body,
.reflection-disclosure {
  max-width: 330px;
  color: #667087;
  font-size: 13px;
  line-height: 1.6;
}

.reflection-signal {
  width: 100%;
  box-sizing: border-box;
  margin: 14px 0;
  padding: 17px;
  text-align: left;
}

.reflection-signal strong,
.reflection-signal span {
  display: block;
}

.reflection-signal strong {
  color: #75669d;
  font-size: 11px;
}

.reflection-signal span {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.honest-reflection > .space-primary {
  width: 100%;
  margin-top: 12px;
}

.oracle-reflection .space-filters {
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}

.oracle-real-card {
  width: 100%;
  box-sizing: border-box;
  padding: 19px;
  text-align: left;
}

.oracle-real-card > span {
  color: #75669d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.oracle-real-card h2 {
  margin: 8px 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 23px;
  font-weight: 500;
}

.oracle-real-card > p {
  color: #667087;
  font-size: 13px;
  line-height: 1.6;
}

.oracle-real-card > div {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(53, 63, 88, 0.1);
}

.oracle-real-card > div strong {
  color: #75669d;
  font-size: 10px;
}

.oracle-real-card > div small {
  color: #36415a;
  font-size: 13px;
}

/* Replace the old fake CSS affordances with real interactive controls. */
.page-checkins .page-content::after,
.page-library .page-kicker::after {
  content: none !important;
  display: none !important;
}

/* Internal diagnostics stay available in the API and tests, not in the member-facing UI. */
/* Every carousel target keeps a 44px or larger touch area. */
.interface-layer .pages button,
.interface-layer .pages button.active {
  min-width: 44px !important;
  min-height: 44px !important;
}

html[lang^="zh"] .task-card:nth-child(2) .play::after {
  content: "立即回答" !important;
}

html[lang^="zh"] .task-tarot-single .play::after {
  content: "抽一张牌" !important;
}

html[lang^="zh"] .task-tarot-three .play::after {
  content: "抽三张牌" !important;
}

@media (prefers-reduced-motion: reduce) {
  .personal-space-loading i {
    animation: none;
  }
}

@media (max-width: 360px) {
  .library-real-grid {
    grid-template-columns: 1fr;
  }

  .library-real-card {
    min-height: 160px;
  }

  .space-card-actions {
    grid-template-columns: 1fr;
  }
}
