:root {
  --ink: #12100b;
  --muted: #8d816d;
  --soft: #f7efd9;
  --paper: #fff9e9;
  --panel: rgba(255, 252, 242, .88);
  --panel-strong: #fffdf5;
  --line: rgba(35, 28, 16, .09);
  --yellow: #ffc93d;
  --yellow-strong: #ffb900;
  --navy: #07162b;
  --coral: #ff735c;
  --mint: #82d8bf;
  --blue: #b9dcff;
  --shadow: 0 24px 70px rgba(63, 45, 13, .18);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 61, .22), transparent 28%),
    radial-gradient(circle at 90% 18%, rgba(130, 216, 191, .18), transparent 24%),
    linear-gradient(135deg, #fff8e5 0%, #fffdf4 45%, #f8edcc 100%);
  font-family: "Avenir Next", "PingFang TC", "Microsoft JhengHei", sans-serif;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(111, 86, 25, .035) 1px, transparent 1px),
    linear-gradient(rgba(111, 86, 25, .035) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 80%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 300px;
  height: 300px;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(30px);
  opacity: .38;
}

.ambient-a {
  top: 6%;
  left: 4%;
  background: rgba(255, 201, 61, .52);
  animation: drift 12s ease-in-out infinite;
}

.ambient-b {
  right: 5%;
  bottom: 6%;
  background: rgba(185, 220, 255, .5);
  animation: drift 14s ease-in-out infinite reverse;
}

.shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(330px, 440px) minmax(280px, 390px);
  gap: 30px;
  align-items: start;
  justify-content: center;
  width: min(100%, 990px);
  margin: 0 auto;
  padding: 28px;
}

.phone {
  position: relative;
  overflow: hidden;
  border: 8px solid #111;
  border-radius: 44px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 249, 233, .95)),
    var(--paper);
  box-shadow: var(--shadow), 0 16px 0 rgba(0, 0, 0, .05);
  animation: riseIn .62s cubic-bezier(.2, .8, .2, 1) both;
}

.phone::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  width: 112px;
  height: 30px;
  border-radius: 999px;
  background: #090909;
  transform: translateX(-50%);
}

.phone-glow {
  position: absolute;
  top: -90px;
  right: -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 201, 61, .38);
  filter: blur(42px);
}

.statusbar {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  padding: 18px 24px 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .02em;
}

.signal {
  color: var(--navy);
}

.app {
  position: relative;
  z-index: 2;
  padding: 0 16px 18px;
}

.topbar,
.hero-panel,
.section-title,
.library-tools,
.keyboard-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #b88700;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}

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

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

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.14;
  letter-spacing: -.01em;
}

h3 {
  margin-bottom: 4px;
  font-size: 19px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(18, 16, 11, .08);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 22px rgba(57, 41, 10, .12);
  font-size: 22px;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.icon-button:hover {
  transform: translateY(-2px) rotate(18deg);
  background: var(--yellow);
  box-shadow: 0 14px 28px rgba(196, 139, 0, .24);
}

.hero-panel {
  position: relative;
  align-items: stretch;
  overflow: hidden;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(255, 201, 61, .38);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 201, 61, .38), rgba(255, 255, 255, .7) 58%),
    var(--panel-strong);
  box-shadow: 0 16px 32px rgba(178, 125, 0, .12);
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 28%, rgba(255, 255, 255, .62), transparent 52%);
  transform: translateX(-120%);
  animation: shine 5.4s ease-in-out infinite;
}

.hero-panel p {
  position: relative;
  margin-bottom: 0;
  color: #6e634f;
  line-height: 1.48;
}

.hero-count {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 92px;
  padding: 12px;
  border: 2px solid rgba(255, 185, 0, .45);
  border-radius: 22px;
  color: var(--ink);
  background: #fff6cf;
  text-align: center;
  box-shadow: inset 0 -8px 18px rgba(255, 201, 61, .22);
}

.hero-count strong {
  font-size: 32px;
  line-height: 1;
}

.hero-count span {
  color: #776a55;
  font-size: 11px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 246, 222, .75);
}

.tab {
  min-height: 42px;
  border-radius: 15px;
  color: #7b705d;
  background: transparent;
  font-size: 13px;
  font-weight: 950;
  transition: transform .18s ease, color .18s ease, background .18s ease, box-shadow .18s ease;
}

.tab:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.tab.active {
  color: var(--ink);
  background: linear-gradient(135deg, #fff 0%, var(--yellow) 72%);
  box-shadow: 0 10px 22px rgba(196, 139, 0, .16);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: panelIn .28s ease both;
}

.section-title {
  align-items: end;
  margin-bottom: 12px;
}

.section-title span {
  max-width: 178px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.import-card,
.primary,
.library-tools button {
  position: relative;
  overflow: hidden;
  min-height: 52px;
  border: 1px solid rgba(18, 16, 11, .08);
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 10px 22px rgba(67, 45, 8, .08);
  font-weight: 950;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.import-card::after,
.primary::after,
.library-tools button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, .65), transparent 62%);
  transform: translateX(-120%);
  transition: transform .55s ease;
}

