:root {
  color-scheme: light;
  --ink: #28312e;
  --muted: #7d8581;
  --paper: #f7f6f2;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(60, 73, 67, 0.1);
  --green: #587369;
  --green-dark: #3f5b51;
  --green-soft: #e8efec;
  --rose: #c88788;
  --rose-soft: #f5e9e7;
  --shadow: 0 24px 70px rgba(65, 76, 70, 0.11);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(226, 218, 199, 0.45), transparent 30%),
    radial-gradient(circle at 90% 88%, rgba(201, 221, 213, 0.38), transparent 32%),
    var(--paper);
  overflow-x: hidden;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.55;
  pointer-events: none;
}

.ambient-one { top: -150px; right: 8%; background: rgba(224, 206, 200, 0.5); }
.ambient-two { bottom: -170px; left: 5%; background: rgba(195, 214, 204, 0.5); }

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.entry-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.entry-card {
  width: min(100%, 470px);
  padding: 48px 52px 36px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  position: relative;
  display: inline-flex;
  width: 55px;
  height: 40px;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 20px;
}

.brand-mark span {
  position: absolute;
  width: 32px;
  height: 38px;
  border-radius: 28px 28px 8px 28px;
  background: var(--green);
  transform: rotate(34deg);
  transform-origin: bottom right;
}

.brand-mark span + span {
  background: var(--rose);
  transform: scaleX(-1) rotate(34deg);
  transform-origin: bottom left;
}

.brand-mark::after {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: -4px;
  width: 2px;
  height: 24px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.45;
}

.brand-mark.small {
  width: 37px;
  height: 31px;
  margin: 0;
  transform: scale(0.72);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.19em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 7vw, 43px);
  font-weight: 650;
  letter-spacing: 0.04em;
}

