:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.08);
  --accent-strong: rgba(249, 115, 22, 0.2);
  --text: #111827;
  --subtle: #6b7280;
  --border-soft: #e5e7eb;
  --chip-bg: #eef2ff;
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 160ms ease-out;
  --tone-calm: #16a34a;
  --tone-bold: #f97316;
  --tone-neutral: #9ca3af;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: linear-gradient(
    180deg,
    #f9fafb 0,
    #eef2ff 35%,
    #e5e7eb 100%
  );
  color: var(--text);
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Top bar */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.98),
    rgba(248, 250, 252, 0.9)
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(15, 23, 42, 0.08);
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--subtle);
  font-size: 16px;
  padding: 4px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.icon-btn:active {
  transform: scale(0.9);
  background: rgba(229, 231, 235, 0.8);
  color: #b91c1c;
}

/* Layout */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel {
  border-radius: var(--radius-lg);
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.98),
      rgba(248, 250, 252, 0.96)
    ),
    radial-gradient(
      circle at top left,
      rgba(209, 213, 219, 0.3),
      transparent
    );
  border: 1px solid rgba(229, 231, 235, 0.9);
  box-shadow: var(--shadow-soft);
}

.panel-input {
  padding: 12px 12px 10px;
}

.panel-pulse {
  padding: 10px 12px 10px;
}

.panel-grid {
  flex: 1;
  padding: 10px 10px 8px;
  background: linear-gradient(
      135deg,
      #ffffff,
      #f9fafb
    ),
    radial-gradient(circle at bottom, rgba(209, 213, 219, 0.5), transparent);
}

/* Input area */

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row + .field-row {
  margin-top: 8px;
}

.row-compact {
  justify-content: space-between;
}

#noteInput {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 1);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: radial-gradient(
      circle at top,
      #ffffff,
      #f9fafb
    ),
    linear-gradient(0deg, #ffffff, #ffffff);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(243, 244, 246, 1);
}

#noteInput::placeholder {
  color: rgba(156, 163, 175, 0.9);
}

#noteInput:focus {
  border-color: rgba(249, 115, 22, 0.8);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 1),
    0 0 0 2px rgba(249, 115, 22, 0.3),
    0 0 18px rgba(249, 115, 22, 0.25);
}

/* Select */

#moodSelect {
  min-width: 120px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 1);
  background: linear-gradient(
    135deg,
    #ffffff,
    rgba(251, 113, 133, 0.04)
  );
  color: var(--subtle);
  font-size: 13px;
  outline: none;
}

/* Chips */

.chips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 1);
  background: var(--chip-bg);
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast);
}

.chip-active {
  color: var(--accent);
  border-color: rgba(249, 115, 22, 0.9);
  background: #fff7ed;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 1),
    0 0 12px rgba(249, 115, 22, 0.25);
}

/* Buttons */

.primary-btn,
.secondary-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast),
    opacity var(--transition-fast);
}

.primary-btn {
  background: radial-gradient(
      circle at top left,
      rgba(249, 115, 22, 0.96),
      rgba(234, 88, 12, 0.98)
    ),
    linear-gradient(90deg, #fb923c, #f97316);
  color: #111827;
  box-shadow:
    0 8px 16px rgba(249, 115, 22, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.9);
}

.secondary-btn {
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  color: var(--subtle);
  border: 1px solid rgba(209, 213, 219, 1);
}

.primary-btn:active,
.secondary-btn:active {
  transform: scale(0.96);
}

/* Pulse strip */

.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pulse-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(148, 163, 184, 0.95);
}

.pulse-summary {
  font-size: 11px;
  color: rgba(55, 65, 81, 0.95);
}

.pulse-strip {
  display: flex;
  gap: 4px;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  padding: 2px;
  background: radial-gradient(
      circle at left,
      rgba(251, 113, 133, 0.08),
      transparent
    ),
    linear-gradient(90deg, #ffffff, #f9fafb);
  box-shadow: inset 0 0 0 1px rgba(229, 231, 235, 1);
}

.pulse-seg {
  flex: 1;
  border-radius: 999px;
  background: var(--accent-soft);
  position: relative;
  overflow: hidden;
}

.pulse-seg-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), #fed7aa);
  opacity: 0.7;
}

/* Card grid */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 80px;
  gap: 8px;
  height: 100%;
}

.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: radial-gradient(
      circle at top left,
      rgba(209, 213, 219, 0.35),
      transparent
    ),
    linear-gradient(135deg, var(--panel-soft), #ffffff);
  padding: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform-origin: center;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out,
    border-color 120ms ease-out;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top right,
    rgba(248, 250, 252, 0.9),
    transparent 60%
  );
  opacity: 0.85;
  pointer-events: none;
}

.card-main {
  position: relative;
  z-index: 1;
  font-size: 12px;
  line-height: 1.3;
  color: #111827;
}

.card-tag {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--subtle);
}

.card-tag-pill {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 1);
  background: #ffffff;
}

.card-time {
  opacity: 0.8;
}

.card-tone {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 244, 246, 1);
  box-shadow: 0 0 0 1px rgba(209, 213, 219, 0.9);
}

.card-tone-calm {
  background: linear-gradient(135deg, #16a34a, #bbf7d0);
}

.card-tone-bold {
  background: linear-gradient(135deg, #f97316, #fed7aa);
}

.card-tone-neutral {
  background: linear-gradient(135deg, #9ca3af, #e5e7eb);
}

/* Card animations */

.card-enter {
  animation: cardIn 180ms ease-out;
}

.card-pulse {
  animation: cardPulse 260ms ease-out;
}

@keyframes cardIn {
  from {
    transform: translateY(6px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes cardPulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

/* Info overlay */

.info-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  z-index: 40;
}

.info-overlay-visible {
  pointer-events: auto;
}

.info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity 160ms ease-out;
}

.info-sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(
      135deg,
      #ffffff,
      #fefce8
    );
  border-top: 1px solid rgba(250, 204, 21, 0.4);
  border-inline: 1px solid rgba(229, 231, 235, 0.9);
  box-shadow:
    0 -8px 24px rgba(15, 23, 42, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.9);
  transform: translateY(100%);
  transition: transform 200ms ease-out;
  padding: 14px 16px 12px;
}

.info-overlay-visible .info-backdrop {
  opacity: 1;
}

.info-overlay-visible .info-sheet {
  transform: translateY(0);
}

.info-sheet-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.info-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--subtle);
}

.info-close-btn {
  margin-top: 10px;
  width: 100%;
  border-radius: 999px;
  border: none;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(
    135deg,
    #fee2e2,
    #fef3c7
  );
  color: #b91c1c;
  box-shadow: 0 4px 10px rgba(248, 113, 113, 0.25);
}

/* Responsive tweaks */

@media (max-width: 360px) {
  #app {
    padding-inline: 10px;
  }

  .panel-input {
    padding-inline: 10px;
  }

  .chips {
    display: none;
  }
}