* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

.page {
  min-height: 100vh;
  padding: 24px 16px 48px;
}

@media (max-width: 640px) {
  .page {
    padding: 12px 12px 24px;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  flex-wrap: wrap;
}

.header-row .title {
  justify-content: flex-start;
}

.header-row .header-actions {
  margin-top: 0;
  margin-left: auto;
  justify-content: flex-end;
}

.title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.title h1 {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(90deg, #2563eb, #6366f1);
  -webkit-background-clip: text;
  color: transparent;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 600;
}

.subtitle {
  margin-top: 10px;
  color: #64748b;
  font-size: 16px;
}

.header-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.user-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 600;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: 1.1fr 1.9fr;
  }
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .header-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .header-row .title {
    justify-content: center;
    width: 100%;
  }
  
  .header-row .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
    gap: 8px;
  }
  
  .title h1 {
    font-size: 28px;
  }
  
  .card {
    padding: 16px;
  }
}

.column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.column.wide {
  gap: 16px;
}

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  color: #334155;
}

.icon {
  font-size: 18px;
}

.upload-area {
  border: 2px dashed #cbd5f5;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  text-align: center;
  background: #f8fafc;
  overflow: hidden;
  min-height: 220px;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #94a3b8;
}

.upload-icon {
  font-size: 28px;
}

.upload-placeholder p {
  font-weight: 600;
  color: #64748b;
}

.upload-placeholder span {
  font-size: 12px;
}

#preview-image {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  max-height: 100%;
  object-fit: contain;
}

.ghost-button {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.field {
  margin-top: 16px;
}

.field label {
  font-size: 13px;
  color: #475569;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.text-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.api-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-input input {
  flex: 1;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.icon-button {
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  height: 36px;
}

.field-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.checkbox {
  font-size: 13px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-button {
  margin-top: 16px;
  width: 100%;
  border: none;
  background: #4f46e5;
  color: #fff;
  font-weight: 700;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.25);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #6366f1;
  font-size: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #c7d2fe;
  border-top-color: #6366f1;
  animation: spin 1s linear infinite;
}

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

@media (max-width: 640px) {
  .title h1 {
    font-size: 28px;
  }
  .page {
    padding: 16px 8px 32px;
  }
}

.analysis {
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
  color: #334155;
  line-height: 1.7;
  font-style: normal;
  padding-right: 6px;
  white-space: pre-wrap;
  background: #f1f5f9;
  padding: 10px;
  border-radius: 12px;
}

.select-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.range-input {
  width: 100%;
}

.analysis::-webkit-scrollbar {
  width: 4px;
}

.analysis::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 999px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #334155;
  margin-bottom: 12px;
}

.title-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.copy-button {
  margin-left: auto;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #4f46e5;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
}

.copy-button.copied {
  color: #16a34a;
  border-color: #86efac;
}

.link-button {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 14px;
  cursor: pointer;
}

.auth-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 26px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-page .page {
  background: linear-gradient(180deg, #e0e7ff 0%, #f8fafc 100%);
}

.auth-page .main {
  align-items: center;
}

.auth-page .auth-card {
  width: 100%;
  max-width: 980px;
  padding: 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.auth-page .card-title h2 {
  font-size: 22px;
}

.auth-page .field label {
  font-size: 14px;
}

.auth-page .text-input {
  padding: 14px 16px;
  font-size: 15px;
}

.auth-page .primary-button {
  padding: 14px;
  font-size: 15px;
}

.auth-page .auth-footer {
  font-size: 13px;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .auth-grid {
    grid-template-columns: 1.05fr 1fr;
  }
}

.auth-aside {
  background: linear-gradient(160deg, #4338ca 0%, #2563eb 100%);
  color: #eef2ff;
  padding: 42px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-aside h2 {
  font-size: 28px;
  font-weight: 800;
}

.auth-aside p {
  color: rgba(238, 242, 255, 0.9);
  font-size: 14px;
  line-height: 1.6;
}

.auth-badge {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 600;
}

.auth-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: rgba(238, 242, 255, 0.9);
}

.auth-list li::before {
  content: \"✔\";
  margin-right: 8px;
  color: #a5f3fc;
}

.auth-form-panel {
  padding: 42px 36px;
  background: #fff;
}

.auth-title {
  margin-bottom: 20px;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-with-action .text-input {
  flex: 1;
}

.input-with-action .ghost-button {
  position: static;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 12px;
  padding: 8px 12px;
}

@media (max-width: 640px) {
  .auth-form-panel {
    padding: 28px 22px;
  }
  .auth-aside {
    padding: 28px 22px;
  }
  .auth-page .auth-card {
    border-radius: 20px;
  }
}

.auth-form .primary-button {
  margin-top: 16px;
}

.auth-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}

.link-icon {
  font-size: 18px;
  margin-right: 4px;
}

.results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .results {
    grid-template-columns: 1fr;
  }
}

.result-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.result-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f1f5f9;
  transition: transform 0.4s ease;
  padding: 12px;
}

.result-card:hover .result-image {
  transform: scale(1.03);
}

.result-body {
  padding: 10px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-body h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
}

.result-body p {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-actions {
  display: flex;
  gap: 6px;
}

.action-button {
  flex: 1;
  border-radius: 10px;
  padding: 6px;
  font-size: 10px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.action-primary {
  background: #4f46e5;
  color: #fff;
}

.action-secondary {
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.action-button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.points-balance {
  font-size: 32px;
  font-weight: 800;
  color: #4f46e5;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.data-table th {
  color: #475569;
  font-weight: 700;
  background: #f8fafc;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.data-table td.positive {
  color: #16a34a;
  font-weight: 700;
}

.data-table td.negative {
  color: #dc2626;
  font-weight: 700;
}

.analysis-preview {
  max-width: 320px;
  white-space: normal;
  color: #475569;
}

.empty-state {
  grid-template-columns: 1fr;
}

.empty-card {
  background: #f1f5f9;
  border: 1px dashed #e2e8f0;
  border-radius: 24px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 20px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  margin-bottom: 12px;
  color: #b91c1c;
}

.alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fecaca;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.alert.success {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.alert.success .alert-icon {
  background: #bbf7d0;
}

.footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 768px) {
  .footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-right {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.icp-record {
  color: #94a3b8;
  font-size: 12px;
  text-decoration: none;
  text-transform: none;
}

.icp-record:hover {
  color: #64748b;
  text-decoration: underline;
}

.hidden {
  display: none !important;
}
