:root {
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --ink: #111827;
  --muted: #687282;
  --line: rgba(17, 24, 39, 0.1);
  --field: rgba(242, 242, 247, 0.88);
  --blue: #007aff;
  --blue-dark: #0065d1;
  --yellow: #ffd84d;
  --green: #34c759;
  --red: #ff3b30;
  --shadow: 0 22px 58px rgba(17, 24, 39, 0.13);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(242, 242, 247, 0.96) 58%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0 1px, transparent 1px 20px);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", "Microsoft YaHei", sans-serif;
  text-rendering: geometricPrecision;
}

button,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.app-shell {
  width: min(560px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 38px 0;
}

.tool-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.glass-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(24px) saturate(1.22);
  -webkit-backdrop-filter: blur(24px) saturate(1.22);
}

.input-panel {
  padding: 30px;
}

.title-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 30px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 12px 26px rgba(255, 184, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.brand-mark img {
  width: 52px;
  height: 52px;
  display: block;
}

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

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0;
}

.link-form {
  display: grid;
  gap: 18px;
}

.field-group {
  display: grid;
  gap: 10px;
}

label {
  color: #263241;
  font-size: 15px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 188px;
  resize: vertical;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--field);
  outline: none;
  line-height: 1.56;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

textarea::placeholder {
  color: #8a93a2;
}

textarea:focus {
  border-color: rgba(0, 122, 255, 0.6);
  background: var(--surface-strong);
  box-shadow:
    0 0 0 4px rgba(0, 122, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

textarea:disabled {
  color: #7a8491;
}

.action-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.action-row .primary-button {
  width: 100%;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(180deg, #1688ff 0%, var(--blue) 100%);
  border-color: rgba(0, 83, 177, 0.28);
  box-shadow: 0 11px 22px rgba(0, 122, 255, 0.24);
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled) {
  background: linear-gradient(180deg, #218fff 0%, var(--blue-dark) 100%);
  box-shadow: 0 13px 28px rgba(0, 122, 255, 0.3);
}

.secondary-button {
  color: #1f2a37;
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.secondary-button:hover:not(:disabled),
.secondary-button:focus-visible:not(:disabled) {
  border-color: rgba(0, 122, 255, 0.32);
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.94);
}

.quiet-button {
  color: var(--muted);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.message {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.message[data-type="error"] {
  color: #c52f27;
}

.message[data-type="success"] {
  color: #167a34;
}

@media (prefers-reduced-motion: reduce) {
  .primary-button,
  .secondary-button,
  textarea {
    transition: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 560px);
    align-items: start;
    padding: 18px 0;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }

  .input-panel {
    padding: 20px;
  }

  .title-row {
    margin-bottom: 24px;
  }

  h1 {
    font-size: 32px;
  }
}

@media (max-width: 440px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding: 12px 0;
  }

  .input-panel {
    padding: 16px;
  }

  .title-row {
    gap: 12px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .brand-mark img {
    width: 46px;
    height: 46px;
  }

  h1 {
    font-size: 29px;
  }

  textarea {
    min-height: 172px;
  }

  .primary-button {
    padding: 0 16px;
  }
}
