@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --ink: #1a1a1a;
  --paper: #f5f1e8;
  --accent: #ff7a59;
  --accent-dark: #cc4e33;
  --shadow: rgba(24, 24, 24, 0.2);
  --panel: rgba(255, 255, 255, 0.85);
  --border: rgba(26, 26, 26, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #ffe8cc 0%, #f5f1e8 45%, #f2d9d0 100%);
  min-height: 100vh;
  padding-top: calc(70px + env(safe-area-inset-top, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overflow-x: hidden;
}

/* Site Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.site-header__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.site-header__icon {
  font-size: 1.5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.site-header__title {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header__nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-header__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.site-header__link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 20px;
}

.site-header__link:hover::before {
  opacity: 0.1;
}

.site-header__link:hover {
  transform: translateY(-2px);
  color: var(--accent-dark);
}

.site-header__link[data-page].active,
.site-header__link.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.3);
}

.site-header__link.active::before {
  opacity: 0;
}

.site-header__link-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.site-header__link-text {
  position: relative;
  z-index: 1;
}

@media (max-width: 720px) {
  body {
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
  }

  .site-header__container {
    padding: 10px 16px;
  }

  .site-header__brand {
    font-size: 1rem;
  }

  .site-header__icon {
    font-size: 1.2rem;
  }

  .site-header__link-text {
    display: none;
  }

  .site-header__link {
    padding: 10px 12px;
    font-size: 1.2rem;
    min-height: 44px;
    align-items: center;
  }

  .site-header__link-icon {
    font-size: 1.3rem;
  }

  .panel__button {
    min-height: 44px;
    padding: 12px 22px;
  }

  .character-edit-button,
  .character-chat-button {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* Site Footer */
.site-footer {
  margin-top: 80px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.05);
}

.site-footer__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

.site-footer__content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.site-footer__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.site-footer__icon {
  font-size: 1.3rem;
}

.site-footer__title {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-footer__description {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.7;
  line-height: 1.5;
}

.site-footer__heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

.site-footer__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer__link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.site-footer__link:hover {
  color: var(--accent);
  transform: translateX(4px);
}

.site-footer__status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-footer__status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ccc;
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.site-footer__status-indicator.online {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.site-footer__status-indicator.offline {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.site-footer__status-text {
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.8;
}

.site-footer__bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer__copyright {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.6;
}

.site-footer__heart {
  color: var(--accent);
  animation: heartbeat 1.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(1.2);
  }
  20%, 40% {
    transform: scale(1.1);
  }
}

@media (max-width: 720px) {
  .site-footer__container {
    padding: 32px 18px 20px;
  }

  .site-footer__content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .site-footer__bottom {
    padding-top: 20px;
  }
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  gap: 28px;
}

.app__header {
  display: grid;
  gap: 10px;
}

.app__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-dark);
}

.app__title {
  margin: 0;
  font-size: clamp(2.2rem, 3.5vw, 3.2rem);
}

.app__subtitle {
  margin: 0;
  font-size: 1.05rem;
  max-width: 640px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 36px var(--shadow);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 16px;
}

.panel--output {
  gap: 12px;
}

.panel--feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel--feed-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 24px;
}

.panel__label {
  font-weight: 600;
  font-size: 0.95rem;
}

.panel__input,
.panel__textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.7);
}

.panel__textarea {
  resize: vertical;
}

.panel__button {
  justify-self: start;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(255, 122, 89, 0.4);
}

.panel__button:hover {
  transform: translateY(-2px);
}

.panel__button--ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
  box-shadow: none;
}

.panel__output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel__title {
  margin: 0;
  font-size: 1.1rem;
}

.panel__output {
  margin: 0;
  min-height: 160px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", "Courier New", monospace;
  white-space: pre-wrap;
}

.characters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.characters-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.characters-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: rgba(26, 26, 26, 0.6);
}

.characters-name {
  margin: 0;
  font-size: 1.4rem;
}

.characters-email {
  margin: 0;
  color: rgba(26, 26, 26, 0.7);
}