.import-card:hover,
.primary:hover,
.library-tools button:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(67, 45, 8, .14);
}

.import-card:hover::after,
.primary:hover::after,
.library-tools button:hover::after {
  transform: translateX(120%);
}

.import-card:nth-child(1) {
  background: linear-gradient(135deg, #fff, #fff0b8);
}

.import-card:nth-child(2) {
  background: linear-gradient(135deg, #fff, #ffe7d5);
}

.import-card:nth-child(3) {
  background: linear-gradient(135deg, #fff, #dff6eb);
}

.import-card:nth-child(4) {
  background: linear-gradient(135deg, #fff, #dceeff);
}

.inbox-list,
.sticker-grid,
.keyboard-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.inbox-item,
.sticker-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 12px 26px rgba(67, 45, 8, .08);
  animation: cardIn .35s ease both;
}

.thumb,
.sticker-preview,
.key {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(18, 16, 11, .08);
  border-radius: 17px;
  color: var(--ink);
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, .82), transparent 24%),
    linear-gradient(145deg, #ffe18a, #fff7db);
  text-align: center;
  font-weight: 950;
}

.thumb {
  width: 64px;
  font-size: 25px;
}

.meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pill {
  max-width: 116px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 185, 0, .36);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(135deg, #fff, var(--yellow));
  box-shadow: 0 10px 22px rgba(196, 139, 0, .14);
  font-size: 12px;
  font-weight: 950;
  transition: transform .18s ease, box-shadow .18s ease;
}

.pill:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 15px 26px rgba(196, 139, 0, .22);
}

.ghost {
  background: linear-gradient(135deg, #fff, #ffe1d7);
  border-color: rgba(255, 115, 92, .3);
}

.converter {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 14px 30px rgba(67, 45, 8, .08);
}

.sticker-preview {
  width: 100%;
  min-height: 220px;
  padding: 18px;
  white-space: pre-line;
  font-size: 30px;
  line-height: 1.1;
  animation: previewFloat 4.8s ease-in-out infinite;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff9eb;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus {
  border-color: rgba(255, 185, 0, .72);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 201, 61, .18);
}

.primary {
  color: var(--ink);
  background: linear-gradient(135deg, #fff, var(--yellow));
}

.library-tools {
  display: grid;
  grid-template-columns: 1fr auto auto;
}

.library-tools button {
  padding: 0 12px;
  color: var(--ink);
  font-size: 12px;
}

.sticker-grid {
  grid-template-columns: 1fr;
}

.sticker-card button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 185, 0, .32);
  border-radius: 15px;
  color: #9b6f00;
  background: #fff6d8;
  font-size: 17px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.sticker-card button:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 24px rgba(196, 139, 0, .18);
}

.chat-screen {
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 248, 225, .86)),
    #fff9e9;
}

.message {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(18, 16, 11, .06);
  border-radius: 18px;
  line-height: 1.35;
  animation: messageIn .28s ease both;
}

.left {
  background: #f3ead3;
}

.right {
  margin-left: auto;
  color: var(--ink);
  background: var(--yellow);
}

.message.image {
  display: grid;
  place-items: center;
  min-height: 118px;
  margin-left: auto;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .62), transparent 30%),
    linear-gradient(135deg, #ffe28b, #fff7d8);
  white-space: pre-line;
  font-weight: 950;
  text-align: center;
}

.message.image.sent-pop {
  animation: stickerSend .48s cubic-bezier(.2, .85, .2, 1) both;
}

.keyboard-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: rgba(255, 255, 255, .74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82);
}

.keyboard-tabs {
  justify-content: start;
  margin-bottom: 10px;
}

.keyboard-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #806f53;
  background: #f8efd8;
  font-weight: 850;
}

.keyboard-tabs button.active {
  color: var(--ink);
  background: var(--yellow);
}

.keyboard-grid {
  grid-template-columns: repeat(4, 1fr);
}

.key {
  min-height: 72px;
  padding: 4px;
  border: 1px solid rgba(18, 16, 11, .08);
  font-size: 11px;
  transform: translateZ(0);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.key span {
  font-size: 19px;
}

.key small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 14px 28px rgba(196, 139, 0, .18);
}

.key:active {
  transform: translateY(0) scale(.96);
  filter: brightness(1.04);
}

.key.clicked {
  animation: keyPulse .42s ease both;
}

.paste-tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.side-panel {
  position: sticky;
  top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 252, 242, .82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: riseIn .72s .08s cubic-bezier(.2, .8, .2, 1) both;
}

.side-panel h2 {
  font-size: 30px;
}

.side-panel li {
  margin-bottom: 12px;
  color: #514836;
  line-height: 1.45;
}

