@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Instrument+Serif:ital@0;1&display=swap");

:root {
  --bg: #f4efe6;
  --card: rgba(255, 250, 242, 0.88);
  --ink: #1f2520;
  --muted: #5e665f;
  --line: rgba(31, 37, 32, 0.12);
  --warm: #dd6a3d;
  --warm-soft: #f1b48a;
  --green: #2f6b4f;
  --sand: #efe2ca;
  --shadow: 0 24px 80px rgba(71, 54, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(221, 106, 61, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(47, 107, 79, 0.16), transparent 28%),
    linear-gradient(135deg, #f8f2e8 0%, #ede5d4 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 12px 14px;
  display: flex;
  align-items: center;
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.8;
  animation: drift 10s ease-in-out infinite alternate;
}

.ambient-left {
  top: 8%;
  left: -80px;
  width: 220px;
  height: 220px;
  background: rgba(221, 106, 61, 0.22);
}

.ambient-right {
  right: -90px;
  bottom: 10%;
  width: 280px;
  height: 280px;
  background: rgba(47, 107, 79, 0.2);
  animation-duration: 12s;
}

.app-card {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 32px;
  background: var(--card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  display: block;
}

.view-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(31, 37, 32, 0.06);
}

.view-tab {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.view-tab.active {
  background: var(--ink);
  color: #fff9f0;
  box-shadow: 0 12px 20px rgba(31, 37, 32, 0.14);
}

.view-page {
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  margin-top: 16px;
}

.view-page.active {
  display: grid;
}

.view-page[hidden] {
  display: none !important;
}

.hero,
.control-panel,
.timer-stage {
  animation: rise 0.7s ease forwards;
}

.hero {
  padding-left: 18px;
}

.control-panel {
  animation-delay: 0.1s;
}

.timer-stage {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  animation-delay: 0.18s;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--warm);
}

.hero h1 {
  margin: 0;
  max-width: none;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.1rem, 3.9vw, 3.55rem);
  line-height: 0.9;
  font-weight: 400;
}

.hero h1 span {
  display: block;
  white-space: nowrap;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 40ch;
  line-height: 1.5;
  font-size: 0.96rem;
  color: var(--muted);
}

.control-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.mode-switch,
.quick-presets,
.status-panel,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mode-button,
.preset-button,
.action-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-button,
.preset-button {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(31, 37, 32, 0.08);
}

.mode-button.active,
.preset-button.active {
  color: #fff9f0;
  background: var(--ink);
  box-shadow: 0 16px 28px rgba(31, 37, 32, 0.16);
}

.settings-grid {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(31, 37, 32, 0.08);
}

.settings-header {
  display: grid;
  gap: 6px;
}

.settings-kicker {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warm);
}

.settings-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.time-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 252, 247, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.field textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 252, 247, 0.92);
  color: var(--ink);
  outline: none;
  font: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.field input:focus {
  border-color: var(--warm);
  transform: translateY(-1px);
}

.field textarea:focus {
  border-color: var(--warm);
  transform: translateY(-1px);
}

.duration-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 248, 238, 0.84);
  border: 1px solid rgba(31, 37, 32, 0.06);
}

.duration-preview span {
  color: var(--muted);
}

.duration-preview strong {
  font-size: 1.05rem;
}

.timer-stage {
  padding: 16px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96), rgba(244, 234, 215, 0.92)),
    var(--sand);
  border: 1px solid rgba(31, 37, 32, 0.06);
}

.progress-ring {
  width: min(100%, 290px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 14px;
  background:
    conic-gradient(var(--green) 0deg, var(--warm-soft) 0deg, rgba(255, 255, 255, 0.5) 0deg);
  transition: background 0.25s linear;
  box-shadow: inset 0 0 0 1px rgba(31, 37, 32, 0.05);
}

.progress-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at top, #fffaf5 0%, #f5ecdb 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
}

.session-tag {
  margin: 0 0 6px;
  color: var(--muted);
}

