﻿body {
  font-family: var(--font-primary);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -20%,
      rgba(255, 0, 122, 0.12),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 100% 100%,
      rgba(255, 77, 166, 0.06),
      transparent
    );
  pointer-events: none;
  z-index: -1;
}

.post-container {
  width: 100%;
  max-width: 680px;
  background: rgba(22, 22, 31, 0.6);
  border: 1px solid rgba(255, 0, 122, 0.08);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.post-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 0, 122, 0.2),
    transparent
  );
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.post-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.close-btn:hover {
  color: var(--color-text-primary);
  border-color: rgba(255, 0, 122, 0.3);
  background: rgba(255, 0, 122, 0.05);
}

.form-group {
  margin-bottom: 1.5rem;
}
.form-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}
.form-input:focus {
  outline: none;
  border-color: rgba(255, 0, 122, 0.5);
  background: rgba(255, 0, 122, 0.03);
  box-shadow: 0 0 0 1px rgba(255, 0, 122, 0.15);
}
.form-input::placeholder {
  color: var(--color-text-muted);
}
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a6a7a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}
textarea.form-input {
  min-height: 240px;
  resize: vertical;
  line-height: 1.6;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  position: relative;
  overflow: hidden;
}
.btn-cancel {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-cancel:hover {
  background: var(--color-bg-card-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-hover);
}
.btn-submit {
  background: linear-gradient(
    135deg,
    rgba(255, 0, 122, 0.9),
    rgba(255, 77, 166, 0.9)
  );
  color: #fff;
  border: 1px solid rgba(255, 0, 122, 0.4);
  box-shadow: 0 0 20px rgba(255, 0, 122, 0.2);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-submit:hover {
  box-shadow:
    0 0 25px rgba(255, 0, 122, 0.3),
    0 0 60px rgba(255, 0, 122, 0.1);
  border-color: rgba(255, 0, 122, 0.6);
}
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: none;
}
.msg.error {
  display: block;
  background: rgba(255, 61, 113, 0.1);
  border: 1px solid rgba(255, 61, 113, 0.2);
  color: var(--color-error);
}
.msg.success {
  display: block;
  background: rgba(0, 214, 143, 0.1);
  border: 1px solid rgba(0, 214, 143, 0.2);
  color: var(--color-success);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.category-chip {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  font-family: var(--font-display);
}
.category-chip:hover {
  border-color: rgba(255, 0, 122, 0.2);
  color: var(--color-text-primary);
}
.category-chip.active {
  background: rgba(255, 0, 122, 0.08);
  border-color: rgba(255, 0, 122, 0.3);
  color: var(--color-accent-primary);
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.media-upload-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}
.media-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.media-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}
.media-preview-item img,
.media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-preview-item .media-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.media-preview-item .media-remove:hover {
  background: rgba(255, 0, 122, 0.8);
}
.media-preview-item .media-type-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.5rem;
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}
.media-add-btn {
  width: 80px;
  height: 80px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-add-btn:hover {
  border-color: rgba(255, 0, 122, 0.3);
  color: var(--color-accent-primary);
  background: rgba(255, 0, 122, 0.03);
}
.media-add-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.media-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 0, 122, 0.2);
  background: rgba(255, 0, 122, 0.05);
  font-size: 0.65rem;
  color: var(--color-accent-primary);
}

@media (max-width: 640px) {
  body {
    padding: 1rem;
  }
  .post-container {
    padding: 1.5rem;
  }
  .post-header h1 {
    font-size: 1.25rem;
  }
  textarea.form-input {
    min-height: 180px;
  }
}
.post-emoji-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  z-index: 5;
}
.post-emoji-btn:hover {
  border-color: var(--color-accent-secondary);
}
.post-emoji-picker {
  position: absolute;
  bottom: 40px;
  right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.2rem;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.post-emoji-picker button {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
}
.post-emoji-picker button:hover {
  background: var(--color-bg-tertiary);
}
.md-toolbar {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.5rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.md-toolbar button {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  line-height: 1.2;
}
.md-toolbar button:hover {
  background: var(--color-accent-secondary);
  color: #fff;
  border-color: var(--color-accent-secondary);
}
.md-mode-tabs + .md-toolbar {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.md-toolbar + textarea.form-input,
.md-toolbar + .md-preview {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.md-mode-tabs + .md-toolbar + textarea.form-input,
.md-mode-tabs + .md-toolbar + .md-preview {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.md-color-picker {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 240px;
}
.md-color-picker button {
  width: 26px;
  height: 26px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition-fast);
}
.md-color-picker button:hover {
  transform: scale(1.2);
  border-color: var(--color-text-primary);
}
.md-color-picker-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.md-color-picker-header button {
  width: auto;
  height: auto;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
}
.md-color-picker-header button:hover {
  color: var(--color-accent-secondary);
  transform: none;
  border-color: transparent;
}
.md-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: -1px;
}
.md-mode-tab {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-bottom: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.md-mode-tab:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}
.md-mode-tab:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}
.md-mode-tab.active {
  background: var(--color-bg-card);
  color: var(--color-accent-secondary);
  border-bottom-color: var(--color-bg-card);
  position: relative;
  z-index: 1;
}
.md-preview {
  min-height: 240px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  line-height: 1.8;
  color: var(--color-text-secondary);
  word-break: break-word;
  overflow-y: auto;
  max-height: 500px;
}
.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4 {
  color: var(--color-text-primary);
  margin: 0.8em 0 0.4em;
}
.md-preview h1 {
  font-size: 1.4em;
}
.md-preview h2 {
  font-size: 1.2em;
}
.md-preview h3 {
  font-size: 1.1em;
}
.md-preview code {
  background: var(--color-bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--color-accent-secondary);
}
.md-preview pre {
  background: var(--color-bg-tertiary);
  padding: 0.8em 1em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.6em 0;
}
.md-preview pre code {
  background: none;
  padding: 0;
  color: var(--color-text-primary);
}
.md-preview blockquote {
  border-left: 3px solid var(--color-accent-secondary);
  margin: 0.6em 0;
  padding: 0.3em 1em;
  color: var(--color-text-muted);
}
.md-preview a {
  color: var(--color-accent-secondary);
  text-decoration: underline;
}
.md-preview ul,
.md-preview ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
}
.md-preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}
.md-preview hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1em 0;
}
.md-preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
}
.md-preview th,
.md-preview td {
  border: 1px solid var(--color-border);
  padding: 0.4em 0.8em;
  text-align: left;
}
.md-preview th {
  background: var(--color-bg-tertiary);
}
.md-preview span[style*="background"] {
  border-radius: 3px;
}