:root {
  --p:#008b8b;
  --pd:#066;
  --pl:#20b2aa;
  --o:#e97540;
  --bg:#faf8f3;
  --ink:#2c2420;
  --mut:#5a534d;
  --bd:#e8e3da;
  --ser:'Crimson Text',Georgia,serif;
  --sans:'Work Sans',sans-serif
}

* {
  box-sizing:border-box
}

body {
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font:16px/1.55 var(--sans)
}

button,input {
  font:inherit
}

header {
  position:sticky;
  top:0;
  z-index:20;
  background:linear-gradient(135deg,var(--p),var(--pd));
  color:#fff;
  box-shadow:0 6px 16px #0002
}

.head {
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:2rem;
  align-items:center;
  padding:1rem 2rem
}

.brand b {
  display:block;
  font:700 1.55rem var(--ser)
}

.brand small {
  font-style:italic;
  opacity:.85
}

.search {
  display:flex;
  background:#fff;
  border-radius:12px;
  overflow:hidden
}

.search input {
  flex:1;
  border:0;
  outline:0;
  padding:1rem 1.2rem
}

.search button {
  border:0;
  background:var(--o);
  color:#fff;
  padding:0 1.4rem
}

.signin {
  border:0;
  background:none;
  color:#fff;
  font-weight:600
}

.hero,main {
  width:min(1600px,calc(100% - 4rem));
  margin:auto
}

.hero {
  margin-top:2rem;
  margin-bottom:1.25rem;
  padding:1.7rem 2rem;
  background:#fff;
  border:1px solid var(--bd);
  border-radius:16px;
  box-shadow:0 4px 10px #0001;
  display:flex;
  justify-content:space-between;
  gap:2rem;
  align-items:end
}

.hero span {
  font-size:.75rem;
  font-weight:700;
  letter-spacing:.14em;
  color:var(--p)
}

.hero h1 {
  margin:.1rem 0;
  font:700 2.5rem var(--ser)
}

.hero p {
  max-width:760px;
  color:var(--mut)
}

.create {
  border:0;
  border-radius:8px;
  background:var(--o);
  color:#fff;
  padding:.9rem 1.15rem;
  font-weight:700;
  white-space:nowrap
}

.bar {
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  border-bottom:2px solid var(--bd);
  padding-bottom:1rem;
  margin-bottom:1.5rem
}

.bar h2 {
  margin:0;
  color:var(--p);
  font:700 2rem var(--ser)
}

nav {
  grid-column:2;
  display:flex;
  gap:clamp(1.3rem,3vw,4rem)
}

nav button {
  position:relative;
  border:0;
  background:none;
  color:var(--mut);
  font:600 1.45rem var(--ser);
  padding:.4rem 0
}

nav button.active {
  color:var(--pd)
}

nav button.active:after {
  content:'';
  position:absolute;
  left:0;
  right:0;
  bottom:-1.15rem;
  height:3px;
  background:var(--p)
}

.layout {
  display:grid;
  grid-template-columns:250px 1fr;
  gap:2rem
}

aside {
  position:sticky;
  top:100px;
  background:#fff;
  border:1px solid var(--bd);
  border-radius:12px;
  padding:1rem;
  max-height:calc(100vh - 125px);
  overflow:auto
}

.asideHead {
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid var(--bd)
}

.asideHead h3 {
  margin:.2rem .5rem;
  color:var(--p);
  font:600 1.5rem var(--ser)
}

#closeBrowse {
  display:none;
  border:0;
  background:none;
  font-size:1.8rem
}

.facet {
  width:100%;
  display:flex;
  justify-content:space-between;
  border:0;
  background:none;
  color:var(--mut);
  padding:.5rem .7rem;
  border-radius:8px;
  text-align:left
}

.facet.active,.facet:hover {
  background:#008b8b17;
  color:var(--pd)
}

details {
  border-top:1px solid var(--bd);
  margin-top:.5rem
}

summary {
  padding:.65rem .7rem;
  font-size:.88rem;
  font-weight:700
}

.count {
  font-size:.72rem;
  color:#8b8279
}

.grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:1.6rem
}

