:root {
  --bg0: #08090b;
  --bg1: #11151b;
  --panel: #171c23;
  --panel2: #202731;
  --panel3: #252e39;
  --line: rgba(232, 220, 190, .16);
  --line2: rgba(255, 255, 255, .09);
  --text: #f2ead8;
  --muted: #aeb5bd;
  --faint: #75808b;
  --gold: #d9ad52;
  --amber: #ffcf7a;
  --red: #c94a4a;
  --green: #74c17b;
  --blue: #73a7d8;
  --shadow: rgba(0, 0, 0, .48);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 937px;
  height: 651px;
  margin: 0;
  overflow: hidden;
  background: #050607;
  color: var(--text);
  user-select: none;
}

body {
  background:
    linear-gradient(180deg, rgba(245, 198, 101, .08), rgba(0, 0, 0, 0) 190px),
    radial-gradient(ellipse at 66% 0%, rgba(115, 167, 216, .13), transparent 360px),
    linear-gradient(135deg, #0a0b0e 0%, #141a22 44%, #0c0d10 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  position: relative;
  width: 937px;
  height: 651px;
  padding: 14px;
  display: grid;
  grid-template-rows: 58px 1fr 30px;
  gap: 10px;
}

.loading-layer {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 7, .72);
  backdrop-filter: blur(2px);
}

.loading-layer.hidden {
  display: none;
}

.loading-box {
  min-width: 220px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 207, 122, .28);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)), #131922;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255,255,255,.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.loading-mark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 207, 122, .22);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: support-loading-spin .8s linear infinite;
}

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

.topbar,
.panel,
.footer {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012)), var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 14px 28px var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
}

.topbar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
}

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

.brand-logo {
  width: 25px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 9px rgba(255, 255, 255, .18)) drop-shadow(0 0 16px rgba(217, 173, 82, .22));
}

.brand-text {
  min-width: 0;
}

.title {
  font-size: 18px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#actorLine {
  color: var(--muted);
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.new-ticket-btn,
.ghost-btn,
.tool-btn,
.send-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 5px;
}

.new-ticket-btn {
  width: 100%;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  white-space: nowrap;
}

.new-ticket-btn span {
  font-size: 23px;
  line-height: 24px;
}

.new-ticket-btn strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 14px;
}

