* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090909;
  color: #111;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
}

.editor-panel {
  background: #121212;
  color: white;
  padding: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.editor-panel h1 {
  margin: 0;
  font-size: 24px;
}

.panel-subtitle {
  margin: 8px 0 20px;
  color: #a7a7a7;
  font-size: 13px;
}

.panel-card {
  background: #1b1b1b;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.panel-card label {
  display: block;
  margin: 10px 0 6px;
  font-size: 12px;
  color: #d7d7d7;
}

.panel-card input[type="text"],
.panel-card textarea,
.panel-card input[type="file"] {
  width: 100%;
}

.panel-card input[type="text"],
.panel-card textarea {
  border: 1px solid #2e2e2e;
  background: #101010;
  color: white;
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

.panel-card textarea {
  min-height: 88px;
  resize: vertical;
}

.panel-card input[type="file"] {
  background: #101010;
  border: 1px solid #2e2e2e;
  border-radius: 14px;
  padding: 10px;
  color: #d7d7d7;
}

.side-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.side-btn,
#addTextBtn,
#useNowBtn,
#deleteLastBtn,
#clearChatBtn,
.fake-upload-btn {
  border: none;
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.side-btn {
  flex: 1;
  background: #272727;
  color: white;
}

.side-btn.active {
  background: #6f49ff;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

#addTextBtn,
#useNowBtn,
.fake-upload-btn {
  background: #6f49ff;
  color: white;
  text-align: center;
}

#addTextBtn:hover,
#useNowBtn:hover,
.fake-upload-btn:hover,
.side-btn:hover {
  filter: brightness(1.07);
}

.fake-upload-btn input {
  display: none;
}

.danger {
  background: #ff4d67;
  color: white;
}

.danger.soft {
  background: #343434;
}

.mini-help {
  font-size: 12px;
  color: #a7a7a7;
  margin: 0 0 12px;
}

.phone-frame {
  width: 390px;
  min-width: 390px;
  max-width: 390px;

  height: 844px;
  min-height: 844px;
  max-height: 844px;

  background: #ffffff;
  border-radius: 46px;
  padding: 9px;
  box-shadow: 0 35px 110px rgba(0,0,0,0.35);

  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #f4f4f6;
  border-radius: 38px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
}

.notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 135px;
  height: 28px;
  background: #0e0e0e;
  border-radius: 999px;
  z-index: 30;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 8px;
  font-size: 12px;
  font-weight: 600;
  background: white;
  position: relative;
  z-index: 10;
}

.status-icons {
  letter-spacing: 1px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #ececec;
  position: relative;
  z-index: 10;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff00c8, #6f49ff, #3dbdff);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.header-info {
  flex: 1;
  min-width: 0;
}

.header-info h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.header-info p {
  margin: 2px 0 0;
  font-size: 10px;
  color: #7b7b7b;
}

.search-icon {
  font-size: 15px;
  color: #6f6f6f;
}

.top-badge {
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.95);
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.07);
  position: relative;
  z-index: 5;
}

.top-badge span {
  background: #ffe65d;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.top-badge p {
  margin: 0;
  font-size: 11px;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 82px;
}

.message {
  max-width: 76%;
  margin-bottom: 12px;
  cursor: pointer;
}

.message p,
.message .img-wrap {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.message p {
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.message span {
  display: block;
  font-size: 10px;
  color: #808080;
  margin-top: 4px;
}

.message.left p,
.message.left .img-wrap {
  background: white;
  border-bottom-left-radius: 7px;
}

.message.right {
  margin-left: auto;
}

.message.right p,
.message.right .img-wrap {
  background: #6f49ff;
  color: white;
  border-bottom-right-radius: 7px;
}

.message.right span {
  text-align: right;
}

.img-wrap {
  width: 170px;
  height: 170px;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message.selected p,
.message.selected .img-wrap {
  outline: 2px solid #ff4d67;
}

.chat-input-mock {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.96);
  border-radius: 999px;
  padding: 8px 11px;
  box-shadow: 0 5px 16px rgba(0,0,0,0.09);
}

.chat-input-mock button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  font-size: 17px;
}

.chat-input-mock input {
  flex: 1;
  border: none;
  background: transparent;
  color: #7d7d7d;
  outline: none;
  font-size: 13px;
}

.chat-input-mock span {
  color: #808080;
  font-size: 15px;
}

.preview-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #000;
  overflow: hidden;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    display: block;
  }

  .phone-frame {
    transform: scale(0.68);
    transform-origin: top center;
  }

  body {
    overflow-x: hidden;
  }
}

@media (max-width: 950px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .preview-area {
    padding: 20px;
  }

  .phone-frame {
    width: 390px !important;
  }
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.battery {
  width: 18px;
  height: 9px;
  border: 1.5px solid black;
  border-radius: 2px;
  position: relative;
}

.battery::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: black;
  border-radius: 1px;
}

.battery-level {
  width: 75%;
  height: 100%;
  background: black;
}