:root {
  --bg: #08090d;
  --surface: #11151d;
  --surface-2: #171c25;
  --surface-3: #202633;
  --text: #f5f7fb;
  --muted: #8f98aa;
  --muted-2: #5f6878;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #f0b90b;
  --accent-strong: #ffd35a;
  --accent-soft: rgba(240, 185, 11, 0.14);
  --buy: #16c784;
  --sell: #ea3943;
  --danger: #ff4d5d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(240, 185, 11, 0.08) 0%, rgba(8, 9, 13, 0) 26%),
    linear-gradient(180deg, #08090d 0%, #0c1017 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 4px 0 14px;
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(18px);
}

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

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.profile-pill {
  display: flex;
  align-items: center;
  min-width: 160px;
  max-width: 48%;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 21, 29, 0.9);
  box-shadow: var(--shadow);
}

.profile-pill span,
.profile-pill strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.profile-pill strong {
  margin-top: 1px;
  color: var(--accent-strong);
  font-size: 13px;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0b90b, #16c784);
  color: #11151d;
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.avatar-small {
  width: 36px;
  height: 36px;
}

.market-switch,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.switch-button,
.segment span {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.switch-button.is-active,
.segment.is-active span {
  background: var(--accent);
  color: #11151d;
  box-shadow: 0 10px 22px rgba(240, 185, 11, 0.22);
}

.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 77, 93, 0.22);
  border-radius: 8px;
  background: rgba(255, 77, 93, 0.11);
  color: #ff9aa4;
  font-weight: 700;
}

.notice[data-tone="ok"] {
  border-color: rgba(22, 199, 132, 0.24);
  background: rgba(22, 199, 132, 0.11);
  color: #55e2ad;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 14px;
}

.section-title h2,
.dialog-head h2 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 19px;
  letter-spacing: 0;
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

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

.order-card,
.create-panel,
.empty-state,
.order-panel,
.review-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.order-card,
.create-panel,
.profile-panel {
  padding: 16px;
}

.order-topline,
.order-footer,
.creator,
.card-actions,
.dialog-head {
  display: flex;
  align-items: center;
}

.order-topline,
.order-footer,
.dialog-head {
  justify-content: space-between;
  gap: 12px;
}

.side-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #07100c;
  font-size: 12px;
  font-weight: 900;
}

.side-badge.buy {
  background: var(--buy);
}

.side-badge.sell {
  background: var(--sell);
  color: #fff;
}

.expires-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.order-amount {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.order-message {
  margin-bottom: 18px;
  color: #c4cad6;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.order-footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.creator {
  min-width: 0;
  gap: 10px;
}

.creator-meta {
  min-width: 0;
}

.creator-name,
.creator-rating {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creator-name {
  max-width: 190px;
  color: var(--text);
  font-size: 14px;
}

.creator-rating {
  margin-top: 3px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dm-button,
.review-button,
.delete-button,
.primary-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

.dm-button,
.review-button,
.delete-button {
  border: 1px solid var(--line);
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--text);
}

.dm-button,
.primary-button {
  border-color: transparent;
  background: var(--accent);
  color: #11151d;
}

.delete-button {
  background: rgba(255, 77, 93, 0.11);
  color: var(--danger);
}

.create-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.form-title {
  margin: 0;
}

.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment span {
  display: grid;
  place-items: center;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.field input,
.field textarea,
.review-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1017;
  color: var(--text);
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder,
.review-panel textarea::placeholder {
  color: var(--muted-2);
}

.field input {
  height: 50px;
  padding: 0 13px;
}

.field textarea,
.review-panel textarea {
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus,
.review-panel textarea:focus {
  border-color: rgba(240, 185, 11, 0.68);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-button {
  border: 0;
  padding: 0 16px;
  box-shadow: 0 10px 24px rgba(240, 185, 11, 0.2);
}

.mine-title {
  margin-top: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 34px 20px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 6px;
  color: var(--text);
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.bottom-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(8, 9, 13, 0.92);
  backdrop-filter: blur(18px);
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab-button.is-active {
  border-color: rgba(240, 185, 11, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.profile-panel {
  margin-bottom: 22px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
}

.profile-head h2 {
  margin-bottom: 4px;
}

.profile-head strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.profile-reviews {
  max-height: none;
}

.order-dialog,
.review-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: min(760px, calc(100% - 24px));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.order-dialog::backdrop,
.review-dialog::backdrop {
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(8px);
}

.order-panel,
.review-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.dialog-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.rating-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rating-picker button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1017;
  color: var(--muted);
  font-weight: 900;
}

.rating-picker button.is-active {
  border-color: rgba(240, 185, 11, 0.42);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.reviews-list {
  display: grid;
  max-height: 260px;
  gap: 8px;
  overflow: auto;
}

.review-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1017;
}

.review-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.review-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 520px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  h1 {
    font-size: 27px;
  }

  .profile-pill {
    min-width: 142px;
  }

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

  .card-actions {
    width: 100%;
  }

  .dm-button,
  .review-button,
  .delete-button {
    flex: 1 1 0;
  }
}
