*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Geist", sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: all 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --border-primary: #e1e5e9;
  --border-secondary: #d0d7de;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-tertiary: #8b949e;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

.dark {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #171717;
  --border-primary: #30363d;
  --border-secondary: #21262d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.header {
  border-bottom: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-placeholder {
  width: 40px;
  height: 40px;

  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
}

.logo-placeholder svg {
  width: 20px;
  height: 20px;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 400;
}

.breadcrumb {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  padding: 0.75rem 0;
}

.breadcrumb-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.875rem;
}

.breadcrumb-list li {
  display: flex;
  align-items: center;
}

.breadcrumb-list li + li::before {
  content: "›";
  margin: 0 0.5rem;
  color: var(--text-tertiary);
}

.breadcrumb-list a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.breadcrumb-list a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.breadcrumb-list li[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-secondary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-primary);
  transition: var(--transition);
}

.theme-toggle .moon-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(90deg);
}

.dark .theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(-90deg);
}

.dark .theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.main {
  flex: 1;
  padding: 2rem 0;
}

.info-section {
  max-width: 800px;
  margin: 0 auto 2rem auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

.info-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.info-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.calculation-info,
.grade-info {
  margin-bottom: 1.5rem;
}

.calculation-info h3,
.grade-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.calculation-info ul {
  list-style: none;
  padding-left: 0;
}

.calculation-info li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

.calculation-info li:last-child {
  border-bottom: none;
}

.calculation-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.grade-info p {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 0.875rem;
  margin-bottom: 0;
}

.quick-tips {
  margin-bottom: 1.5rem;
}

.quick-tips h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.quick-tips ul {
  list-style: disc;
  padding-left: 1.5rem;
}

.quick-tips li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.faq-section {
  max-width: 800px;
  margin: 2rem auto 0 auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

.faq-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-align: center;
}

.faq-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-primary);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.faq-item p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

.calculator-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
}

.card-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border-primary);
  text-align: center;
}

.card-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.calculator-form {
  padding: 2rem;
}

.form-section {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

.form-section:nth-child(1) {
  animation-delay: 0.1s;
}
.form-section:nth-child(2) {
  animation-delay: 0.2s;
}
.form-section:nth-child(3) {
  animation-delay: 0.3s;
}
.form-section:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.form-label svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.dark .form-input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.input-suffix {
  position: absolute;
  right: 1rem;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  pointer-events: none;
}

.score-preview {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: right;
}

.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.radio-option {
  position: relative;
  cursor: pointer;
  display: block;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-content {
  padding: 1rem;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  transition: var(--transition);
  text-align: center;
}

.radio-option:hover .radio-content {
  border-color: var(--border-secondary);
  background: var(--bg-tertiary);
}

.radio-option input[type="radio"]:checked + .radio-content {
  border-color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.radio-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.radio-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.subjects-container {
  transition: var(--transition);
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.sitting-section {
  margin-bottom: 2rem;
}

.sitting-section h4 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-primary);
}

.subject-select {
  position: relative;
}

.select-trigger {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  outline: none;
}

.select-trigger:hover {
  border-color: var(--border-secondary);
  background: var(--bg-tertiary);
}

.select-trigger:focus,
.subject-select.open .select-trigger {
  border-color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.dark .select-trigger:focus,
.dark .subject-select.open .select-trigger {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.select-trigger svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.subject-select.open .select-trigger svg {
  transform: rotate(180deg);
}

.select-value {
  text-align: left;
  flex: 1;
}

.select-value.placeholder {
  color: var(--text-tertiary);
}

.select-content {
  position: fixed;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  max-height: 200px;
  overflow-y: auto;
  min-width: 200px;
  width: 100%;
  margin-top: 5px;
}

.subject-select.open .select-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.select-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-primary);
  white-space: nowrap;
}

.select-item:last-child {
  border-bottom: none;
}

.select-item:hover {
  background: var(--bg-secondary);
}

.calculate-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  outline: none;
  margin-bottom: 80px;
}

.calculate-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.calculate-btn:active {
  transform: translateY(0);
}

.calculate-btn svg {
  width: 18px;
  height: 18px;
}

.results-section {
  padding: 2rem 1rem;
  border-top: 1px solid var(--border-primary);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
}

.results-section.show {
  opacity: 1;
  transform: translateY(0);
}

.results-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.results-header svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

.results-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.score-breakdown {
  margin-bottom: 2rem;
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-primary);
}

.score-item:last-child {
  border-bottom: none;
}

.score-item.total {
  margin-top: 1rem;
  padding-top: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.score-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 1rem 0;
}

.score-label {
  color: var(--text-secondary);
}

.score-value {
  color: var(--text-primary);
  font-weight: 500;
}

.score-item.total .score-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-secondary);
}

.btn-primary svg,
.btn-secondary svg {
  width: 16px;
  height: 16px;
}

.footer {
  border-top: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-info {
  margin-bottom: 2rem;
}

.footer-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.footer-info p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer-links ul {
  list-style: none;
  padding-left: 0;
}

.footer-links li a {
  padding: 0.25rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-keywords {
  margin-bottom: 1rem;
}

.footer-keywords p {
  margin: 0;
  color: var(--text-tertiary);
  font-style: italic;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-primary);
  padding-top: 1rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--text-primary);
}

.footer-link svg {
  width: 16px;
  height: 16px;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }

  .header-content {
    padding: 0.75rem 0;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .main {
    padding: 1rem 0;
  }

  .calculator-form,
  .card-header {
    padding: 1.5rem;
  }

  .radio-group {
    grid-template-columns: 1fr;
  }

  .subjects-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .results-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .info-section,
  .faq-section {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }

  .info-content h2,
  .faq-content h2 {
    font-size: 1.25rem;
  }

  .calculation-info h3,
  .grade-info h3,
  .quick-tips h3,
  .faq-item h3 {
    font-size: 1rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .breadcrumb-list {
    font-size: 0.8rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .calculator-form,
  .card-header {
    padding: 1rem;
  }

  .form-section {
    margin-bottom: 1.5rem;
  }

  .card-header h2 {
    font-size: 1.5rem;
  }

  .results-card {
    padding: 1.5rem;
  }
}