.entry-copy {
  margin-bottom: 36px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.entry-form { text-align: left; }
.entry-form label, .subject-editor label {
  display: block;
  margin-bottom: 17px;
  color: #59615e;
  font-size: 13px;
  font-weight: 650;
}

.entry-form label span { display: block; margin: 0 0 8px 3px; }
.entry-form small { color: #9ca19f; font-size: 11px; font-weight: 400; }

input {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 13px;
  background: rgba(250, 250, 248, 0.92);
  color: var(--ink);
  padding: 14px 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder { color: #b3b7b5; }
input:focus {
  border-color: rgba(88, 115, 105, 0.5);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(88, 115, 105, 0.08);
}

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 49px;
  border: 0;
  border-radius: 14px;
  padding: 0 20px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  width: 100%;
  color: white;
  background: var(--green);
  box-shadow: 0 10px 25px rgba(63, 91, 81, 0.18);
}

.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(63, 91, 81, 0.24); }
.primary-button:active { transform: translateY(0); }
.primary-button:disabled { cursor: wait; opacity: 0.6; transform: none; }

.secondary-button { color: var(--ink); background: #eff1ef; }
.form-error { min-height: 20px; margin: -5px 3px 8px; color: #b96363; font-size: 12px; }

.privacy-note { margin: 20px 0 0; color: #9a9f9c; font-size: 11px; }
.tiny-dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #94ac9f; }

.room-view { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 24px; }
.is-hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  margin-bottom: 24px;
  padding: 0 6px;
}

.brand-inline, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.brand-inline strong { font-size: 17px; letter-spacing: 0.05em; }
.brand-inline p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.connection-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #d2a761; }
.connection-dot.online { background: #6c9a80; box-shadow: 0 0 0 3px rgba(108, 154, 128, 0.12); }

.online-summary, .soft-label {
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.7);
  color: #68706c;
  font-size: 12px;
}

.text-button { border: 0; background: transparent; color: var(--muted); padding: 7px 8px; cursor: pointer; }
.text-button.danger:hover { color: #ad6666; }

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 20px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 25px;
  background: var(--card);
  box-shadow: 0 14px 42px rgba(65, 76, 70, 0.07);
  backdrop-filter: blur(15px);
}

.focus-panel { grid-row: span 2; min-height: 620px; padding: 37px 42px 30px; }
.together-panel, .activity-panel { padding: 29px 31px; }

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-heading.compact { align-items: center; }
.panel-heading h2 { margin-bottom: 0; font-size: 21px; font-weight: 650; letter-spacing: 0.02em; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
}

.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: #6f987f; }
.status-badge.paused { color: #92705c; background: #f5ede3; }
.status-badge.paused i { background: #c49a76; }

.main-timer {
  margin-top: 71px;
  text-align: center;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(46px, 7vw, 66px);
  font-weight: 300;
  letter-spacing: 0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-caption { margin: 14px 0 51px; text-align: center; color: #9ba09d; font-size: 12px; }
.subject-editor { margin: 0 auto; max-width: 430px; }
.subject-editor > label { margin: 0 0 9px 3px; }
.subject-editor > div { position: relative; }
.subject-editor input { padding-right: 64px; }
.subject-editor button {
  position: absolute;
  top: 50%;
  right: 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--green);
  padding: 7px 8px;
  cursor: pointer;
  transform: translateY(-50%);
}

.focus-actions { margin: 25px auto 0; max-width: 430px; }
.pause-button.paused { background: var(--rose); }
.button-icon { min-width: 17px; font-weight: 800; letter-spacing: -0.12em; }

.lifetime-row {
  display: flex;
  justify-content: space-between;
  margin-top: 39px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.lifetime-row strong { color: var(--ink); font-weight: 650; }

.participants { display: grid; gap: 11px; margin-top: 22px; }
.participant-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(76, 91, 84, 0.07);
  border-radius: 17px;
  padding: 13px 14px;
  background: rgba(249, 249, 247, 0.74);
}

.avatar {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  border-radius: 14px;
  color: white;
  background: var(--green);
  font-size: 15px;
  font-weight: 700;
}
.participant-card:nth-child(even) .avatar { background: var(--rose); }
.participant-main { min-width: 0; }
.participant-name { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; font-size: 13px; font-weight: 700; }
.participant-name small { border-radius: 7px; padding: 2px 5px; color: var(--green); background: var(--green-soft); font-size: 9px; }
.participant-subject { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.participant-time { text-align: right; font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-variant-numeric: tabular-nums; }
.participant-time small { display: block; margin-top: 3px; color: var(--muted); font-family: inherit; font-size: 9px; }

.activity-list { margin-top: 17px; }
.activity-item { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; }
.activity-item:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 31px; bottom: -2px; width: 1px; background: var(--line); }
.activity-icon { z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 10px; }
.activity-icon.pause, .activity-icon.leave, .activity-icon.offline { color: #a07669; background: var(--rose-soft); }
.activity-copy { min-width: 0; color: #5e6662; font-size: 12px; line-height: 1.6; }
.activity-copy strong { color: var(--ink); }
.activity-copy span { display: block; overflow: hidden; color: #9aa09d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: #a4a8a6; font-size: 10px; }

.empty-state { padding: 34px 0 18px; text-align: center; color: #a1a6a3; }
.empty-state div { font-size: 28px; opacity: 0.6; }
.empty-state p { margin: 9px 0 0; font-size: 12px; }

footer { padding: 25px 0 5px; text-align: center; color: #a4a8a6; font-size: 11px; letter-spacing: 0.08em; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  max-width: calc(100% - 32px);
  border-radius: 12px;
  padding: 11px 16px;
  color: white;
  background: rgba(42, 50, 47, 0.92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.dialog-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(33, 39, 36, 0.28);
  backdrop-filter: blur(8px);
}
.dialog-card {
  width: min(100%, 400px);
  border-radius: 24px;
  padding: 31px;
  background: #fff;
  box-shadow: var(--shadow);
}
.dialog-card h2 { margin-bottom: 10px; font-size: 23px; }
.dialog-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }

@media (max-width: 820px) {
  .room-view { width: min(100% - 24px, 650px); padding-top: 12px; }
  .room-grid { grid-template-columns: 1fr; }
  .focus-panel { grid-row: auto; min-height: 0; }
  .main-timer { margin-top: 54px; }
}

@media (max-width: 520px) {
  .entry-view { padding: 18px 13px; }
  .entry-card { padding: 37px 23px 28px; border-radius: 24px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; align-items: flex-end; gap: 3px; }
  .online-summary { padding: 5px 9px; }
  .panel { border-radius: 21px; }
  .focus-panel { padding: 28px 22px 24px; }
  .together-panel, .activity-panel { padding: 25px 20px; }
  .main-timer { margin-top: 46px; font-size: clamp(42px, 14vw, 56px); }
  .timer-caption { margin-bottom: 41px; }
  .participant-card { grid-template-columns: auto minmax(0, 1fr); }
  .participant-time { grid-column: 2; text-align: left; font-size: 12px; }
  .participant-time small { display: inline; margin-left: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