.card {
  overflow:hidden;
  background:#fff;
  border:1px solid var(--bd);
  border-radius:12px;
  box-shadow:0 4px 10px #0001;
  display:flex;
  flex-direction:column;
  transition:.25s
}

.card:hover {
  transform:translateY(-4px);
  border-color:var(--pl);
  box-shadow:0 16px 28px #0002
}

.card[data-character] {
  cursor:pointer
}

.portrait {
  aspect-ratio:1;
  background:linear-gradient(145deg,#eee7dc,#d4c8b8);
  display:grid;
  place-items:center
}

.portrait img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block
}

.portrait span {
  font:700 4rem var(--ser);
  color:#fff
}


/* ------------------ AUTHOR ACCOUNT / COMMERCE ------------------ */

.author-account-overlay {
  position:fixed;
  inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(0,0,0,.55);
}

.author-account-modal {
  width:min(520px,100%);
  max-height:90vh;
  overflow-y:auto;
  padding:30px;
  border:1px solid var(--bd);
  border-radius:14px;
  background:#fff;
  color:var(--ink);
  text-align:center;
  box-shadow:0 18px 50px #0004;
}

.author-account-modal h2 {
  margin:0 0 .65rem;
  color:var(--ink);
  font:700 2rem var(--ser);
}

.author-account-modal p {
  margin:0 0 1.5rem;
  color:var(--mut);
  line-height:1.55;
}

.author-account-actions {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.7rem;
}

.author-account-actions button {
  min-height:48px;
  padding:.7rem .85rem;
  border:1px solid var(--p);
  border-radius:8px;
  background:#fff;
  color:var(--p);
  font-weight:700;
  cursor:pointer;
}

.author-account-actions button:hover {
  background:#008b8b0d;
}

.author-account-actions button:disabled {
  opacity:.55;
  cursor:default;
}

.author-account-actions button:last-child {
  grid-column:1/-1;
  border-color:var(--bd);
  color:var(--mut);
}

@media(max-width:600px) {
  .author-account-overlay {
    padding:12px;
  }

  .author-account-modal {
    padding:24px 18px;
  }

  .author-account-actions {
    grid-template-columns:1fr;
  }

  .author-account-actions button:last-child {
    grid-column:auto;
  }
}


.character-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
}

.character-chat-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 14px;
  background: #fff;
  text-align: center;
}

.character-chat-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 32px;
  cursor: pointer;
}

.character-chat-modal h2 {
  margin: 0 35px 4px;
}

.character-chat-title {
  margin-bottom: 22px;
  font-style: italic;
}