.characters-status {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(26, 26, 26, 0.1);
  color: rgba(26, 26, 26, 0.8);
}

.characters-status[data-status="active"] {
  background: rgba(91, 187, 123, 0.2);
  color: #2f7a4d;
}

.characters-status[data-status="offline"] {
  background: rgba(204, 78, 51, 0.2);
  color: #a33b26;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.character-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.character-name {
  margin: 0;
  font-size: 1.1rem;
}

.character-bio {
  margin: 0;
  color: rgba(26, 26, 26, 0.75);
}

.character-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.character-trait {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 122, 89, 0.2);
  color: var(--accent-dark);
}

.character-meta {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(26, 26, 26, 0.5);
}

.character-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.character-edit-button,
.character-chat-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.character-edit-button {
  background: rgba(26, 26, 26, 0.05);
  color: var(--ink);
}

.character-edit-button:hover {
  transform: translateY(-2px);
  background: rgba(26, 26, 26, 0.1);
}

.character-chat-button {
  background: rgba(255, 122, 89, 0.15);
  color: var(--accent-dark);
}

.character-chat-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 122, 89, 0.25);
}

.character-empty {
  padding: 30px;
  text-align: center;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: rgba(26, 26, 26, 0.7);
}

.chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
}

.chat-meta__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
  color: rgba(26, 26, 26, 0.55);
}

.chat-meta__value {
  font-weight: 600;
  color: rgba(26, 26, 26, 0.85);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat Interface Styles */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 500px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 36px var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--accent-dark);
  opacity: 0.7;
  font-size: 1.1rem;
}

.chat-message {
  display: flex;
  max-width: 75%;
  animation: fadeIn 0.3s ease;
}

.chat-message--user {
  align-self: flex-end;
  margin-left: auto;
}

.chat-message--assistant {
  align-self: flex-start;
}

.chat-message-content {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-message--user .chat-message-content {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message--assistant .chat-message-content {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Read Status Indicators */
.chat-message-status {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  margin-left: 8px;
  font-size: 0.75rem;
}

.chat-message-status-icon {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.7;
}

.chat-message-status-icon--sent {
  color: rgba(255, 255, 255, 0.6);
}

.chat-message-status-icon--delivered {
  color: rgba(255, 255, 255, 0.8);
}

.chat-message-status-icon--read {
  color: #4fc3f7;
}

/* Away Status */
.chat-subtitle--away {
  color: #999;
  font-style: italic;
}

/* Diagnostics Panel */
.chat-diagnostics {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.chat-diagnostics__toggle {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.2s ease;
}

.chat-diagnostics__toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chat-diagnostics__toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.chat-diagnostics__content {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.4);
}

.chat-diagnostics__section {
  margin-bottom: 16px;
}

.chat-diagnostics__section:last-child {
  margin-bottom: 0;
}

.chat-diagnostics__heading {
  margin: 0 0 8px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-diagnostics__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-diagnostics__row:last-child {
  border-bottom: none;
}

.chat-diagnostics__label {
  font-weight: 500;
  color: var(--ink);
  opacity: 0.7;
}

.chat-diagnostics__value {
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
}

.chat-diagnostics__row--control {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-diagnostics__switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.chat-diagnostics__switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.chat-diagnostics__switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.chat-diagnostics__switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.chat-diagnostics__switch input:checked + .chat-diagnostics__switch-slider {
  background-color: var(--accent);
}

.chat-diagnostics__switch input:checked + .chat-diagnostics__switch-slider:before {
  transform: translateX(20px);
}

.chat-diagnostics__button {
  width: 100%;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-diagnostics__button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.chat-diagnostics__button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-message--error .chat-message-content {
  background: #fee;
  color: #c33;
  border-color: #fcc;
}

.chat-loading {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-dark);
  animation: bounce 1.4s infinite ease-in-out both;
}

.chat-loading span:nth-child(1) {
  animation-delay: -0.32s;
}

.chat-loading span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Container for multiple images - displays side by side */
.chat-message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chat-message-images .chat-message-image {
  margin-top: 0;
  flex: 1 1 calc(33.333% - 6px);
  min-width: 120px;
  max-width: 200px;
}

.chat-message-image {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  max-width: 300px;
}

.chat-message-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-message-image img:hover {
  transform: scale(1.02);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-input-container {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.5);
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.1);
}

.chat-send-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.4);
  flex-shrink: 0;
}

.chat-send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 122, 89, 0.5);
}

