:root {
  --paper: #f4ead8;
  --paper-dark: #e8d7b8;
  --ink: #2a2118;
  --ink-soft: #5c4d3d;
  --rule: #d7c4a3;
  --leather: #6b2d1a;
  --leather-dark: #4a1c10;
  --gold: #c4a35a;
  --ok: #2f6b3a;
  --warn: #a15c12;
  --bad: #9b2c2c;
  --white: #fffaf2;
  --shadow: 0 18px 50px rgba(42, 33, 24, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Serif 4", "Georgia", "Noto Serif", serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #3d2418 0%, transparent 50%),
    linear-gradient(165deg, #2b1a14 0%, #1a100c 55%, #120c09 100%);
  color: var(--ink);
  min-height: 100dvh;
}

.app { max-width: 760px; margin: 0 auto; padding: 18px 14px 40px; }

.book {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  min-height: calc(100dvh - 36px);
}
.book::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 14px;
  background: linear-gradient(90deg, var(--leather-dark), var(--leather) 55%, #8a3d24);
}
.book-inner { padding: 22px 18px 28px 30px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.seal {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--leather);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
h1 { font-size: 1.65rem; margin: 0; line-height: 1.2; }
.sub { color: var(--ink-soft); margin: 6px 0 0; font-size: 1.02rem; }

.screen { display: none; }
.screen.on { display: block; animation: rise 0.28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero-actions { display: grid; gap: 12px; margin-top: 28px; }
button, .btn {
  font-family: inherit;
  font-size: 1.08rem;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  width: 100%;
}
.btn-main {
  background: var(--leather);
  color: #fff8ee;
  font-weight: 700;
}
.btn-main:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  border: 2px solid var(--leather);
  color: var(--leather);
  font-weight: 700;
}
.btn-ok { background: var(--ok); color: #fff; font-weight: 700; }
.btn-bad { background: var(--bad); color: #fff; font-weight: 700; }
.btn-small { width: auto; padding: 8px 12px; font-size: 0.95rem; }
.btn:disabled, button:disabled { opacity: 0.55; cursor: not-allowed; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 14px 0 6px;
}
input, textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  padding: 12px 12px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 3px solid #e2c48a; border-color: var(--gold); }

.hint { font-size: 0.92rem; color: var(--ink-soft); margin-top: 6px; }
.warn {
  background: #f7e3c4;
  border-left: 4px solid var(--warn);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 0.98rem;
}
.okbox {
  background: #dcecdd;
  border-left: 4px solid var(--ok);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 12px 0;
}
.err {
  color: var(--bad);
  background: #f8e4e1;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 12px 0;
  display: none;
}
.err.on { display: block; }

.meter { height: 8px; background: #ddd2bd; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--bad); transition: 0.2s; }
.meter.ok > i { background: var(--warn); }
.meter.strong > i { background: var(--ok); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.topbar h2 { margin: 0; font-size: 1.25rem; }
.search { margin: 0 0 12px; }

.list { display: grid; gap: 10px; }
.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.card h3 { margin: 0 0 3px; font-size: 1.12rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; word-break: break-all; }
.empty {
  text-align: center;
  padding: 36px 10px;
  color: var(--ink-soft);
}

.field {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}
.field .k { font-size: 0.82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.field .v {
  font-size: 1.12rem;
  margin-top: 4px;
  word-break: break-word;
  font-family: "Source Code Pro", ui-monospace, monospace;
}
.secret { letter-spacing: 0.18em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 20;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.status {
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-align: right;
  min-height: 1.2em;
}
.fab-wrap { margin-top: 18px; }

.pw-wrap { position: relative; }
.pw-wrap button.eye {
  position: absolute;
  right: 6px;
  top: 6px;
  width: auto;
  padding: 6px 10px;
  background: var(--paper-dark);
  font-size: 0.85rem;
}

@media (min-width: 640px) {
  .book-inner { padding: 36px 40px 40px 48px; }
  h1 { font-size: 2rem; }
}