.character-chat-cast {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.character-chat-choice {
  overflow: hidden;
  padding: 0 0 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.character-chat-portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.character-chat-name {
  display: block;
  padding: 14px 12px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

@media (max-width: 520px) {
  .character-chat-modal {
    padding: 22px 14px;
  }

  .character-chat-cast {
    gap: 10px;
  }

  .character-chat-name {
    font-size: 0.95rem;
  }
}

.character-chat-conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 42%);
  gap: 20px;
  min-height: 430px;
}

.character-chat-conversation {
  min-height: 350px;
  max-height: 520px;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid #ddd;
  border-radius: 10px;
  text-align: left;
}

.character-chat-media {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.character-chat-conversation-portrait {
  display: block;
  width: 100%;
  border-radius: 10px;
}

.character-chat-mic {
  min-height: 54px;
  border: 0;
  border-radius: 9px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.character-chat-mic-active {
  transform: scale(0.98);
}

.character-chat-turn {
  margin-bottom: 16px;
  line-height: 1.45;
}

.character-chat-user {
  padding-right: 12px;
}

.character-chat-character {
  padding-left: 12px;
}

@media (max-width: 600px) {
  .character-chat-overlay {
    padding: 0;
    align-items: stretch;
  }

  .character-chat-modal {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    overflow: hidden;
  }

  .character-chat-conversation-layout {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .character-chat-conversation {
    display: none;
  }

  .character-chat-media {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .character-chat-conversation-portrait {
    flex: 0 1 auto;
    width: 100%;
    max-height: calc(100dvh - 170px);
    object-fit: contain;
  }

  .character-chat-mic {
    flex: 0 0 auto;
    margin-top: 4px;
  }
}

.body {
  padding:1.15rem;
  display:flex;
  flex-direction:column;
  gap:.45rem;
  flex:1
}

.kicker {
  font-size:.68rem;
  letter-spacing:.11em;
  color:var(--p);
  font-weight:700
}

.body h3 {
  margin:0;
  font:700 1.45rem var(--ser)
}

.source {
  font-size:.8rem;
  color:var(--mut);
  font-style:italic
}

.desc {
  font-size:.86rem;
  color:var(--mut);
  line-height:1.5;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:5;
  overflow:hidden;
  flex:1
}

.tags {
  display:flex;
  flex-wrap:wrap;
  gap:.3rem
}

.tag {
  background:var(--bg);
  color:#8b8279;
  font-size:.68rem;
  padding:.15rem .42rem;
  border-radius:99px
}

.actions {
  display:flex;
  gap:.45rem;
  border-top:1px solid var(--bd);
  padding-top:.75rem
}

.actions button {
  flex:1;
  border:1px solid var(--p);
  border-radius:8px;
  background:#fff;
  color:var(--p);
  padding:.55rem;
  font-weight:700
}

.actions button:last-child {
  background:var(--o);
  border-color:var(--o);
  color:#fff
}

button {
    transition:
        transform 0.20s ease,
        opacity 0.15s ease;
}

button.feral-pressed {
    transform: scale(0.96);
    opacity: 0.75;
}

.new {
  min-height:410px;
  border:2px dashed #d5cfc4;
  background:#fff8;
  display:grid;
  place-items:center;
  text-align:center;
  padding:2rem
}

.new .plus {
  font-size:3.5rem;
  color:var(--o)
}

.new h3 {
  font:700 1.6rem var(--ser)
}

.new p,.empty {
  color:var(--mut)
}

.empty {
  grid-column:1/-1;
  text-align:center;
  padding:4rem
}

.empty h3 {
  font:700 1.8rem var(--ser);
  color:var(--ink)
}

.mobile,#backdrop {
  display:none
}

footer {
  margin-top:3rem;
  padding:2rem;
  text-align:center;
  background:var(--ink);
  color:#8b8279
}

@media(max-width:1150px) {
  .grid {
    grid-template-columns:repeat(3,1fr)
  }

  nav {
    gap:1.2rem
  }

}

@media(max-width:900px) {
  .head {
    grid-template-columns:1fr auto
  }

  .search {
    grid-column:1/-1
  }

  .hero,main {
    width:calc(100% - 2rem)
  }

  .hero {
    flex-direction:column;
    align-items:flex-start
  }

  .bar {
    display:block
  }

  nav {
    overflow:auto;
    margin-top:1rem
  }

  .layout {
    display:block
  }

  .mobile {
    display:inline-block
  }

  .grid {
    grid-template-columns:repeat(2,1fr)
  }

  aside {
    position:fixed;
    z-index:40;
    inset:0 auto 0 0;
    width:min(86vw,320px);
    max-height:none;
    border-radius:0 12px 12px 0;
    transform:translateX(-105%);
    transition:.25s
  }

  aside.open {
    transform:none
  }

  #closeBrowse {
    display:block
  }

  #backdrop.open {
    display:block;
    position:fixed;
    z-index:30;
    inset:0;
    border:0;
    background:#2c242077
  }

}

@media(max-width:600px) {
  .hero {
    padding:1.2rem
  }

  .hero h1 {
    font-size:2rem
  }

  .create {
    width:100%
  }

  .grid {
    grid-template-columns:1fr
  }

}

#tabs button.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 2px;

    opacity: 0.48;
    cursor: default;
}

#tabs button.coming-soon span {
    line-height: 1.05;
}

#tabs button.coming-soon small {
    font-family:
        "Work Sans",
        sans-serif;

    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.10em;

    white-space: nowrap;
}

#tabs button.coming-soon:disabled {
    color: inherit;
}
/* Places use landscape reference images; other card types stay square. */
.card[data-place] { cursor: pointer; }
.card .portrait.place-portrait { aspect-ratio: 16 / 9; }