:root {
  --accent: #d2afbb;
  --trim: #410d1f;
  --background: #3306c6;
  --text: #f0e3e3;
  --header-h: 56px;
  --footer-h: 44px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #ffffff;
  color: #111;
  font-family: Verdana, Geneva, sans-serif;
  overflow: hidden;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-h);
  background: var(--accent);
  border-bottom: 3px solid var(--trim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--background);
  text-shadow: 1px 1px 0 var(--text);
  white-space: nowrap;
}
header h1 a {
  color: inherit;
  text-decoration: none;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  position: relative;
  background: var(--background);
  color: var(--text);
  padding: 26px 22px 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 320px;
  border: 3px solid var(--trim);
}
.modal h2 {
  margin: 0 0 16px;
  text-align: center;
  color: var(--accent);
}
.modal input {
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--trim);
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
}
.caption-input {
  width: 100%;
  min-height: 20px;
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--trim);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  color: var(--text);
  outline: none;
  word-break: break-word;
}
.caption-input:focus {
  border-color: var(--accent);
}
.caption-input:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}
.hashtag-token {
  color: var(--accent);
  font-weight: 700;
}
.hashtag-link {
  text-decoration: none;
  white-space: nowrap;
}
.modal button.submit,
.profile-page button.submit {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: var(--background);
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.modal button.submit:disabled,
.profile-page button.submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.modal .switch {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
}
.modal .switch a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}
.modal .error {
  color: #9b2f2f;
  font-size: 13px;
  margin-bottom: 10px;
  text-align: center;
  display: none;
}
.modal .close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}
.profile-avatar {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  background: var(--trim);
  border: 3px solid var(--trim);
}
.profile-avatar-placeholder {
  background: var(--trim);
}
.profile-name {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 4px;
}
.profile-username {
  text-align: center;
  font-size: 13px;
  color: var(--text);
  margin: 0 0 8px;
}
.profile-bio {
  text-align: center;
  font-size: 14px;
  color: var(--text);
  margin: 0 0 16px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.profile-meta {
  text-align: center;
  font-size: 13px;
  margin: 0 0 16px;
  color: var(--text);
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.profile-grid a {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  background: var(--trim);
}
.profile-grid .tile {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.grid-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  background: var(--trim);
}
.grid-tile a {
  display: block;
  width: 100%;
  height: 100%;
}
.tile-action {
  position: absolute;
  top: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tile-edit {
  right: 32px;
}
.tile-delete {
  right: 4px;
}
.status-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  z-index: 1;
}
.status-not_yet {
  background: rgba(165, 124, 94, 0.9);
}
.status-no {
  background: rgba(155, 47, 47, 0.9);
}
.status-reported {
  background: rgba(90, 30, 30, 0.9);
}
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-h);
  background: var(--trim);
  border-top: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 20;
}
#accountArea, #footerLinks {
  display: contents;
}
.footer-link {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
#feed {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100 - var(--header-h) - var(--footer-h));
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overflow-anchor: none;
  background: var(--background);
}
.card {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100 - var(--header-h) - var(--footer-h));
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--background);
}
.media {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.like-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}
.like-btn .like-count {
  font-size: 11px;
  font-weight: 700;
}
.like-btn.liked {
  color: var(--accent);
}
.comment-btn {
  position: absolute;
  right: 14px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}
.comment-btn .comment-count {
  font-size: 11px;
  font-weight: 700;
}
.comment-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--trim);
  font-size: 14px;
  text-align: left;
}
.comment-item .comment-owner {
  font-weight: 700;
  color: var(--accent);
}
.comment-item .comment-delete {
  float: right;
  background: none;
  border: none;
  color: var(--danger, #ff5252);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
#commentsList {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.view-count-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.card-owner-btn {
  position: absolute;
  top: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.card-edit-btn {
  right: 58px;
}
.card-delete-btn {
  right: 14px;
}
.report-btn {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
}
.review-card {
  position: relative;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--trim);
}
.review-card .media {
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.review-card .media img,
.review-card .media video {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}
.review-card .caption {
  max-height: none;
}
.card img, .card video {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}
.caption {
  flex-shrink: 0;
  min-height: 42px;
  max-height: 40%;
  overflow-y: auto;
  padding: 10px 16px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  overflow-wrap: break-word;
}
.caption-owner {
  white-space: nowrap;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
#status {
  position: fixed;
  bottom: calc(var(--footer-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  color: #aaa;
  font-size: 13px;
  z-index: 10;
  pointer-events: none;
}
.profile-page {
  position: fixed;
  top: var(--header-h);
  bottom: var(--footer-h);
  left: 0;
  width: 100%;
  overflow-y: auto;
  background: var(--background);
  color: var(--text);
  padding: 24px 16px;
  box-sizing: border-box;
}
.profile-login-prompt {
  text-align: center;
  color: var(--text);
  margin-top: 60px;
}
