/* 기본 컨테이너 */
.pythagorean-win-calculator {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  background: #f5f5f0;
  border: 2px solid #333;
  font-family: 'Noto Sans KR', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #222;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.15);
  box-sizing: border-box;
  line-height: 1.5;
  overflow: hidden;
}

.pythagorean-win-calculator * {
  box-sizing: border-box;
}

/* 헤더 */
.calculator-header {
  text-align: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 3px double #333;
}

.calculator-header h2 {
  margin: 0 0 6px 0;
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  text-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

/* 스포츠 타입 버튼 */
.sport-type-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.sport-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  background: #fff;
  border: 1px solid #333;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  font-family: inherit;
  min-height: 70px;
}

.sport-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.sport-btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.sport-btn.active {
  background: #e67e22;
  color: #fff;
  border-color: #333;
}

.sport-btn:focus-visible {
  outline: 3px solid #e67e22;
  outline-offset: 2px;
}

.sport-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.sport-exp {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.sport-btn.active .sport-exp {
  color: #fff;
}

/* 메인 그리드 */
.calculator-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.input-section,
.result-section,
.chart-section {
  background: #fff;
  border: 1px solid #333;
  padding: 15px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  min-width: 0;
}

/* 광고 섹션 */
.ad-section {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 15px;
  text-align: center;
  background: #fff;
  border: 1px solid #333;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  overflow: visible;
}

.ad-label {
  display: block;
  font-size: 12px;
  color: #999;
  margin-bottom: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

.ad-section .adsbygoogle {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 90px;
  text-align: center;
  margin: 0 auto;
}

/* 차트 섹션 */
.chart-section {
  grid-column: 1 / -1;
}

/* 섹션 타이틀 */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #333;
  font-size: 17px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
}

.input-section .section-title {
  color: #3498db;
}

.result-section .section-title {
  color: #27ae60;
}

.chart-section .section-title {
  color: #9b59b6;
}

.info-section .section-title {
  color: #e67e22;
}

/* 입력 그룹 */
.input-group {
  margin-bottom: 10px;
}

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  line-height: 1.2;
}

/* 텍스트 입력 */
.text-input {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #333;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: #222;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}

.text-input:focus {
  outline: none;
  background: #fffacd;
  border-color: #e67e22;
}

.text-input.error {
  border-color: #e74c3c;
  background: #ffe6e6;
}

/* 입력 + 버튼 */
.input-with-btn {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-with-btn .text-input {
  flex: 1;
  min-width: 0;
}

/* 리셋 버튼 */
.btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #333;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  font-family: inherit;
  width: 100%;
  margin-top: 10px;
}

.btn-reset:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.btn-reset:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn-reset:focus-visible {
  outline: 3px solid #e67e22;
  outline-offset: 2px;
}

/* 비교 버튼 */
.btn-compare {
  flex-shrink: 0;
  padding: 8px 12px;
  background: #3498db;
  color: #fff;
  border: 1px solid #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
}

.btn-compare:hover {
  background: #2980b9;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn-compare:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.btn-compare:focus-visible {
  outline: 2px solid #e67e22;
  outline-offset: 2px;
}

/* 에러 메시지 */
.error-message {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #e74c3c;
  min-height: 14px;
}

/* 커스텀 지수 그룹 */
.custom-exponent-group {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 100px;
  }
}

/* 결과 아이템 */
.result-item {
  margin-bottom: 10px;
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-item label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  line-height: 1.2;
}

.result-value-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f9f9f9;
  border: 1px solid #333;
}

.result-value {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #222;
  font-family: 'Courier New', monospace;
  word-break: break-all;
  min-width: 0;
}

.comparison-result {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 복사 버튼 */
.btn-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #333;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  font-family: inherit;
}

.btn-copy:hover {
  background: #f0f0f0;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn-copy:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.btn-copy:focus-visible {
  outline: 2px solid #e67e22;
  outline-offset: 2px;
}

/* 차트 컨테이너 */
.chart-container {
  height: 250px;
  margin-bottom: 12px;
  padding: 10px;
  background: #fafafa;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  max-height: 100%;
}

/* 공유 버튼 */
.btn-share {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #333;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
  font-family: inherit;
}

.btn-share:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

.btn-share:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn-share:focus-visible {
  outline: 3px solid #e67e22;
  outline-offset: 2px;
}

/* 정보 섹션 */
.info-section {
  background: #fff;
  border: 1px solid #333;
  padding: 15px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  margin-bottom: 15px;
}

.info-content {
  font-size: 15px;
  line-height: 1.6;
  color: #555;
}

.info-content p {
  margin: 0 0 10px 0;
}

.formula-box {
  background: #f9f9f9;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 10px 0;
}

.formula-text {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  text-align: center;
  margin: 0;
}

.exponent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.exponent-item {
  text-align: center;
  padding: 10px;
  background: #f9f9f9;
  border: 1px solid #ddd;
}

