:root {
  color-scheme: light;
  --bg: #f4f7f4;
  --card: rgba(255, 255, 255, 0.88);
  --text: #111714;
  --muted: #69746f;
  --line: rgba(17, 23, 20, 0.1);
  --soft: #e8eee9;
  --accent: #176b5b;
  --accent-dark: #0f4f43;
  --accent-soft: #dff3ec;
  --danger: #b42318;
  --shadow: 0 18px 60px rgba(17, 23, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -10%, rgba(23, 107, 91, 0.18), transparent 32rem),
    linear-gradient(180deg, #fbfcf8 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 760;
}

button i,
.drop-zone i {
  width: 21px;
  height: 21px;
  stroke-width: 2.3;
}

.app {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 106px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 14px;
}

.brand {
  font-size: 2.15rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.status-pill {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.85rem;
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

.panel,
.activity {
  display: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 14px;
}

.panel.active,
.activity {
  display: grid;
  gap: 12px;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1.5px dashed rgba(23, 107, 91, 0.42);
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fbf7 0%, #edf6f1 100%);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone > i {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.drop-zone strong {
  display: block;
  margin-top: 10px;
  font-size: 1.28rem;
}

.drop-zone span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.file-list,
.activity-list {
  display: grid;
  gap: 8px;
}

.file-item,
.activity-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.75);
}

.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.file-item button {
  min-height: 38px;
  border-radius: 12px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--text);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 128px;
  padding: 14px;
  resize: vertical;
}

input {
  min-height: 58px;
  padding: 0 14px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(23, 107, 91, 0.13);
}

.primary-action,
.secondary-action,
.mode-tab,
.icon-action,
.close-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-action {
  min-height: 62px;
  width: 100%;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 12px 26px rgba(23, 107, 91, 0.24);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  min-height: 46px;
  border-radius: 14px;
  padding: 0 14px;
  background: var(--soft);
  color: var(--text);
}

.secondary-action.compact {
  width: 44px;
  padding: 0;
}

.receive-card {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 10px;
}

.receive-code {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 2rem;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.icon-action {
  min-height: 58px;
  border-radius: 16px;
  background: var(--text);
  color: #fff;
}

.scanner {
  display: grid;
  gap: 8px;
}

.scanner video {
  width: 100%;
  max-height: 60vh;
  border-radius: 16px;
  background: #000;
}

.receive-state,
.state-text {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.activity {
  margin-top: 12px;
  box-shadow: none;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h2 {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: 0;
}

.activity-item progress {
  width: 100%;
  height: 10px;
  margin-top: 8px;
  accent-color: var(--accent);
}

.mode-tabs {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(calc(100% - 28px), 532px);
  transform: translateX(-50%);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mode-tab {
  min-height: 54px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
}

.mode-tab.active {
  background: var(--text);
  color: #fff;
}

dialog {
  width: min(calc(100% - 24px), 430px);
  border: 0;
  border-radius: 24px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(8, 13, 11, 0.46);
  backdrop-filter: blur(5px);
}

.share-card,
.text-modal {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 24px;
  padding: 22px 18px 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.share-card {
  justify-items: center;
}

.text-modal {
  padding-top: 58px;
}

.text-modal label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 820;
  text-transform: uppercase;
}

#receivedText {
  min-height: 220px;
}

.close-action {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  min-height: 42px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--text);
}

.qr-box {
  display: grid;
  width: min(72vw, 268px);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  margin-top: 18px;
}

.qr-box canvas,
.qr-box img {
  width: 100% !important;
  height: 100% !important;
}

.code-block {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: center;
}

.code-block span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 820;
  text-transform: uppercase;
}

.code-button {
  min-height: 62px;
  border-radius: 18px;
  background: var(--text);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 2rem;
  letter-spacing: 0.14em;
}

.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  .app {
    padding-top: 24px;
  }

  .drop-zone {
    min-height: 250px;
  }
}

.qr-fallback {
  display: grid;
  width: 268px;
  height: 268px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