.primary {
  background: linear-gradient(180deg, #e7bd63, #936d32);
  color: #17100a;
  border-color: rgba(255, 229, 172, .46);
  font-weight: 800;
}

.primary:hover {
  background: linear-gradient(180deg, #ffd87e, #a77a36);
}

.main {
  min-height: 0;
  display: grid;
  grid-template-columns: 252px 1fr;
  gap: 10px;
}

.panel {
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
}

.section-head {
  height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  font-size: 13px;
  font-weight: 700;
}

.counter {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--red);
  color: white;
  font-size: 12px;
  box-shadow: 0 0 14px rgba(201, 74, 74, .42);
}

.tickets {
  height: calc(100% - 42px);
  overflow-y: auto;
  padding: 7px;
}

.ticket {
  min-height: 74px;
  padding: 9px 9px 8px;
  margin-bottom: 7px;
  border: 1px solid rgba(255,255,255,.065);
  background: rgba(255,255,255,.035);
  border-radius: 5px;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.ticket:hover {
  background: rgba(217, 173, 82, .12);
  border-color: rgba(217, 173, 82, .42);
  transform: translateX(2px);
}

.ticket.active {
  background: linear-gradient(90deg, rgba(217, 173, 82, .22), rgba(115, 167, 216, .08));
  border-color: rgba(255, 207, 122, .62);
  box-shadow: inset 3px 0 0 var(--amber), 0 0 18px rgba(217, 173, 82, .12);
}

.ticket.unread:not(.active) {
  border-color: rgba(116, 193, 123, .45);
  box-shadow: inset 3px 0 0 var(--green);
}

.ticket.create-ticket {
  width: 100%;
  min-height: 42px;
  margin-bottom: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .2);
}

.ticket.create-ticket:not(.is-disabled) {
  background: linear-gradient(180deg, #e7bd63, #936d32);
  color: #17100a;
  border-color: rgba(255, 229, 172, .52);
  animation: create-ticket-pulse 2.6s ease-in-out infinite;
}

.ticket.create-ticket:not(.is-disabled):hover {
  background: linear-gradient(180deg, #ffd87e, #a77a36);
  border-color: rgba(255, 239, 192, .74);
  animation-play-state: paused;
}

.ticket.create-ticket.is-disabled {
  background: rgba(255,255,255,.035);
  color: var(--text);
  border-color: rgba(255,255,255,.065);
  opacity: .42;
  cursor: pointer;
  transform: none;
  animation: none;
}

.ticket.create-ticket.is-disabled:hover {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.065);
}

@keyframes create-ticket-pulse {
  0%, 100% {
    box-shadow: 0 8px 16px rgba(0, 0, 0, .2), 0 0 0 rgba(217, 173, 82, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 8px 16px rgba(0, 0, 0, .2), 0 0 14px rgba(255, 207, 122, .34);
    filter: brightness(1.08);
  }
}

.ticket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.ticket-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 15px;
  height: 30px;
  overflow: hidden;
}

.tag {
  height: 20px;
  padding: 2px 7px 0;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #10151b;
  background: var(--amber);
  white-space: nowrap;
}

.tag.waiting_admin { background: #94caff; }
.tag.answered { background: #83d88d; }
.tag.closed { background: #8e98a3; }
.tag.resolved { background: #83d88d; }
.tag.unresolved { background: #ff9d7a; }

.chat-panel {
  display: grid;
  grid-template-rows: 52px 1fr 132px;
}

.chat-head {
  min-width: 0;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.025);
}

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

#ticketTitle {
  font-size: 15px;
  line-height: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ticketMeta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.ghost-btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

#closeTicketBtn:not(:disabled) {
  background: linear-gradient(180deg, #df6b5f, #8f332f);
  color: #fff5ef;
  border-color: rgba(255, 173, 154, .48);
  box-shadow: 0 0 13px rgba(201, 74, 74, .22);
}

#closeTicketBtn:not(:disabled):hover {
  background: linear-gradient(180deg, #f07b6d, #a33b35);
  border-color: rgba(255, 196, 178, .68);
}

.ghost-btn:disabled,
.send-btn:disabled,
.tool-btn:disabled,
.new-ticket-btn:disabled {
  opacity: .42;
  cursor: default;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 11px;
}

.empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 13px;
}

.tickets > .empty {
  height: calc(100% - 50px);
}

#ticketMeta:empty {
  display: none;
}

.message {
  max-width: 82%;
  margin-bottom: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  background: rgba(255,255,255,.045);
  box-shadow: 0 7px 14px rgba(0,0,0,.18);
  word-break: break-word;
}

.message.player {
  margin-left: auto;
  background: linear-gradient(180deg, rgba(217, 173, 82, .18), rgba(217, 173, 82, .08));
  border-color: rgba(217, 173, 82, .28);
}

.message.admin {
  background: linear-gradient(180deg, rgba(115, 167, 216, .16), rgba(115, 167, 216, .07));
  border-color: rgba(115, 167, 216, .3);
}

.message.system {
  max-width: 100%;
  margin-left: 28px;
  margin-right: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.025);
}

.resolution-prompt {
  padding-bottom: 10px;
}

.message-page-loader {
  max-width: 110px;
  margin: 0 auto 8px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 16px;
}

.resolution-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.resolution-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  color: var(--text);
  background: rgba(255,255,255,.06);
  font-size: 12px;
}

.resolution-btn.resolved {
  background: rgba(116, 193, 123, .18);
  border-color: rgba(116, 193, 123, .4);
}

.resolution-btn.unresolved {
  background: rgba(201, 74, 74, .18);
  border-color: rgba(201, 74, 74, .42);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.message-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.message-body {
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  cursor: text;
}

.message-link {
  color: #ffd98a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
}

.message.admin .message-link {
  color: #a9d7ff;
}

.message-link:hover {
  color: #fff2cf;
}

.message-attachment {
  margin-top: 7px;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

.message-body > .message-attachment:first-child {
  margin-top: 0;
}

.message-attachment a {
  display: inline-block;
}

.message-attachment img,
.message-attachment video {
  display: block;
  max-width: min(360px, 100%);
  max-height: 260px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 5px;
  background: rgba(0,0,0,.24);
  box-shadow: 0 8px 18px rgba(0,0,0,.24);
}

.message-attachment img {
  object-fit: contain;
  cursor: zoom-in;
}

.lottie-sticker {
  display: block;
  max-width: 150px;
  max-height: 150px;
  position: relative;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 5px;
  background: rgba(0,0,0,.16);
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
  overflow: hidden;
}

.lottie-sticker.is-loading:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 207, 122, .18);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: support-loading-spin .8s linear infinite;
}

.lottie-sticker.is-failed:after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(255,255,255,.12);
}

.lottie-sticker svg {
  display: block;
}

.message-attachment video {
  width: min(360px, 100%);
}

.message-attachment-link {
  margin-top: 5px;
  color: #ffd98a;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
}

.message.admin .message-attachment-link {
  color: #a9d7ff;
}

.message-copy {
  width: 18px;
  height: 18px;
  position: relative;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 4px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  opacity: .68;
  cursor: pointer;
}

.message-copy:before,
.message-copy:after {
  content: "";
  position: absolute;
  width: 7px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.message-copy:before {
  left: 5px;
  top: 4px;
}

.message-copy:after {
  left: 7px;
  top: 2px;
  background: #1b222b;
}

.message-copy:hover {
  opacity: 1;
  color: #ffe2a0;
  border-color: rgba(255, 226, 160, .34);
  background: rgba(217, 173, 82, .12);
}

.composer {
  position: relative;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  display: grid;
  grid-template-columns: 1fr 104px;
  grid-template-rows: 30px 1fr;
  gap: 7px;
}

.tools {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  width: 30px;
  height: 28px;
  font-size: 16px;
  position: relative;
}

.tool-btn[data-tooltip]:hover:after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  max-width: 240px;
  min-width: 132px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 207, 122, .34);
  border-radius: 5px;
  background: #111820;
  color: var(--text);
  box-shadow: 0 10px 22px rgba(0,0,0,.45);
  font-size: 12px;
  line-height: 15px;
  text-align: center;
  white-space: normal;
  z-index: 30;
  pointer-events: none;
}