.event-log {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.log-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: #5d523d;
  background: rgba(255, 255, 255, .68);
  font-size: 13px;
  animation: logIn .24s ease both;
}

.mobile-log {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .66);
}

.micro-pulse {
  animation: microPulse .36s ease both;
}

@keyframes shine {
  0%, 42% { transform: translateX(-120%); }
  72%, 100% { transform: translateX(120%); }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(20px, -14px, 0) scale(1.05); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes previewFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 10px 22px rgba(196, 139, 0, .1); }
  50% { transform: translateY(-4px); box-shadow: 0 18px 30px rgba(196, 139, 0, .18); }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes stickerSend {
  0% { opacity: .2; transform: translateY(12px) scale(.72) rotate(-2deg); filter: blur(2px); }
  62% { opacity: 1; transform: translateY(-4px) scale(1.06) rotate(1deg); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes keyPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 201, 61, .45); }
  100% { box-shadow: 0 0 0 14px rgba(255, 201, 61, 0); }
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes microPulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.08) saturate(1.05); }
  100% { filter: brightness(1); }
}

@media (max-width: 820px) {
  .ambient {
    width: 180px;
    height: 180px;
    opacity: .28;
  }

  .ambient-a {
    left: -80px;
  }

  .ambient-b {
    right: -80px;
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .phone {
    border-width: 6px;
    border-radius: 34px;
  }

  .side-panel {
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    display: grid;
  }
}

.mobile-preview {
  min-height: 100vh;
  background: #fff4d7;
}

.mobile-preview .shell {
  display: block;
  width: min(100%, 430px);
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}

.mobile-preview .phone {
  min-height: calc(100vh - 24px);
  border-radius: 34px;
  background: #fff7df;
  box-shadow: 0 0 0 5px #111, 0 22px 60px rgba(74, 51, 10, .22);
  animation: none;
}

.mobile-preview .phone-glow {
  display: none;
}

.mobile-preview::before,
.mobile-preview .ambient,
.mobile-preview .scanline {
  display: none;
}

.mobile-preview .app {
  padding-bottom: 22px;
}

.mobile-preview .hero-panel {
  display: grid;
  margin: 14px 0;
  padding: 15px;
  border: 1px solid rgba(28, 22, 10, .1);
  background: #fffdf6;
  box-shadow: 0 12px 24px rgba(78, 55, 8, .08);
}

.mobile-preview .hero-panel h2 {
  font-size: 22px;
}

.mobile-preview .hero-panel p {
  color: #6e634f;
}

.mobile-preview .tabs {
  grid-template-columns: repeat(2, 1fr);
  background: #fff1c8;
  border-color: rgba(28, 22, 10, .08);
}

.mobile-preview .library-tools {
  grid-template-columns: 1fr;
}

.mobile-preview .side-panel {
  display: none;
}

.mobile-preview .ambient {
  width: 170px;
  height: 170px;
  opacity: .24;
}

.mobile-preview .ambient-a {
  left: -70px;
}

.mobile-preview .ambient-b {
  right: -70px;
}

.mobile-preview .inbox-item,
.mobile-preview .sticker-card,
.mobile-preview .converter,
.mobile-preview .mobile-log {
  background: #fffdf7;
  border-color: rgba(28, 22, 10, .1);
  box-shadow: 0 10px 22px rgba(67, 45, 8, .12);
}

.mobile-preview .view.active {
  animation: none;
}

.mobile-preview .section-title span,
.mobile-preview .meta span,
.mobile-preview .paste-tip,
.mobile-preview .log-item {
  color: #756955;
}

.mobile-preview .import-card {
  color: #17120a;
  background: #fffdfa;
  border-color: rgba(28, 22, 10, .1);
  box-shadow: 0 10px 22px rgba(67, 45, 8, .1);
}

.mobile-preview .import-card:nth-child(1) {
  background: linear-gradient(135deg, #fffdfa, #ffd869);
}

.mobile-preview .import-card:nth-child(2) {
  background: linear-gradient(135deg, #fffdfa, #ffe2bf);
}

.mobile-preview .import-card:nth-child(3) {
  background: linear-gradient(135deg, #fffdfa, #d7f1e2);
}

.mobile-preview .import-card:nth-child(4) {
  background: linear-gradient(135deg, #fffdfa, #d6ebff);
}

.mobile-preview .meta strong,
.mobile-preview h1,
.mobile-preview h2,
.mobile-preview h3,
.mobile-preview .tab,
.mobile-preview .statusbar {
  color: #14100a;
}

.mobile-preview .eyebrow {
  color: #b57900;
}

.mobile-preview .hero-count,
.mobile-preview .tab.active,
.mobile-preview .keyboard-tabs button.active,
.mobile-preview .right,
.mobile-preview .primary,
.mobile-preview .pill {
  background: #ffc93d;
  color: #14100a;
}