.chat-send-button:active:not(:disabled) {
  transform: translateY(0);
}

.chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.chat-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.chat-clear-button {
  border: none;
  background: transparent;
  color: var(--accent-dark);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.chat-clear-button:hover {
  background: rgba(255, 122, 89, 0.1);
}

.chat-media-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-media-button:hover:not(:disabled) {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-media-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-media-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Media Drawer */
.media-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-drawer[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
}

.media-drawer.is-open,
.media-drawer[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.media-drawer__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.media-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.media-drawer.is-open .media-drawer__panel {
  transform: translateX(0);
}

.media-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.media-drawer__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.media-drawer__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.media-drawer__close:hover {
  background: rgba(26, 26, 26, 0.1);
  transform: rotate(90deg);
}

.media-drawer__content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.media-drawer__empty {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.95rem;
}

.media-drawer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.media-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.media-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--accent);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 1;
}

.media-thumb__label {
  padding: 8px;
  font-size: 0.7rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

/* Media Lightbox */
.media-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-lightbox[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
}

.media-lightbox.is-open,
.media-lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.media-lightbox__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.media-lightbox__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.media-lightbox__image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.media-lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.media-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.media-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.media-lightbox__nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.media-lightbox__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.media-lightbox__nav--prev {
  left: 20px;
}

.media-lightbox__nav--next {
  right: 20px;
}

/* Scrollbar styling for media drawer */
.media-drawer__content::-webkit-scrollbar {
  width: 8px;
}

.media-drawer__content::-webkit-scrollbar-track {
  background: transparent;
}

.media-drawer__content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.media-drawer__content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

@media (max-width: 720px) {
  .media-drawer__panel {
    max-width: 100%;
  }

  .media-drawer__grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
  }

  .media-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .media-lightbox__nav--prev {
    left: 10px;
  }

  .media-lightbox__nav--next {
    right: 10px;
  }

  .media-lightbox__close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

/* Image Generation Styles */
.image-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.image-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-output {
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  border: 1px solid var(--border);
  min-height: 200px;
}

.image-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  color: var(--accent-dark);
}

.image-loading p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.8;
}

.image-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.generated-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
  border: 1px solid var(--border);
}

