:root {
  color-scheme: light;
  --bg: #eef4ff;
  --surface: #ffffff;
  --surface-soft: #f7f9fe;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero-card,
.panel,
.summary-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 32px;
  border-radius: 32px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -60px;
  top: -80px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.95;
}

h2 {
  font-size: 24px;
}

.hero-text {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.hero-badge {
  position: relative;
  z-index: 1;
  min-width: 220px;
  padding: 24px;
  border-radius: 24px;
  background: #111827;
  color: #ffffff;
}

.hero-badge span,
.hero-badge strong {
  display: block;
}

.hero-badge span {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-badge strong {
  margin-top: 8px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.summary-card {
  padding: 22px;
  border-radius: 24px;
}

.summary-card span,
.summary-card strong {
  display: block;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  margin-top: 10px;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.05em;
}

.accent-green strong {
  color: var(--green);
}

.accent-red strong {
  color: var(--red);
}

.accent-blue strong {
  color: var(--blue);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 0.84fr 1.16fr;
  gap: 18px;
}

.panel {
  border-radius: 28px;
  padding: 24px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.form-panel {
  align-self: start;
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field-group span {
  color: #374151;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 14px 15px;
  outline: none;
  transition: 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #ffffff;
}

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

.calculation-preview {
  margin: 4px 0 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--blue-soft);
  color: #1e3a8a;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 16px;
  font-weight: 900;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  width: 100%;
  padding: 15px 18px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.secondary-button,
.ghost-button,
.danger-button {
  padding: 12px 14px;
}

.secondary-button {
  background: #111827;
  color: #ffffff;
}

.ghost-button {
  background: var(--surface-soft);
  color: var(--blue);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
}

.ugc-card {
  border-radius: 28px;
  padding: 26px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.96), rgba(17, 24, 39, 0.98)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent 20rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ugc-topline,
.ugc-stats,
.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ugc-topline span,
.ugc-topline strong,
.ugc-balance span,
.ugc-balance small,
.ugc-stats span {
  color: rgba(255, 255, 255, 0.76);
}

.ugc-topline strong {
  color: #ffffff;
}

.ugc-balance {
  margin: 28px 0;
}

.ugc-balance span,
.ugc-balance strong,
.ugc-balance small {
  display: block;
}

.ugc-balance strong {
  margin-top: 8px;
  font-size: clamp(48px, 8vw, 76px);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.ugc-balance small {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 800;
}

.ugc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 20px;
}

.ugc-stats div {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.ugc-stats span,
.ugc-stats strong {
  display: block;
}

.ugc-stats strong {
  margin-top: 6px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.timeline-item strong {
  font-size: 14px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  min-width: 62px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.result-win {
  background: var(--green-soft);
  color: #166534;
}

.result-lose {
  background: var(--red-soft);
  color: #991b1b;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.table-panel {
  margin-top: 18px;
}

.chart-panel {
  margin-top: 18px;
}

.main-balance-panel {
  margin-top: 18px;
}

.main-balance-current {
  padding: 14px 16px;
  border-radius: 18px;
  background: #111827;
  color: #ffffff;
  text-align: right;
}

.main-balance-current span,
.main-balance-current strong {
  display: block;
}

.main-balance-current span {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}

.main-balance-current strong {
  margin-top: 4px;
  font-size: 26px;
  letter-spacing: -0.05em;
}

.main-balance-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}

.main-balance-form .field-group {
  margin-bottom: 0;
}

.line-chart {
  min-height: 320px;
  padding: 18px;
  border-radius: 22px;
  background:
    linear-gradient(to bottom, rgba(148, 163, 184, 0.18) 1px, transparent 1px) 0 0 / 100% 25%,
    var(--surface-soft);
  overflow-x: auto;
}

.line-chart svg {
  display: block;
  width: 100%;
  min-width: 780px;
  height: auto;
}

.line-chart-path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-point {
  fill: #ffffff;
  stroke: var(--blue);
  stroke-width: 5;
}

.line-value {
  fill: #111827;
  font-size: 20px;
  font-weight: 900;
}

.line-label {
  fill: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.table-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0 10px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

th,
td {
  padding: 10px 12px;
}

tbody tr {
  background: var(--surface-soft);
}

tbody tr.row-lose {
  background: rgba(254, 226, 226, 0.42);
  color: #991b1b;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22);
}

tbody tr.row-lose td {
  border-top: 1px solid rgba(248, 113, 113, 0.45);
  border-bottom: 1px solid rgba(248, 113, 113, 0.45);
}

tbody tr.row-lose td:first-child {
  border-left: 1px solid rgba(248, 113, 113, 0.45);
}

tbody tr.row-lose td:last-child {
  border-right: 1px solid rgba(248, 113, 113, 0.45);
}

.focus-heading {
  color: #111827;
}

.focus-cell {
  background: rgba(37, 99, 235, 0.08);
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.status-cell {
  color: var(--red);
}

.end-balance-cell {
  color: var(--blue);
}

tbody td:first-child {
  border-radius: 16px 0 0 16px;
  font-weight: 900;
}

tbody td:last-child {
  border-radius: 0 16px 16px 0;
}

@media (max-width: 920px) {
  .hero-card,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    display: grid;
  }

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

  .workspace-grid {
    display: grid;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .hero-card,
  .panel {
    border-radius: 22px;
    padding: 20px;
  }

  .summary-grid,
  .two-columns,
  .main-balance-form,
  .ugc-stats {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
  }

  .table-hint {
    text-align: left;
  }
}
