:root {
    --bg: #05030a;
    --panel: rgba(19, 12, 27, 0.92);
    --border: rgba(255, 255, 255, 0.1);
    --accent: #ff6c95;
    --accent-2: #f0d264;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.7);
    --shadow: 0 35px 70px rgba(0, 0, 0, 0.55);
    font-family:
        "PingFang SC",
        "Microsoft YaHei",
        system-ui,
        -apple-system,
        sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(255, 108, 149, 0.25),
            transparent 48%
        ),
        radial-gradient(
            circle at 80% 0%,
            rgba(125, 211, 252, 0.2),
            transparent 55%
        ),
        var(--bg);
    color: var(--text);
}

.page {
  margin: 0 auto;
  min-height: 100vh;
  max-width: 640px;
  padding: clamp(20px, 5vw, 40px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    justify-content: center;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-link {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.history-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.crumb-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.crumb-link:hover {
    color: #ffffff;
}

.crumb-sep {
    color: rgba(255, 255, 255, 0.4);
}

.crumb-current {
    color: rgba(255, 255, 255, 0.9);
}

.page-header {
  text-align: center;
  font-size: clamp(1.6rem, 6vw, 2rem);
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.history-page .focus-card {
  display: none;
}

.history-page .page {
  justify-content: flex-start;
  padding-top: clamp(20px, 8vw, 60px);
}

.history-card {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 20px;
  background: rgba(18, 12, 27, 0.8);
  box-shadow: var(--shadow);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
}

.history-heading {
  margin: 0;
  font-size: clamp(1.3rem, 3.8vw, 1.8rem);
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.18em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.stat-block {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.stat-label {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.stat-value {
  margin: 8px 0 0;
  font-size: 1.8rem;
  font-weight: 600;
}

.stat-note {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.24em;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.history-page .history-list {
  max-height: none;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-item-main {
  display: flex;
  gap: 12px;
  align-items: center;
}

.history-label {
  font-size: 0.95rem;
  color: #fff;
  margin: 0 0 2px;
}

.history-meta {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  gap: 12px;
}

.history-thumb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(255, 108, 149, 0.18);
  color: rgba(255, 108, 149, 0.9);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.history-duration {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.history-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.history-text-block {
  flex: 1;
}

.history-empty {
  font-size: 0.9rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  padding: 12px 0;
}

.focus-card {
    border: 1px solid var(--border);
    border-radius: 36px;
    padding: clamp(18px, 5vw, 32px);
    background: var(--panel);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.timer-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.focus-content {
    min-height: 260px;
    border: none;
    border-radius: 30px;
    padding: clamp(12px, 3vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.25s ease;
}

.focus-content[data-mode="placeholder"] {
    background: rgba(255, 255, 255, 0.02);
}

.focus-content[data-mode="text"] {
    background: rgba(255, 255, 255, 0.04);
}

.focus-content[data-mode="pose"] {
    background: rgba(255, 255, 255, 0.07);
}

.placeholder,
.content-text {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--muted);
}

.pose-card {
    width: 100%;
    max-width: 420px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pose-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.pose-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pose-card .pose-title {
    font-size: 1rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-align: center;
}

.timer-value {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 90px;
    text-align: right;
}

.progress-track {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: var(--accent);
    transition:
        width 0.2s ease,
        background 0.2s ease;
}

.progress-bar.green {
    background: #7ae582;
}

.progress-bar.yellow {
    background: #fcd77f;
}

.progress-bar.red {
    background: #ff6c95;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 3, 8, 0.92);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 20;
}

.grid-overlay.hidden {
    display: none;
}

.grid-panel {
    background: rgba(17, 11, 24, 0.96);
    border-radius: 28px;
    border: none;
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    width: min(420px, 90vw, 90vh);
    box-sizing: border-box;
    flex-direction: column;
    gap: 12px;
}

.grid-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
    gap: 8px;
}

.grid-mode-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.mode-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.mode-btn.active {
  background: rgba(255, 108, 149, 0.2);
  color: #fff;
  border-color: rgba(255, 108, 149, 0.6);
}

.page-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.grid-breadcrumb {
    font-size: 0.85rem;
}

.refresh-btn {
    border: none;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f0f23;
    background: linear-gradient(130deg, #ff81a8, #ffc86f);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.refresh-btn:active {
    transform: scale(0.96);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    height: 100%;
}

.grid-card {
    border-radius: 18px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition:
        transform 0.12s ease,
        border-color 0.12s ease,
        background 0.12s ease;
    flex-direction: column;
    gap: 6px;
}

.grid-card:hover {
    transform: scale(0.98);
    background: rgba(255, 108, 149, 0.1);
}

.grid-card.pose {
    padding: 6px;
}

.grid-card.text {
    padding: 12px;
}

.grid-card p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--muted);
}

.grid-card img {
    width: 100%;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.grid-card span {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

@media (max-width: 540px) {
    .focus-content {
        min-height: 220px;
    }

    .history-page .page {
      padding-top: clamp(20px, 10vw, 40px);
    }

    .stats-grid {
      grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .history-item-main {
      flex-direction: column;
      align-items: center;
      text-align: center;
    }

    .history-label-row {
      width: 100%;
    }

    .history-thumb {
      width: 100%;
      height: auto;
      aspect-ratio: 4 / 3;
    }

    .grid-panel {
        width: min(320px, 90vw, 90vh);
        height: min(360px, 90vw, 90vh);
        padding: 12px;
    }

    .grid-mode-toggle {
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .grid {
        gap: 8px;
    }

    .grid-card {
        padding: 6px;
    }

    .grid-card p {
        font-size: 0.85rem;
    }
}