.exponent-item .sport-name {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.exponent-item .exponent-value {
  font-size: 18px;
  font-weight: 700;
  color: #e67e22;
  font-family: 'Courier New', monospace;
}

/* 푸터 노트 */
.footer-note {
  margin-top: 15px;
  padding: 15px;
  background: #f0f0f0;
  border: 2px dashed #999;
}

.footer-note p {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.footer-note ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.footer-note li {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
  line-height: 1.5;
}

.footer-note li:last-child {
  margin-bottom: 0;
}

/* 토스트 */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #27ae60;
  color: #fff;
  padding: 12px 20px;
  border: 2px solid #333;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.toast-title {
  font-size: 15px;
  font-weight: 700;
}

.toast-value {
  font-size: 13px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

/* 반응형: 태블릿 */
@media (max-width: 1024px) {
  .calculator-main {
    grid-template-columns: 1fr;
  }
  
  .ad-section,
  .chart-section {
    grid-column: 1;
  }
}

/* 반응형: 모바일 */
@media (max-width: 768px) {
  .pythagorean-win-calculator {
    padding: 12px;
  }
  
  .calculator-header h2 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 13px;
  }
  
  .sport-type-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .sport-btn {
    padding: 8px 6px;
    min-height: 65px;
  }
  
  .sport-name {
    font-size: 12px;
  }
  
  .sport-exp {
    font-size: 15px;
  }
  
  .section-title {
    font-size: 16px;
  }
  
  .input-section,
  .result-section,
  .chart-section,
  .ad-section {
    padding: 12px;
  }
  
  .text-input {
    font-size: 16px;
    padding: 10px 8px;
  }
  
  .input-group label {
    font-size: 13px;
  }
  
  .result-value {
    font-size: 15px;
  }
  
  .btn-compare {
    font-size: 13px;
    padding: 10px 10px;
  }
  
  .btn-copy {
    font-size: 12px;
    padding: 6px 8px;
  }
  
  .btn-reset {
    font-size: 14px;
  }
  
  .exponent-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-container {
    height: 200px;
    padding: 8px;
  }
  
  .btn-share {
    font-size: 14px;
  }
  
  .info-content {
    font-size: 14px;
  }
  
  .formula-text {
    font-size: 14px;
  }
  
  .footer-note p {
    font-size: 14px;
  }
  
  .footer-note li {
    font-size: 13px;
  }
  
  .error-message {
    font-size: 12px;
  }
  
  .toast {
    font-size: 14px;
    max-width: calc(100% - 24px);
  }
  
  .toast-title {
    font-size: 14px;
  }
  
  .toast-value {
    font-size: 12px;
    max-width: 250px;
  }
}

/* 반응형: 작은 모바일 */
@media (max-width: 480px) {
  .pythagorean-win-calculator {
    padding: 10px;
  }
  
  .calculator-header {
    margin-bottom: 12px;
  }
  
  .calculator-header h2 {
    font-size: 22px;
  }
  
  .subtitle {
    font-size: 12px;
  }
  
  .sport-type-buttons {
    gap: 6px;
  }
  
  .sport-btn {
    padding: 6px 4px;
    min-height: 60px;
  }
  
  .sport-name {
    font-size: 11px;
  }
  
  .sport-exp {
    font-size: 14px;
  }
  
  .section-title {
    font-size: 15px;
  }
  
  .input-section,
  .result-section,
  .chart-section,
  .ad-section {
    padding: 10px;
  }
  
  .text-input {
    font-size: 16px;
    padding: 9px 7px;
  }
  
  .input-group label {
    font-size: 12px;
  }
  
  .result-item label {
    font-size: 13px;
  }
  
  .result-value {
    font-size: 14px;
  }
  
  .btn-compare {
    font-size: 12px;
    padding: 9px 8px;
  }
  
  .btn-copy {
    font-size: 11px;
    padding: 5px 7px;
  }
  
  .btn-reset {
    font-size: 13px;
    padding: 8px 14px;
  }
  
  .chart-container {
    height: 180px;
    padding: 5px;
  }
  
  .btn-share {
    font-size: 13px;
    padding: 9px 14px;
  }
  
  .info-content {
    font-size: 13px;
  }
  
  .formula-box {
    padding: 10px;
  }
  
  .formula-text {
    font-size: 13px;
  }
  
  .exponent-item .sport-name {
    font-size: 12px;
  }
  
  .exponent-item .exponent-value {
    font-size: 16px;
  }
  
  .footer-note {
    padding: 12px;
  }
  
  .footer-note p {
    font-size: 13px;
  }
  
  .footer-note li {
    font-size: 12px;
  }
  
  .error-message {
    font-size: 11px;
  }
  
  .toast {
    font-size: 13px;
    padding: 10px 16px;
    max-width: calc(100% - 20px);
  }
  
  .toast-title {
    font-size: 13px;
  }
  
  .toast-value {
    font-size: 11px;
    max-width: 200px;
  }
}

/* 추가: 매우 작은 화면 대응 */
@media (max-width: 360px) {
  .pythagorean-win-calculator {
    padding: 8px;
  }
  
  .calculator-header h2 {
    font-size: 20px;
  }
  
  .sport-type-buttons {
    gap: 5px;
  }
  
  .sport-btn {
    padding: 5px 3px;
    min-height: 55px;
  }
  
  .sport-name {
    font-size: 10px;
  }
  
  .sport-exp {
    font-size: 13px;
  }
  
  .input-section,
  .result-section,
  .chart-section,
  .ad-section {
    padding: 8px;
  }
  
  .text-input {
    font-size: 16px;
    padding: 8px 6px;
  }
  
  .btn-compare {
    font-size: 11px;
    padding: 8px 6px;
  }
  
  .input-with-btn {
    gap: 4px;
  }
  
  .result-value-box {
    gap: 4px;
    padding: 6px 8px;
  }
  
  .chart-container {
    height: 160px;
  }
  
  .footer-note {
    padding: 10px;
  }
}