.image-info {
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

.image-info p {
  margin: 8px 0;
  word-break: break-all;
}

.image-info a {
  color: var(--accent);
  text-decoration: none;
}

.image-info a:hover {
  text-decoration: underline;
}

.image-error {
  padding: 20px;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 12px;
  color: #c33;
}

.image-error p {
  margin: 8px 0;
}

/* Video Stories */
.panel--video-stories-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-stories-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.video-stories-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.video-stories-control__label {
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.85;
}

.video-stories-control__input {
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.video-stories-status {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.video-stories-result .panel__title {
  margin-top: 0;
}

.video-stories-player-wrap {
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
}

.video-stories-player {
  width: 100%;
  max-width: 720px;
  display: block;
}

.video-stories-meta {
  margin: 8px 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

@media (max-width: 720px) {
  .app {
    padding: 32px 18px 60px;
  }

  .panel {
    padding: 18px;
  }

  .chat-container {
    height: calc(100vh - 240px);
    min-height: 400px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-message {
    max-width: 85%;
  }

  .chat-input-container {
    padding: 12px 16px;
  }

  .image-form-grid {
    grid-template-columns: 1fr;
  }

  .video-stories-control__input {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 32px 12px 60px;
  }

  .panel {
    padding: 16px;
  }

  .site-header__container {
    padding: 8px 12px;
  }

  .site-header__nav {
    gap: 4px;
  }

  .feed-sidebar {
    position: relative;
    top: 0;
  }

  .characters-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .character-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .feed-card__image {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .chat-message-image,
  .chat-message-images .chat-message-image {
    max-width: 100%;
  }

  .chat-meta__value {
    min-width: 0;
  }
}

/* Profile Edit Styles */
.app--wide {
  max-width: 1100px;
}

.profile-edit {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-edit[hidden] {
  display: none;
}

/* Cover Image */
.profile-edit__cover-wrapper {
  position: relative;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
}

.profile-edit__cover {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.3) 0%, rgba(255, 122, 89, 0.1) 50%, rgba(255, 200, 150, 0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.profile-edit__cover-placeholder {
  font-size: 1.2rem;
  color: var(--accent-dark);
  opacity: 0.6;
}

.profile-edit__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-edit__cover-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-edit__cover-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.profile-edit__cover-btn:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-edit__generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff9b80 100%);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  box-shadow: 0 2px 8px rgba(255, 122, 89, 0.3);
}

.profile-edit__generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 122, 89, 0.4);
}

.profile-edit__generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.profile-edit__generate-btn--small {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.profile-edit__generate-btn--loading {
  position: relative;
  color: transparent;
}

.profile-edit__generate-btn--loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.profile-edit__input--cover {
  padding: 8px 12px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  width: 200px;
}

/* Profile Header */
.profile-edit__header {
  display: flex;
  gap: 32px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 36px var(--shadow);
  backdrop-filter: blur(10px);
}

.profile-edit__header--with-cover {
  border-radius: 0 0 20px 20px;
  margin-top: -1px;
}

.profile-edit__avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.profile-edit__avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.2) 0%, rgba(255, 122, 89, 0.1) 100%);
  border: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(255, 122, 89, 0.2);
}

.profile-edit__avatar-placeholder {
  font-size: 48px;
  opacity: 0.5;
}

.profile-edit__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-edit__avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.profile-edit__avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.profile-edit__avatar-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.3);
}

.profile-edit__header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Grid Layout */
.profile-edit__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.profile-edit__column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */
.profile-edit__card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-edit__card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}

/* Form Fields */
.profile-edit__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-edit__field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-edit__label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}

.profile-edit__label--icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-edit__social-icon {
  font-size: 1.1rem;
}

.profile-edit__input,
.profile-edit__textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-edit__input:focus,
.profile-edit__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.1);
}

.profile-edit__input--small {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.profile-edit__input--large {
  font-size: 1.4rem;
  font-weight: 600;
  padding: 14px 16px;
}

.profile-edit__textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Traits/Tags */
.profile-edit__traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.profile-edit__trait-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.2) 0%, rgba(255, 122, 89, 0.1) 100%);
  color: var(--accent-dark);
  animation: fadeIn 0.2s ease;
}

.profile-edit__trait-text {
  line-height: 1;
}

.profile-edit__trait-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(26, 26, 26, 0.1);
  color: var(--accent-dark);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.profile-edit__trait-remove:hover {
  background: var(--accent-dark);
  color: white;
}

.profile-edit__trait-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

/* Buttons */
.profile-edit__btn {
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-edit__btn--secondary {
  background: rgba(26, 26, 26, 0.1);
  color: var(--ink);
}

.profile-edit__btn--secondary:hover {
  background: rgba(26, 26, 26, 0.15);
}

.profile-edit__actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--shadow);
}

.profile-edit__btn--cancel {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.profile-edit__btn--cancel:hover {
  background: rgba(26, 26, 26, 0.05);
}

.profile-edit__btn--save {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.3);
  padding: 12px 32px;
}

.profile-edit__btn--save:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 122, 89, 0.4);
}

.profile-edit__btn--save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error Message */
.profile-edit__error {
  padding: 16px 20px;
  border-radius: 12px;
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  font-size: 0.95rem;
  animation: fadeIn 0.2s ease;
  margin-bottom: 8px;
}

