:root {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface-soft: #fbfaf8;
  --line: #ece7e1;
  --text: #171512;
  --muted: #827b72;
  --orange: #f47a20;
  --orange-deep: #df5f11;
  --blue: #236c9d;
  --shadow: 0 18px 50px rgba(25, 20, 14, 0.07);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 380px;
  gap: 24px;
  width: min(1520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 24px;
}

.sidebar,
.rightbar {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  align-self: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 4px 8px 16px;
  border-right: 1px solid var(--line);
}

.brand {
  width: fit-content;
  margin: 0 0 32px 4px;
  color: inherit;
  text-decoration: none;
}

.brand-main {
  display: block;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
}

.brand-main span {
  color: var(--orange);
}

.brand-sub {
  display: block;
  margin-top: 6px;
  color: #594b41;
  font-size: 13px;
  font-weight: 700;
}

.brand-sub::before,
.brand-sub::after {
  color: var(--orange);
  content: "―";
  padding: 0 8px;
}

.nav-list {
  display: grid;
  gap: 9px;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2d2823;
  text-align: left;
  font-weight: 760;
}

.nav-item .icon {
  color: #4a443e;
  font-size: 23px;
  line-height: 1;
  text-align: center;
}

.nav-item.active {
  background: var(--surface);
  color: var(--orange-deep);
  box-shadow: 0 8px 24px rgba(18, 12, 5, 0.04);
}

.nav-item.active .icon {
  color: var(--orange);
}

.primary-post {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 14px);
  min-height: 48px;
  margin: 26px 7px 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orange), #ff8b2e);
  color: white;
  font-weight: 850;
  box-shadow: 0 12px 28px rgba(244, 122, 32, 0.28);
}

.profile-mini {
  display: grid;
  grid-template-columns: 42px 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 0 0;
}

.profile-mini img,
.avatar,
.avatar-button img,
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-mini strong,
.profile-mini span {
  display: block;
}

.profile-mini strong {
  font-size: 14px;
}

.profile-mini span {
  color: var(--muted);
  font-size: 12px;
}

.profile-mini button,
.top-actions button {
  border: 0;
  background: transparent;
  color: #292520;
}

.main {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f0efed;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-actions > button {
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  font-size: 22px;
}

.avatar-button {
  display: flex !important;
  gap: 7px;
}

.avatar-button img {
  width: 38px;
  height: 38px;
}

.composer,
.post-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.composer {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 20px;
}

.composer .avatar {
  width: 48px;
  height: 48px;
}

.composer textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 16px;
}

.composer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.composer-tools button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #2f2a25;
  font-weight: 780;
}

.composer-tools span {
  font-size: 20px;
}

.composer-tools .post-button {
  min-width: 132px;
  margin-left: auto;
  padding: 0 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--orange), #ff8b2e);
  color: white;
  justify-content: center;
}

.feed-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 14px;
  overflow-x: auto;
}

.feed-tabs button {
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 760;
  white-space: nowrap;
}

.feed-tabs button.active {
  border-color: rgba(244, 122, 32, 0.38);
  background: #fff3e9;
  color: var(--orange-deep);
}

.feed {
  display: grid;
  gap: 16px;
}

.content-area {
  display: grid;
  gap: 16px;
}

.view-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 0;
}

.view-head h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.view-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ghost-button,
.danger-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 7px;
  background: white;
  font-weight: 800;
}

.ghost-button {
  border: 1px solid var(--line);
  color: #3d352e;
}

.danger-button {
  border: 1px solid #f2b8b8;
  color: #bd2f2f;
}

.composer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 0;
}

.composer-meta span,
.post-meta-line span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f7eee6;
  color: #8a4a1b;
  font-size: 12px;
  font-weight: 760;
}

.post-card {
  padding: 18px 18px 14px;
}

.post-head {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 13px;
  align-items: start;
}

.post-user strong,
.post-user span {
  display: inline-block;
}

.post-user strong {
  font-size: 15px;
  font-weight: 850;
}

.post-user span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 14px;
}

.post-menu {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

.post-body {
  padding-left: 61px;
}

.post-text {
  margin: 4px 0 8px;
  line-height: 1.65;
}

.tag {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 760;
  padding: 0;
}

.post-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 7px 0 0;
}

.post-image {
  display: block;
  width: 100%;
  aspect-ratio: 3.2 / 1;
  margin-top: 12px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-soft);
}

.image-one {
  object-position: center top;
}

.image-two {
  object-position: center center;
}

.image-three {
  object-position: center bottom;
}

