:root {
  color-scheme: light;
  --app-bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f1f2f4;
  --text: #111114;
  --muted: #6b6f78;
  --hairline: rgba(0, 0, 0, 0.08);
  --blue: #007aff;
  --green: #248a3d;
  --orange: #bf6a02;
  --red: #d70015;
  --purple: #8944ab;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #e7e8ec;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.8), transparent 38rem),
    #e7e8ec;
}

button,
input {
  font: inherit;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
  background: var(--app-bg);
}

@media (min-width: 720px) {
  body {
    padding: 28px 0;
  }

  .phone-shell {
    min-height: calc(100vh - 56px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 34px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-button,
.icon-button {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-button {
  color: var(--blue);
}

.icon-button svg,
.delete-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button[aria-pressed="true"] {
  color: white;
  background: var(--blue);
}

.language-button:focus-visible,
.icon-button:focus-visible,
.delete-button:focus-visible,
.close-button:focus-visible,
.kids-toggle:focus-visible,
.tag-chip:focus-visible,
.trick-card:focus-visible,
.timestamp-link:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 2px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: 0;
}

.count-pill {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(0, 122, 255, 0.12);
  font-weight: 750;
}

.controls {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.search-field {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
  background: #e6e7eb;
}

.search-field svg,
.close-button svg,
.timestamp-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.filter-row {
  display: flex;
}

.kids-toggle,
.tag-chip {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.kids-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px 6px 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-weight: 680;
}

.toggle-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d6d8de;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.kids-toggle[aria-pressed="true"] {
  color: white;
  background: var(--blue);
}

.kids-toggle[aria-pressed="true"] .toggle-dot {
  background: white;
}

.tag-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 2px 4px;
  scrollbar-width: none;
}

.tag-strip::-webkit-scrollbar {
  display: none;
}

.tag-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.tag-chip.is-selected {
  color: white;
  background: var(--blue);
}

.section-title {
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.trick-list {
  display: grid;
  gap: 10px;
}

.trick-card {
  position: relative;
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 13px 12px 12px;
  border: 0;
  border-radius: 14px;
  text-align: left;
  color: inherit;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
  cursor: pointer;
}

.trick-card.is-editing {
  padding-right: 52px;
}

.delete-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--red);
  background: rgba(215, 0, 21, 0.10);
  cursor: pointer;
  z-index: 1;
}

.trick-card.is-editing .timestamp-link {
  margin-right: 0;
}

.trash-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.trash-section[hidden] {
  display: none;
}

.trash-section .trick-card {
  opacity: 0.78;
}

.trick-card[role="button"]:hover {
  background: #fbfbfc;
}

.card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.trick-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.24;
  letter-spacing: 0;
}

.timestamp-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(0, 122, 255, 0.10);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.trick-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.36;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.mini-tags {
  display: flex;
  gap: 6px;
  overflow: hidden;
}

.mini-tag,
.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mini-tag {
  padding: 4px 8px;
  color: #34373d;
  background: var(--surface-soft);
}

.status-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 3px 7px;
}

.status-kids {
  color: #075da8;
  background: rgba(0, 122, 255, 0.10);
}

.status-normal {
  color: var(--green);
  background: rgba(36, 138, 61, 0.12);
}

.status-supervision,
.status-fire {
  color: var(--orange);
  background: rgba(255, 149, 0, 0.14);
}

.status-fire {
  color: var(--red);
  background: rgba(215, 0, 21, 0.11);
}

.status-electrical {
  color: var(--purple);
  background: rgba(137, 68, 171, 0.12);
}

.status-weather {
  color: #0969a8;
  background: rgba(0, 122, 255, 0.10);
}

.empty-state {
  padding: 40px 18px;
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.detail-sheet {
  width: min(100% - 18px, 420px);
  max-height: min(82vh, 720px);
  margin: auto auto 8px;
  padding: 20px 14px max(18px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 22px 22px 18px 18px;
  color: var(--text);
  background: var(--app-bg);
  box-shadow: var(--shadow);
  overflow-y: auto;
}

body:has(.detail-sheet[open]) {
  overflow: hidden;
}

.detail-sheet::backdrop {
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.sheet-grabber {
  width: 42px;
  height: 5px;
  margin: -8px auto 12px;
  border-radius: 99px;
  background: #c8c9ce;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #60636b;
  background: #dcdee3;
  cursor: pointer;
}

.detail-title {
  margin: 0 42px 10px 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-text {
  margin: 0 0 14px;
  color: #24272d;
  font-size: 16px;
  line-height: 1.42;
}

.video-embed {
  width: 100%;
  margin: 4px 0 14px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #111114;
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.detail-block {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.detail-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.detail-value {
  margin: 0;
  font-size: 15px;
  line-height: 1.34;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