.profile-edit__error[hidden] {
  display: none;
}

.profile-edit__error-text {
  display: block;
}

/* Loading State */
.profile-edit__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
  color: var(--accent-dark);
  font-size: 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 14px 36px var(--shadow);
}

.profile-edit__loading[hidden] {
  display: none;
}

/* Responsive */
@media (max-width: 900px) {
  .profile-edit__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .profile-edit__cover {
    height: 150px;
  }

  .profile-edit__cover-actions {
    flex-direction: column;
    bottom: 8px;
    right: 8px;
  }

  .profile-edit__input--cover {
    width: 150px;
  }

  .profile-edit__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
  }

  .profile-edit__avatar {
    width: 120px;
    height: 120px;
  }

  .profile-edit__field-row {
    grid-template-columns: 1fr;
  }

  .profile-edit__actions {
    flex-direction: column-reverse;
  }

  .profile-edit__btn--cancel,
  .profile-edit__btn--save {
    width: 100%;
    text-align: center;
  }
}

/* ============================================================================
   LIFE UPDATES SECTION
   ============================================================================ */

.profile-life {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
}

.profile-life__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.profile-life__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

/* Status Card */
.profile-life__status-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px var(--shadow);
  border: 1px solid var(--border);
}

.profile-life__status-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--ink);
  opacity: 0.7;
}

.profile-life__status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.profile-life__status-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-life__status-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.profile-life__status-value {
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-word;
}

/* Posts Section */
.profile-life__posts {
  margin-top: 24px;
}

.profile-life__posts-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: var(--ink);
  opacity: 0.7;
}

.profile-life__posts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-life__posts-loading,
.profile-life__posts-empty {
  text-align: center;
  padding: 32px;
  color: var(--ink);
  opacity: 0.6;
  font-style: italic;
}

/* Post Card */
.profile-life__post-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px var(--shadow);
  border: 1px solid var(--border);
}

.profile-life__post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.profile-life__post-type {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.profile-life__post-time {
  color: var(--ink);
  opacity: 0.5;
}

.profile-life__post-content {
  margin: 0 0 16px 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
}

.profile-life__post-image {
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
}

.profile-life__post-image img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: cover;
}

/* Responsive */
@media (max-width: 720px) {
  .profile-life__header {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-life__status-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .profile-life__status-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   CREATE CHARACTER MODAL
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Ensure modal is hidden when hidden attribute is present */
.modal-overlay[hidden] {
  display: none !important;
}

.modal-overlay:not([hidden]) {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  padding: 4px 8px;
  line-height: 1;
}

.modal__close:hover {
  opacity: 1;
}

.modal__content {
  padding: 24px;
}

.modal__field {
  margin-bottom: 20px;
}

.modal__label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 8px;
}

.modal__textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  background: white;
  color: var(--ink);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.15);
}

.modal__textarea::placeholder {
  color: var(--ink);
  opacity: 0.4;
}

.modal__hint {
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0.6;
  margin: 8px 0 0 0;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 8px;
}

.modal__button {
  padding: 12px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.modal__button--cancel {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--border);
}

.modal__button--cancel:hover {
  background: rgba(0, 0, 0, 0.05);
}

.modal__button--create {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  min-width: 160px;
}

.modal__button--create:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 122, 89, 0.4);
}

.modal__button--create:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.modal__button-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal__button-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal__error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.9rem;
}

/* ============================================================================
   ADD CHARACTER CARD
   ============================================================================ */

.character-card--add {
  border: 2px dashed var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.character-card--add:hover {
  border-color: var(--accent);
  background: rgba(255, 122, 89, 0.05);
  transform: translateY(-4px);
}

.character-card__add-content {
  text-align: center;
  padding: 20px;
}

.character-card__add-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  font-size: 2rem;
  font-weight: 300;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.character-card--add:hover .character-card__add-icon {
  transform: scale(1.1) rotate(90deg);
}

.character-card__add-title {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.character-card__add-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.6;
}

/* Responsive modal */
@media (max-width: 540px) {
  .modal {
    margin: 10px;
    max-height: calc(100vh - 40px);
  }
  
  .modal__actions {
    flex-direction: column;
  }
  
  .modal__button {
    width: 100%;
  }
}

/* ============================================================================
   FEED PAGE STYLES
   ============================================================================ */

/* Feed Layout */
.feed-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .feed-layout {
    grid-template-columns: 1fr;
  }
  
  .feed-sidebar {
    order: 2;
  }
  
  .feed-main {
    order: 1;
  }
}