.post-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 12px;
  padding: 13px 0 0 61px;
  color: #5f5850;
}

.post-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.post-actions button.liked {
  color: #e34a4a;
}

.post-actions button.saved {
  color: var(--orange-deep);
}

.comments {
  display: grid;
  gap: 6px;
  margin: 12px 0 0 61px;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.comments p {
  margin: 0;
  color: #4f4942;
  font-size: 13px;
}

.rightbar {
  display: grid;
  align-content: start;
  gap: 20px;
}

.panel {
  padding: 20px 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 17px;
}

.panel-head button {
  border: 0;
  background: transparent;
  color: var(--orange-deep);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.trend-list,
.user-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
}

.trend-item,
.recommended-user {
  display: grid;
  align-items: center;
  gap: 11px;
}

.trend-item {
  grid-template-columns: 34px 58px 1fr;
}

.rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #c8c8c8;
  color: white;
  font-size: 13px;
  font-weight: 850;
}

.trend-item:first-child .rank {
  background: #ffbf1e;
}

.trend-thumb {
  width: 58px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
}

.trend-item button {
  border: 0;
  background: transparent;
  text-align: left;
}

.trend-copy strong,
.trend-copy span,
.trend-item button strong,
.trend-item button span,
.recommended-user strong,
.recommended-user span {
  display: block;
}

.trend-copy strong,
.trend-item button strong,
.recommended-user strong {
  font-size: 14px;
}

.trend-copy span,
.trend-item button span,
.recommended-user span {
  color: var(--muted);
  font-size: 12px;
}

.recommended-user {
  grid-template-columns: 42px 1fr 86px;
}

.follow-button {
  min-height: 34px;
  border: 1px solid #e8a168;
  border-radius: 7px;
  background: white;
  color: var(--orange-deep);
  font-size: 13px;
  font-weight: 850;
}

.follow-button.following {
  border-color: var(--line);
  color: #4c463f;
  background: #f6f3ef;
}

.empty-state {
  padding: 34px;
  border: 1px dashed #e2d6cc;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 760;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.topic-card,
.model-card,
.review-card,
.profile-panel,
.x-profile,
.garage-panel,
.garage-stat,
.edit-panel,
.messages-layout,
.alert-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.x-profile {
  overflow: hidden;
}

.x-profile-cover,
.garage-hero {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.x-profile-body {
  padding: 0 18px 16px;
}

.x-profile-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
}

.x-profile-avatar {
  width: 92px;
  height: 92px;
  margin-top: -46px;
  border: 4px solid white;
  border-radius: 50%;
  object-fit: cover;
  background: white;
}

.x-profile h2,
.garage-body h2 {
  margin: 4px 0 2px;
  font-size: 22px;
}

.x-profile-handle,
.x-profile-bio,
.x-profile-meta {
  margin: 0 0 8px;
}

.x-profile-handle,
.x-profile-meta {
  color: var(--muted);
  font-size: 13px;
}

.x-profile-bio {
  line-height: 1.65;
}

.x-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.x-profile-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.x-profile-tabs button {
  min-height: 44px;
  border: 0;
  background: white;
  color: var(--muted);
  font-weight: 820;
}

.x-profile-tabs button.active {
  color: var(--orange-deep);
  box-shadow: inset 0 -3px 0 var(--orange);
}

.garage-panel {
  overflow: hidden;
}

.garage-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.garage-body p {
  margin: 6px 0 0;
  color: var(--muted);
}

.section-kicker {
  color: var(--orange-deep);
  font-size: 12px;
  font-weight: 900;
}

.garage-stat {
  padding: 16px;
}

.garage-stat strong,
.garage-stat span {
  display: block;
}

.garage-stat strong {
  font-size: 24px;
}

.garage-stat span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.account-menu-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
}

.account-menu-head strong,
.account-menu-head small {
  display: block;
}

.account-menu-head small {
  color: var(--muted);
}

.account-menu-list {
  display: grid;
  gap: 8px;
}

.account-menu-list button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  text-align: left;
  padding: 0 12px;
  font-weight: 780;
}

.modal-edit-panel {
  border: 0;
  padding: 0;
}

.topic-card,
.model-card {
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.topic-card {
  border: 1px solid var(--line);
  background: white;
}

.topic-card strong,
.topic-card span,
.model-card strong,
.model-card small {
  display: block;
}

.topic-card strong,
.model-card strong {
  font-size: 16px;
}

.topic-card span,
.model-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.model-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: white;
}

.model-card img {
  width: 72px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
}