.context-chip {
  min-width: 0;
  height: 24px;
  padding: 4px 8px 0;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

textarea,
.field {
  width: 100%;
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(4,6,8,.58);
  color: var(--text);
  border-radius: 5px;
  outline: none;
}

textarea {
  resize: none;
  padding: 8px 9px;
}

textarea:focus,
.field:focus {
  border-color: rgba(255, 207, 122, .62);
  box-shadow: 0 0 0 1px rgba(255, 207, 122, .12);
}

.send-btn {
  width: 104px;
  background: linear-gradient(180deg, #e7bd63, #91692d);
  border-color: rgba(255, 229, 172, .48);
  color: #17100a;
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emoji-popover {
  position: absolute;
  left: 8px;
  bottom: 124px;
  width: 300px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111820;
  box-shadow: 0 18px 34px rgba(0,0,0,.6);
  z-index: 5;
}

.emoji-popover.hidden {
  display: none;
}

.emoji {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  font-size: 16px;
}

.emoji:hover {
  background: rgba(217, 173, 82, .16);
}

.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.field {
  height: 32px;
  padding: 0 8px;
  margin-bottom: 12px;
}

.footer {
  height: 30px;
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

#footerState,
#lastSync {
  flex: 0 0 auto;
}

.footer-notice {
  min-width: 0;
  flex: 1 1 auto;
  color: #ffe2a0;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 8px rgba(217, 173, 82, .34);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .2s ease;
}

.footer-notice.is-visible {
  opacity: 1;
}

.footer-notice.is-flash {
  animation: footerNoticePulse 1.5s ease-out;
}

@keyframes footerNoticePulse {
  0% {
    color: #fff7d6;
    text-shadow: 0 0 14px rgba(255, 226, 160, .72), 0 0 24px rgba(217, 173, 82, .36);
  }
  100% {
    color: #ffe2a0;
    text-shadow: 0 0 8px rgba(217, 173, 82, .34);
  }
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-layer.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
}

.media-viewer.hidden {
  display: none;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .82);
}

.media-viewer-image {
  position: relative;
  z-index: 1;
  width: calc(100vw - 68px);
  height: calc(100vh - 68px);
  max-width: calc(100vw - 68px);
  max-height: calc(100vh - 68px);
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 5px;
  background: rgba(0,0,0,.28);
  box-shadow: 0 20px 44px rgba(0,0,0,.7);
  user-select: none;
}

.media-viewer-close {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  background: rgba(15, 18, 23, .86);
  color: #ffe2a0;
  font-size: 26px;
  line-height: 28px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,.44);
}

.media-viewer-close:hover {
  border-color: rgba(255, 226, 160, .45);
  background: rgba(42, 35, 22, .94);
}

.modal {
  position: relative;
  width: 560px;
  max-width: calc(100% - 40px);
  border: 1px solid rgba(255, 207, 122, .34);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.014)),
    #151b23;
  box-shadow: 0 26px 54px rgba(0,0,0,.66), inset 0 1px 0 rgba(255,255,255,.06);
}

.modal-head {
  height: 66px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr 32px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-size: 17px;
  line-height: 21px;
  font-weight: 800;
}

.modal-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 15px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  font-size: 22px;
  line-height: 28px;
}

.modal-body {
  position: relative;
  padding: 13px 14px 12px;
}

.modal-body .field {
  margin-bottom: 8px;
}

.quick-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.quick-topic {
  height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255,255,255,.045);
  font-size: 12px;
}

.quick-topic:hover,
.quick-topic.active {
  color: #17100a;
  background: linear-gradient(180deg, #e7bd63, #936d32);
  border-color: rgba(255, 229, 172, .46);
}

#modalMessageInput {
  height: 122px;
}

.modal-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-emoji {
  left: 14px;
  bottom: 44px;
}

.modal-actions {
  height: 54px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.modal-send {
  height: 32px;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0,0,0,.18);
}

::-webkit-scrollbar-thumb {
  background: rgba(217, 173, 82, .35);
  border-radius: 4px;
}
