:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #d9dce3;
  --phone-bg: #0e1117;
  --header: #4166f5;
  --panel: #171b22;
  --panel-strong: #202632;
  --field: #2a3037;
  --field-focus: #323946;
  --text: #f6f7fb;
  --muted: #a6adbb;
  --soft: #d8dcec;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --blue: #4166f5;
  --blue-bright: #4166f5;
  --blue-soft: #4166f5;
  --danger: #ef4444;
  --success: #81d69a;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(65, 102, 245, 0.22), transparent 34%),
    var(--page-bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone-frame {
  position: relative;
  width: min(100%, 410px);
  height: min(860px, calc(100vh - 48px));
  min-height: 760px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 4px solid var(--blue-bright);
  border-radius: 44px;
  background: var(--phone-bg);
  box-shadow:
    0 28px 72px rgba(5, 10, 22, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 13px 42px 2px;
  background: var(--header);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.device-icons {
  font-size: 12px;
  color: #fffaf0;
  white-space: nowrap;
}

.top-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 74px;
  padding: 0 22px 12px;
  background: var(--header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.top-bar h1 {
  margin: 0;
  text-align: center;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 850;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-content: center;
  gap: 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button span {
  display: block;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.icon-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.phone-frame.is-locked {
  grid-template-rows: auto 1fr;
  background: #0e1117;
}

.phone-frame.is-locked .top-bar,
.phone-frame.is-locked .account-menu,
.phone-frame.is-locked .screen,
.phone-frame.is-locked .bottom-nav {
  display: none;
}

.auth-gate {
  display: none;
  align-content: center;
  gap: 26px;
  padding: 34px 28px 54px;
  background:
    linear-gradient(180deg, rgba(65, 102, 245, 0.28), rgba(14, 17, 23, 0) 34%),
    #0e1117;
}

.phone-frame.is-locked .auth-gate {
  display: grid;
}

.auth-logo {
  width: 118px;
  height: 118px;
  justify-self: center;
  border-radius: 28px;
  object-fit: cover;
  background: #050607;
}

.auth-copy {
  display: grid;
  gap: 10px;
  text-align: center;
}

.auth-copy h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
}

.account-menu {
  position: absolute;
  top: 112px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(23, 27, 34, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.account-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.account-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-menu-header strong {
  font-size: 20px;
  font-weight: 900;
}

.close-menu-button {
  width: 36px;
  height: 36px;
}

.close-menu-button svg {
  width: 24px;
  height: 24px;
}

.account-email {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  line-height: 1.35;
}

.screen {
  min-height: 0;
  display: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.screen.is-active {
  display: block;
}

.idea-form,
.detail-form {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px 26px 18px;
}

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

.field span {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: 0;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  outline: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

textarea {
  min-height: 166px;
  resize: vertical;
  padding: 14px;
  line-height: 1.45;
}

.hook-input,
#detailHook {
  min-height: 92px;
}

input,
select {
  height: 52px;
  padding: 0 14px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(65, 102, 245, 0.95);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px rgba(65, 102, 245, 0.18);
}

::placeholder {
  color: rgba(246, 247, 251, 0.42);
}

.form-actions,
.detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 50px;
  padding-top: 2px;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  min-width: 94px;
  min-height: 46px;
  padding: 0 18px;
  background: var(--blue);
  color: var(--text);
  font-size: 19px;
}

.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 0 14px;
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  color: #ffd8d8;
  border-color: rgba(239, 68, 68, 0.3);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.text-button:active,
.filter-chip:active,
.entry-main:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.save-status {
  min-height: 20px;
  margin: 0;
  color: var(--success);
  font-size: 14px;
  line-height: 1.25;
}

.search-panel {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  gap: 12px;
  padding: 18px 20px 14px;
  background:
    linear-gradient(180deg, rgba(14, 17, 23, 0.98), rgba(14, 17, 23, 0.92)),
    var(--phone-bg);
  border-bottom: 1px solid var(--line);
}

.search-field {
  min-height: 52px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
}

.search-field:focus-within {
  border-color: rgba(65, 102, 245, 0.9);
  box-shadow: 0 0 0 3px rgba(65, 102, 245, 0.16);
}

.search-field svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--blue-soft);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.search-field input {
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.filter-group {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-group.secondary {
  padding-top: 0;
}

.filter-chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--soft);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--blue);
  border-color: rgba(157, 183, 255, 0.65);
  color: white;
}

.hook-filter {
  color: var(--blue-soft);
}

.list-meta {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.text-button {
  min-height: 34px;
  padding: 0 8px;
  background: transparent;
  color: var(--blue-soft);
}

.text-button.danger {
  color: #ffb3b3;
}

.entry-list {
  display: grid;
  padding: 0 18px 20px;
}

.entry-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.entry-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 16px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.entry-main strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--text);
  font-size: 21px;
  line-height: 1.18;
  font-weight: 900;
}

.entry-main span {
  overflow: hidden;
  color: var(--soft);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-main small {
  color: var(--blue-soft);
  font-size: 12px;
  font-weight: 850;
}

.entry-main p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.entry-main .match-line {
  margin-top: 4px;
  color: #c9d6ff;
  font-size: 13px;
}

.entry-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.entry-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.trash-screen .entry-actions button {
  padding: 0 8px;
  background: var(--panel);
  color: var(--blue-soft);
  font-size: 12px;
}

.trash-screen .entry-actions button:last-child {
  color: #ffb3b3;
}

.empty-state {
  display: grid;
  gap: 6px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.entry-timestamp {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-panel {
  display: grid;
  gap: 22px;
  padding: 28px 24px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--blue);
  color: white;
  font-size: 32px;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.28);
}

.logo-mark {
  background:
    url("assets/hookvault-mark.png") center / 210% auto no-repeat,
    #050607;
}

.brand-lockup h2 {
  margin: 0;
  font-size: 26px;
}

.brand-lockup p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.beta-notice {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(65, 102, 245, 0.36);
  border-radius: 8px;
  background: rgba(65, 102, 245, 0.1);
}

.beta-notice span {
  width: max-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.beta-notice p {
  margin: 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.4;
}

.settings-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.settings-list div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-list dt {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 900;
}

.settings-list dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.backup-panel {
  display: grid;
  gap: 10px;
}

.auth-panel {
  display: grid;
  gap: 10px;
}

.auth-gate .auth-panel {
  width: 100%;
}

.auth-gate input {
  height: 58px;
  border-color: var(--line-strong);
  background: var(--field);
  color: var(--text);
}

.auth-gate input::placeholder {
  color: rgba(246, 247, 251, 0.5);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 76px;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 54px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(246, 247, 251, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.password-field button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.auth-gate .primary-button {
  background: var(--blue);
  color: white;
}

.auth-gate .secondary-button {
  background: var(--panel-strong);
  border-color: var(--line-strong);
  color: white;
}

.account-menu .secondary-button {
  width: 100%;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-actions .primary-button,
.auth-actions .secondary-button {
  flex: 1 1 120px;
}

.auth-reset-button {
  flex: 1 0 100%;
  min-height: 34px;
}

.auth-actions .is-hidden {
  display: none;
}

.backup-panel .primary-button {
  width: 100%;
}

.backup-panel .secondary-button {
  width: 100%;
}

.file-input {
  display: none;
}

.backup-panel p,
.auth-panel p {
  min-height: 20px;
  margin: 0;
  color: var(--success);
  font-size: 14px;
  line-height: 1.35;
}

.backup-panel p.is-error,
.auth-panel p.is-error {
  color: #ffb3b3;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 18px 22px;
  background: #10141b;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-item {
  min-width: 0;
  min-height: 68px;
  display: grid;
  place-items: center;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f4efe1;
  cursor: pointer;
}

.nav-item svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

.nav-item.active {
  color: var(--blue-soft);
}

@media (max-width: 460px) {
  .app-shell {
    display: block;
    min-height: 100svh;
    padding: 0;
    background: var(--phone-bg);
  }

  .phone-frame {
    width: 100%;
    height: 100svh;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .status-bar {
    padding-inline: 24px;
  }

  .top-bar {
    padding-inline: 18px;
  }

  .idea-form,
  .detail-form {
    padding-inline: 20px;
  }

  .field span {
    font-size: 21px;
  }

  .entry-main strong {
    font-size: 19px;
  }
}