/* Feed Controls */
.feed-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.feed-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-control--meta {
  gap: 12px;
}

.feed-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.feed-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.feed-count {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-dark);
}

.feed-total {
  font-size: 0.85rem;
  color: rgba(26, 26, 26, 0.6);
}

.feed-status {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(26, 26, 26, 0.7);
}

/* Feed Sidebar */
.feed-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 36px var(--shadow);
  backdrop-filter: blur(10px);
  height: fit-content;
  position: sticky;
  top: 90px;
}

.feed-sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.feed-sidebar__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.feed-sidebar__count {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.feed-sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-character {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.feed-character:hover {
  background: rgba(255, 122, 89, 0.1);
}

.feed-character__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.2) 0%, rgba(255, 122, 89, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-dark);
  flex-shrink: 0;
  overflow: hidden;
}

.feed-character__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-character__info {
  flex: 1;
  min-width: 0;
}

.feed-character__name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-character__bio {
  font-size: 0.75rem;
  color: rgba(26, 26, 26, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Feed Main */
.feed-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(26, 26, 26, 0.6);
  font-size: 1rem;
}

/* Feed Card */
.feed-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.feed-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feed-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.2) 0%, rgba(255, 122, 89, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-dark);
  flex-shrink: 0;
  overflow: hidden;
}

.feed-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-card__heading {
  flex: 1;
  min-width: 0;
}

.feed-card__name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.feed-card__meta {
  font-size: 0.8rem;
  color: rgba(26, 26, 26, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-card__content {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  word-wrap: break-word;
}

.feed-card__image {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.2s ease;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.feed-card__image:hover {
  transform: scale(1.02);
}

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

/* Feed Load More Button */
.feed-load-more {
  width: 100%;
  justify-self: center;
  margin-top: 8px;
}

/* Feed Lightbox */
.feed-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feed-lightbox.is-open {
  display: flex;
  opacity: 1;
}

.feed-lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-lightbox__image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.feed-lightbox__close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.feed-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

@media (max-width: 720px) {
  .feed-card {
    padding: 18px;
  }
  
  .feed-card__image {
    width: 150px;
    height: 150px;
  }
  
  .feed-lightbox__close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }
}

/* Feed Card Pills (used by checkins) */
.feed-card__pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  background: rgba(91, 187, 123, 0.2);
  color: #2f7a4d;
}

.feed-card__pill--ghost {
  background: rgba(26, 26, 26, 0.1);
  color: rgba(26, 26, 26, 0.7);
}

/* ============================================================================
   CHECK-IN HISTORY STYLES
   ============================================================================ */

/* Check-in List Container */
.checkin-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Check-in Card */
.checkin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px var(--shadow);
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Check-in Card Header */
.checkin-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.checkin-card__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
}

.checkin-card__timestamp {
  font-size: 0.85rem;
  color: rgba(26, 26, 26, 0.6);
  white-space: nowrap;
}

/* Check-in Card Meta (badges) */
.checkin-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Check-in Card Body */
.checkin-card__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Check-in Status Grid */
.checkin-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.checkin-status__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkin-status__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.checkin-status__value {
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.4;
}

/* Check-in Card Empty State */
.checkin-card__empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.9rem;
  font-style: italic;
}

/* Check-in Card Error */
.checkin-card__error {
  margin: 0;
  padding: 12px 16px;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  color: #c33;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Responsive Check-in Styles */
@media (max-width: 720px) {
  .checkin-card {
    padding: 18px;
  }

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

  .checkin-status {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
}
