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

:root {
  --bg: #fff6f0;
  --card-bg: #ffffff;
  --accent: #ff7a3c;
  --accent-soft: #ffe1c9;
  --text-main: #3b2415;
  --text-muted: #a46b4b;
  --border-soft: #f0c6a6;
  --shadow-soft: 0 12px 36px rgba(196, 88, 34, 0.25);
  --radius-card: 22px;
  --radius-pill: 999px;
  --transition-fast: 150ms ease-out;
  --spacing: 14px;
  --font-sans: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at 10% 0, #fff3d9 0, #ffd0b4 35%, #ffb3a2 60%, #f68aa0 100%);
  font-family: var(--font-sans);
  color: var(--text-main);
}

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

#app {
  width: 100vw;
  height: 100vh;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alephi-card {
  width: 100%;
  max-width: 420px;
  max-height: 720px;
  min-height: 90vh;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
}

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

.alephi-logo {
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
}

.alephi-header-actions {
  display: flex;
  gap: 8px;
}

.alephi-icon-button {
  border: none;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 0 0 1px var(--border-soft);
  transition: background var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast), color var(--transition-fast);
}

.alephi-icon-button:active {
  transform: scale(0.93);
  background: #e8ddcd;
}

.alephi-main {
  flex: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

.alephi-question h1 {
  margin: 10px 0 4px;
  font-size: 20px;
  font-weight: 600;
}

.alephi-question p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-muted);
}

.alephi-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.alephi-primary,
.alephi-secondary,
.alephi-tertiary {
  font: inherit;
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  cursor: pointer;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast),
    color var(--transition-fast);
}

.alephi-primary {
  flex: 1.2;
  background: linear-gradient(135deg, #ff7a3c, #ff4f6a);
  color: #fffdf9;
  box-shadow: 0 8px 18px rgba(204, 73, 54, 0.45);
}

.alephi-primary:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 5px 12px rgba(204, 73, 54, 0.35);
}

.alephi-secondary {
  flex: 0.9;
  background: #ffe9d8;
  color: var(--text-main);
  box-shadow: 0 0 0 1px var(--border-soft);
}

.alephi-secondary.saved {
  background: #ffc76b;
  color: #5b320b;
}

.alephi-secondary:active {
  transform: translateY(1px) scale(0.97);
}

.alephi-tertiary {
  flex: 0;
  padding-inline: 10px;
  background: #ffe9f0;
  color: var(--text-main);
  box-shadow: 0 0 0 1px #f3b1cb;
}

.alephi-tertiary:active {
  transform: translateY(1px) scale(0.97);
}

.alephi-notes {
  margin-top: 6px;
}

.alephi-notes textarea {
  width: 100%;
  height: 100%;
  min-height: 120px;
  resize: none;
  border-radius: 14px;
  padding: 10px 11px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border-soft);
  background: #fff7f0;
  color: var(--text-main);
  outline: none;
  line-height: 1.35;
}

.alephi-notes textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 122, 60, 0.35);
  background: #fff1e2;
}



.alephi-bottom-bar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.alephi-indicator {
  min-width: 60px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Bottom sheet (about) */

.sheet {
  position: absolute;
  inset-inline: 14px;
  bottom: 10px;
  background: #fff3e8;
  border-radius: 18px;
  box-shadow: 0 -10px 30px rgba(215, 102, 76, 0.35);
  transform: translateY(110%);
  transition: transform 200ms ease-out;
  display: flex;
  flex-direction: column;
  padding: 10px 16px 14px;
}

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

.sheet.hidden {
  pointer-events: none;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #ffb58f;
  align-self: center;
  margin-bottom: 6px;
}

.sheet-content {
  font-size: 13px;
  color: var(--text-main);
}

.sheet-content h2 {
  margin: 4px 0 6px;
  font-size: 15px;
}

.sheet-content p {
  margin: 4px 0;
  line-height: 1.4;
  color: var(--text-muted);
}

.sheet-close {
  margin-top: 8px;
  width: 100%;
}

.replies-archive-list {
  max-height: 50vh;
  overflow-y: auto;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-item {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background var(--transition-fast);
}

.archive-item:active {
  background: var(--accent-soft);
}

.archive-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-main);
}

.archive-item-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile specific tweaks */
@media (max-width: 480px) {
  .alephi-card {
    max-height: 96vh;
  }
}