.time-display {
  font-size: clamp(2.5rem, 6.8vw, 4rem);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.time-caption {
  margin: 6px 0 0;
  max-width: 22ch;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.94rem;
}

.status-panel {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 37, 32, 0.07);
  display: grid;
  gap: 6px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card strong {
  font-size: 0.96rem;
}

.action-row {
  justify-content: center;
}

.action-button {
  min-width: 104px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(31, 37, 32, 0.08);
}

.action-button.primary {
  background: linear-gradient(135deg, #1f2520 0%, #355844 100%);
  color: #fff8f0;
  box-shadow: 0 18px 28px rgba(47, 107, 79, 0.22);
}

.mode-button:hover,
.preset-button:hover,
.action-button:hover {
  transform: translateY(-2px);
}

.motivation {
  margin: 0;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.reflection-page {
  align-items: start;
}

.reflection-hero,
.reflection-stage {
  animation: rise 0.7s ease forwards;
}

.reflection-hero h2 {
  margin: 0;
  max-width: 9ch;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2rem, 3.7vw, 3.2rem);
  line-height: 0.95;
  font-weight: 400;
}

.reflection-summary {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.reflection-stage {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  gap: 14px;
  align-content: start;
}

.reflection-card {
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.96), rgba(244, 234, 215, 0.92)),
    var(--sand);
  border: 1px solid rgba(31, 37, 32, 0.06);
}

.reflection-actions {
  justify-content: flex-start;
}

.history-card {
  min-height: 100%;
}

.history-header {
  margin-bottom: 12px;
}

.reflection-list {
  display: grid;
  gap: 10px;
  max-height: 270px;
  overflow: auto;
  padding-right: 6px;
}

.reflection-entry {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(31, 37, 32, 0.06);
}

.reflection-entry strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.reflection-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.83rem;
}

.reflection-entry p {
  margin: 0;
  line-height: 1.55;
  color: var(--ink);
}

.reflection-next {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  margin: 0;
  padding: 18px 0;
  color: var(--muted);
  line-height: 1.6;
}

.reflection-modal[hidden] {
  display: none !important;
}

.reflection-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.reflection-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 19, 0.28);
  backdrop-filter: blur(10px);
}

.reflection-modal-panel {
  position: relative;
  width: min(100%, 620px);
  padding: 20px;
  border-radius: 28px;
  background: rgba(255, 249, 241, 0.96);
  box-shadow: 0 30px 80px rgba(45, 36, 22, 0.22);
  display: grid;
  gap: 14px;
}

.reflection-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.reflection-modal-head h3 {
  margin: 4px 0 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1;
  font-weight: 400;
}

.reflection-modal-summary {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translateY(0) scale(1);
  }

  to {
    transform: translateY(18px) scale(1.06);
  }
}

@media (max-width: 920px) {
  .page-shell {
    display: block;
    padding: 16px;
  }

  .app-card {
    width: 100%;
  }

  .view-page {
    grid-template-columns: 1fr;
  }

  .timer-stage {
    grid-column: auto;
    grid-row: auto;
  }

  .reflection-stage {
    grid-column: auto;
    grid-row: auto;
  }

  .hero {
    padding-left: 0;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px;
    display: block;
  }

  .app-card {
    padding: 22px;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 12vw, 3rem);
    line-height: 1.02;
  }

  .hero h1 span + span {
    margin-top: 0.12em;
  }

  .time-fields,
  .status-panel,
  .reflection-summary {
    grid-template-columns: 1fr;
  }

  .duration-preview {
    align-items: flex-start;
    flex-direction: column;
  }

  .timer-stage {
    padding: 18px 14px;
  }

  .progress-ring {
    width: 260px;
    height: 260px;
    max-width: 100%;
    flex: 0 0 auto;
  }

  .reflection-modal {
    padding: 14px;
  }

  .reflection-modal-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .mode-button,
  .preset-button,
  .action-button {
    width: 100%;
    justify-content: center;
  }

  .action-row {
    width: 100%;
  }

  .action-button {
    min-width: 0;
  }
}