.profile-panel {
  overflow: hidden;
}

.profile-cover {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.profile-content {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  padding: 18px;
}

.profile-content .avatar {
  width: 64px;
  height: 64px;
}

.profile-content h2,
.profile-content p {
  margin: 0 0 6px;
}

.profile-content p {
  color: #4d463e;
  line-height: 1.6;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.edit-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.edit-panel label {
  display: grid;
  gap: 6px;
  color: #544c44;
  font-size: 13px;
  font-weight: 760;
}

.edit-panel label:has(textarea),
.edit-panel button {
  grid-column: 1 / -1;
}

.edit-panel input,
.edit-panel textarea,
.edit-panel select,
.chat-form input,
.modal-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdfb;
  color: var(--text);
  outline: 0;
}

.edit-panel input,
.edit-panel select,
.chat-form input {
  min-height: 40px;
  padding: 0 11px;
}

.edit-panel textarea,
.modal-form textarea {
  padding: 10px 11px;
  resize: vertical;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.review-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.review-card p {
  margin: 0;
  line-height: 1.65;
}

.stars {
  color: #f0a41f;
  letter-spacing: 0;
}

.messages-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 520px;
  overflow: hidden;
}

.conversation-list {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
  border-right: 1px solid var(--line);
}

.conversation-list button {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.conversation-list button.active {
  background: #fff3e9;
}

.conversation-list img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.conversation-list strong,
.conversation-list small,
.chat-panel header strong,
.chat-panel header span {
  display: block;
}

.conversation-list small,
.chat-panel header span {
  color: var(--muted);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-panel header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-log {
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 16px;
}

.chat-log p {
  width: fit-content;
  max-width: min(72%, 520px);
  margin: 0;
  padding: 10px 13px;
  border-radius: 8px;
  background: #f4f0ec;
  line-height: 1.55;
}

.chat-log p.me {
  justify-self: end;
  background: #ffead8;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.alert-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.alert-item {
  display: grid;
  grid-template-columns: 36px 1fr 76px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.alert-item.read {
  opacity: 0.62;
}

.alert-item > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff0e4;
  color: var(--orange-deep);
}

.alert-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.alert-item button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

#alertBadge {
  min-width: 17px;
  height: 17px;
  margin-left: -8px;
  border-radius: 999px;
  background: var(--orange);
  color: white;
  font-size: 10px;
  line-height: 17px;
}

#alertBadge:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 18, 15, 0.34);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(620px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f5f1ed;
  font-size: 20px;
}

#modalBody {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.modal-post .post-card {
  box-shadow: none;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.choice-grid button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  font-weight: 780;
}

.modal-form {
  display: grid;
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  padding: 11px 16px;
  border-radius: 8px;
  background: #221d18;
  color: white;
  font-weight: 760;
  transition: 0.18s ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .rightbar {
    display: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 10px 0 12px;
    border-right: 0;
  }

  .brand {
    margin-bottom: 14px;
  }

  .brand-main {
    font-size: 24px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .nav-item {
    grid-template-columns: auto auto;
    min-width: max-content;
    min-height: 40px;
    padding: 0 12px;
  }

  .primary-post,
  .profile-mini {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    margin-top: 10px;
  }

  .top-actions {
    display: none;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .composer > .avatar {
    display: none;
  }

  .composer-tools .post-button {
    width: 100%;
    margin-left: 0;
  }

  .post-head {
    grid-template-columns: 42px 1fr auto;
  }

  .post-body,
  .post-actions {
    padding-left: 0;
  }

  .comments {
    margin-left: 0;
  }

  .post-image {
    aspect-ratio: 1.75 / 1;
  }

  .post-actions {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .post-actions button {
    justify-content: center;
  }

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

  .edit-panel,
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .conversation-list {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .conversation-list button {
    min-width: 210px;
  }

  .chat-panel {
    min-height: 420px;
  }

  .alert-item {
    grid-template-columns: 34px 1fr;
  }

  .alert-item button {
    grid-column: 2;
    width: fit-content;
    padding: 0 14px;
  }

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

  .profile-cover {
    height: 130px;
  }

  .x-profile-cover,
  .garage-hero {
    height: 140px;
  }

  .x-profile-avatar {
    width: 78px;
    height: 78px;
    margin-top: -39px;
  }

  .garage-body,
  .x-profile-row {
    align-items: start;
    flex-direction: column;
  }

  .x-profile-row .ghost-button,
  .garage-body .ghost-button {
    width: 100%;
  }
}
