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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #222;
  transition: background 0.3s, color 0.3s;
}

.top-nav {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-nav::-webkit-scrollbar { display: none; }
.nav-brand {
  font-weight: 800;
  font-size: 15px;
  color: #111;
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}
.nav-links {
  display: inline-flex;
  gap: 6px;
}
.nav-link {
  padding: 6px 12px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.nav-link:hover { background: rgba(0,0,0,0.05); color: #222; }
.nav-link.active {
  background: #111;
  color: white;
  font-weight: 600;
}

.main-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: calc(100vh - 56px);
}

.container {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  position: relative;
  transition: background 0.3s;
}
.container.wide { max-width: 560px; }

.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  margin: 0;
  width: auto;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.theme-toggle:hover { background: #e5e5e5; color: #222; }

h1 {
  font-size: 26px;
  text-align: center;
  letter-spacing: -0.5px;
}
.subtitle {
  text-align: center;
  color: #888;
  margin: 8px 0 32px;
  font-size: 14px;
}

.input-group { margin-bottom: 14px; }
.input-group label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}
.input-group input,
.input-group select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.15s;
}
.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: #111;
  background: white;
}
.input-group .hint {
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}
.time-row { display: flex; gap: 10px; }
.time-row .input-group { flex: 1; }

button {
  width: 100%;
  padding: 15px;
  background: #111;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  margin-top: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.1s, background 0.15s;
}
button:hover { background: #333; }
button:active { transform: scale(0.98); }

.display { display: none; text-align: center; }
.display.active { display: block; }
.status {
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
}

.grade-chip {
  display: inline-block;
  background: linear-gradient(135deg, #fff3cc 0%, #ffd966 100%);
  color: #8a5a00;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(255, 181, 70, 0.3);
  cursor: help;
  user-select: none;
  transition: transform 0.1s;
}
.grade-chip:hover { transform: scale(1.04); }
.grade-chip:active { transform: scale(0.96); }
.grade-chip::after {
  content: ' ⓘ';
  opacity: 0.6;
  font-size: 10px;
  margin-left: 1px;
}

.earnings-wrap { position: relative; }
.float-amount {
  position: absolute;
  left: 50%;
  top: 30%;
  color: #0a7d3e;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  animation: floatUp 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  white-space: nowrap;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 20px) scale(0.8); }
  15%  { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  30%  { transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(0.95); }
}

.earnings {
  font-size: 52px;
  font-weight: 800;
  color: #0a7d3e;
  margin: 8px 0 4px;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.earnings .decimal {
  font-size: 28px;
  color: #0a7d3e;
  opacity: 0.55;
  font-weight: 700;
}
.earnings-sub {
  color: #aaa;
  font-size: 13px;
  margin-bottom: 12px;
}

.buypower {
  display: inline-block;
  background: #eef4ff;
  color: #2060d0;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}
.buypower:hover { background: #dce8ff; }
.buypower:active { transform: scale(0.96); }
.buypower::after {
  content: ' ↻';
  opacity: 0.5;
  font-size: 11px;
  margin-left: 2px;
}

.progress-wrap { margin: 24px 0 8px; }
.progress-bar {
  width: 100%;
  height: 14px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0a7d3e 0%, #36c97a 50%, #f2c14e 85%, #e55934 100%);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.4s linear;
  box-shadow: 0 0 8px rgba(10, 125, 62, 0.3);
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #888;
  font-variant-numeric: tabular-nums;
}
.progress-labels .percent { font-weight: 700; color: #333; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.stat {
  background: #f7f7f7;
  padding: 16px 12px;
  border-radius: 14px;
}
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.share-row { display: flex; gap: 8px; margin-top: 24px; }
.share-btn {
  flex: 1;
  padding: 13px;
  background: #fff;
  color: #222;
  border: 1.5px solid #e5e5e5;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin: 0;
  transition: all 0.15s;
}
.share-btn:hover { background: #f7f7f7; border-color: #222; }
.share-btn.primary {
  background: #FEE500;
  border-color: #FEE500;
  color: #191919;
}
.share-btn.primary:hover { background: #FDD835; border-color: #FDD835; }

.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111;
  color: white;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.reset-btn {
  background: none;
  color: #999;
  font-size: 13px;
  padding: 10px;
  margin-top: 16px;
  font-weight: 500;
}
.reset-btn:hover { background: #f5f5f5; color: #333; }

.result-box {
  background: #f7f9fc;
  border-radius: 16px;
  padding: 24px;
  margin-top: 20px;
}
.result-highlight {
  text-align: center;
  padding: 8px 0 20px;
  border-bottom: 1px solid #e8edf5;
  margin-bottom: 16px;
}
.result-label-top {
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
}
.result-amount {
  font-size: 36px;
  font-weight: 800;
  color: #0a7d3e;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.result-amount-sub {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}
.result-row + .result-row { border-top: 1px dashed #e8edf5; }
.result-row .label { color: #666; }
.result-row .value {
  font-weight: 700;
  color: #222;
  font-variant-numeric: tabular-nums;
}
.result-row.minus .value { color: #c94444; }
.result-row.total {
  border-top: 2px solid #d8dfec !important;
  margin-top: 8px;
  padding-top: 14px;
  font-size: 15px;
}
.result-row.total .value {
  font-size: 18px;
  color: #0a7d3e;
  font-weight: 800;
}
.disclaimer {
  font-size: 11px;
  color: #aaa;
  text-align: center;
  margin-top: 20px;
  line-height: 1.5;
}

.housing-card {
  background: linear-gradient(135deg, #fef5f2 0%, #ffe8e0 100%);
  border: 1px dashed #f0c4b5;
  border-radius: 16px;
  padding: 18px 18px;
  margin-top: 16px;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.2s;
  position: relative;
}
.housing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(201, 68, 68, 0.12);
}
.housing-card:active { transform: scale(0.99); }
.housing-card::after {
  content: '↻';
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 13px;
  color: #c94444;
  opacity: 0.4;
}
.housing-label {
  font-size: 10px;
  color: #c94444;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}
.housing-target {
  font-size: 14px;
  color: #333;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}
.housing-target .price {
  color: #c94444;
  font-weight: 700;
  font-size: 13px;
}
.housing-time {
  font-size: 14px;
  color: #555;
  line-height: 1.4;
}
.housing-time b {
  font-size: 22px;
  color: #222;
  letter-spacing: -0.3px;
  font-weight: 800;
}
.housing-sub {
  font-size: 11px;
  color: #999;
  margin-top: 8px;
}

body.dark .housing-card {
  background: linear-gradient(135deg, #3a2420 0%, #2d1d1a 100%);
  border-color: #6a3a28;
}
body.dark .housing-card::after { color: #ff8a8a; }
body.dark .housing-label { color: #ff8a8a; }
body.dark .housing-target { color: #e5e5e5; }
body.dark .housing-target .price { color: #ff8a8a; }
body.dark .housing-time { color: #aaa; }
body.dark .housing-time b { color: #f5f5f5; }
body.dark .housing-sub { color: #666; }

.site-footer {
  padding: 32px 20px 40px;
  text-align: center;
  font-size: 12px;
  color: #888;
  border-top: 1px solid rgba(0,0,0,0.05);
}
.site-footer a {
  color: #888;
  text-decoration: none;
  margin: 0 10px;
  display: inline-block;
  padding: 4px 0;
}
.site-footer a:hover { color: #222; text-decoration: underline; }
.site-footer .copyright {
  margin-top: 12px;
  font-size: 11px;
  color: #aaa;
}

.content-page h2 {
  font-size: 17px;
  margin: 24px 0 10px;
  letter-spacing: -0.3px;
}
.content-page h2:first-of-type { margin-top: 0; }
.content-page p, .content-page li {
  font-size: 14px;
  line-height: 1.7;
  color: #444;
}
.content-page ul {
  padding-left: 20px;
  margin: 10px 0;
}
.content-page ul li { margin-bottom: 4px; }
.content-page strong { color: #222; }
.content-page a { color: #2060d0; text-decoration: none; }
.content-page a:hover { text-decoration: underline; }
.content-page .updated {
  font-size: 12px;
  color: #aaa;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed #e8edf5;
}
body.dark .content-page p,
body.dark .content-page li { color: #ccc; }
body.dark .content-page strong { color: #fff; }
body.dark .content-page a { color: #6ba0ff; }
body.dark .content-page .updated { color: #666; border-top-color: #2d3348; }
body.dark .site-footer { border-top-color: rgba(255,255,255,0.05); color: #666; }
body.dark .site-footer a { color: #888; }
body.dark .site-footer a:hover { color: #e5e5e5; }
body.dark .site-footer .copyright { color: #555; }

body.dark {
  background: linear-gradient(135deg, #1a1d2e 0%, #2d3348 100%);
  color: #e5e5e5;
}
body.dark .top-nav {
  background: rgba(26, 29, 46, 0.85);
  border-bottom-color: rgba(255,255,255,0.06);
}
body.dark .nav-brand { color: #f5f5f5; }
body.dark .nav-link { color: #888; }
body.dark .nav-link:hover { background: rgba(255,255,255,0.05); color: #e5e5e5; }
body.dark .nav-link.active { background: #e5e5e5; color: #111; }
body.dark .container { background: #232838; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
body.dark h1 { color: #f5f5f5; }
body.dark .subtitle { color: #888; }
body.dark .input-group label { color: #aaa; }
body.dark .input-group input,
body.dark .input-group select {
  background: #2a2f3f;
  border-color: #3a4058;
  color: #e5e5e5;
}
body.dark .input-group input:focus,
body.dark .input-group select:focus {
  border-color: #6ba0ff;
  background: #1e2433;
}
body.dark .input-group .hint { color: #666; }
body.dark button { background: #3a4058; color: #e5e5e5; }
body.dark button:hover { background: #4a5078; }
body.dark .status { color: #aaa; }
body.dark .earnings { color: #3ecf8e; }
body.dark .earnings .decimal { color: #3ecf8e; }
body.dark .earnings-sub { color: #888; }
body.dark .float-amount { color: #3ecf8e; }
body.dark .grade-chip {
  background: linear-gradient(135deg, #5a4010 0%, #8a6a20 100%);
  color: #ffe680;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
body.dark .buypower { background: #243144; color: #6ba0ff; }
body.dark .buypower:hover { background: #2c3d54; }
body.dark .progress-bar { background: #2a2f3f; }
body.dark .stat { background: #2a2f3f; }
body.dark .stat-label { color: #888; }
body.dark .stat-value { color: #e5e5e5; }
body.dark .share-btn {
  background: #2a2f3f;
  border-color: #3a4058;
  color: #e5e5e5;
}
body.dark .share-btn:hover { background: #343a4d; border-color: #5a6480; }
body.dark .share-btn.primary {
  background: #3a3520;
  border-color: #5a4a20;
  color: #ffd966;
}
body.dark .share-btn.primary:hover { background: #4a4526; border-color: #7a6a30; }
body.dark .progress-labels .percent { color: #e5e5e5; }
body.dark .progress-labels { color: #888; }
body.dark .reset-btn { color: #666; }
body.dark .reset-btn:hover { background: #2a2f3f; color: #aaa; }
body.dark .theme-toggle { background: #2a2f3f; color: #aaa; }
body.dark .theme-toggle:hover { background: #343a4d; color: #e5e5e5; }
body.dark .result-box { background: #1e2433; }
body.dark .result-highlight { border-bottom-color: #2d3348; }
body.dark .result-row + .result-row { border-top-color: #2d3348; }
body.dark .result-row .label { color: #888; }
body.dark .result-row .value { color: #e5e5e5; }
body.dark .result-row.minus .value { color: #ff8a8a; }
body.dark .result-row.total { border-top-color: #3a4058 !important; }
body.dark .result-row.total .value { color: #3ecf8e; }
body.dark .result-amount { color: #3ecf8e; }
body.dark .result-amount-sub { color: #777; }
body.dark .disclaimer { color: #666; }
