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

:root {
  --primary: #e67e22;
  --tint-light: #fdf2e9;
  --tint-medium: #fae5d3;
  --tint-dark: #eb984e;
  --shade-light: #cf711f;
  --shade-dark: #45260a;
  --grey-light: #888;
  --grey-medium: #767676;
  --grey-dark: #6f6f6f;
  --grey-darker: #555;
  --grey-darkest: #333;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, var(--tint-light) 0%, white 100%);
  color: var(--grey-darkest);
  padding: 0;
  min-height: 100vh;
}

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

/* Sticky Header Section */
.sticky-header {
  position: sticky;
  top: 0;
  background: white;
  z-index: 100;
  padding: 20px;
  border-bottom: 3px solid var(--primary);
  backdrop-filter: blur(5px);
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 1.2rem 3.2rem rgba(0, 0, 0, 0.03);
  /* box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); */
}

header {
  padding: 0.75rem 1rem;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 2rem;
  width: auto;
  vertical-align: middle;
  margin-right: 16px;
  display: inline-block;
  padding-left: 14rem;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  padding-left: 14rem;
  margin-bottom: 0.25rem;
}

p {
  font-size: 1rem;
  margin: 0;
  padding-left: 14rem;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--grey-medium);
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* Control Panel */
.control-panel {
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.control-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

select,
button {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

select {
  background: var(--tint-light);
  color: var(--grey-darkest);
  border: 2px solid var(--tint-dark);
  min-width: 250px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e67e22' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

select:hover {
  border-color: var(--primary);
  background-color: var(--tint-medium);
}

select:focus {
  outline: none;
  border-color: var(--shade-light);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

.btn {
  background: var(--primary);
  color: white;
  border: 2px solid var(--primary);
  min-width: 140px;
}

.btn:hover {
  background: var(--shade-light);
  border-color: var(--shade-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

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

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--tint-light);
  border-color: var(--shade-light);
  color: var(--shade-light);
}

.btn-secondary.hidden {
  background: var(--tint-medium);
  color: var(--grey-medium);
}

/* Main Content */
.main-content {
  padding: 20px;
}

/* Activity Display */
.activity-display {
  text-align: center;
  margin: 10px 0;
}

.activity-box {
  background: var(--primary);
  color: white;
  padding: 20px 32px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 4px 16px rgba(230, 126, 34, 0.3);
  max-width: 90%;
  word-wrap: break-word;
}

/* Tree Structure */
.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px;
  margin: 60px 0;
  position: relative;
}

/* Level 1: Hypotheses */
.level-1 {
  display: flex;
  justify-content: center;
  gap: 32px;
  width: 100%;
  position: relative;
  margin-top: 60px;
}

/* Connector from activity to hypotheses */
.level-1::after {
  content: "";
  position: absolute;
  top: -60px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--grey-light);
}

/* Hypothesis Cards */
.hypothesis-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  flex: 1;
  min-width: 220px;
  max-width: 320px;
  position: relative;
}

.hypothesis-branch {
  position: relative;
}

.hypothesis-branch .card {
  position: relative;
}

.hypothesis-branch .card::after {
  content: "";
  position: absolute;
  top: calc(100% + 0px);
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 80px;
  background: var(--grey-light);
}

.test-branch {
  position: relative;
}

.test-branch .card {
  position: relative;
}

.test-branch .card::after {
  content: "";
  position: absolute;
  top: calc(100% + 0px);
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 80px;
  background: var(--grey-light);
}

.card {
  background: white;
  border: 2px solid var(--tint-dark);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--grey-darkest);
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  word-wrap: break-word;
  width: 100%;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
  transform: translateY(-4px);
}

.card.hypothesis {
  background: linear-gradient(
    135deg,
    var(--tint-light) 0%,
    var(--tint-medium) 100%
  );
  border-color: var(--primary);
  font-weight: 600;
  font-size: 15px;
  min-height: 120px;
}

.card.test {
  background: white;
  border-color: var(--tint-dark);
  font-size: 13px;
  min-height: 100px;
}

.card.technique {
  background: var(--tint-light);
  border-color: var(--tint-dark);
  font-size: 13px;
  min-height: 100px;
}

.card.hidden-content {
  background: var(--grey-light);
  color: white;
  border-color: var(--grey-medium);
  cursor: pointer;
  font-size: 12px;
}

/* Remark Display */
.remark {
  font-size: 12px;
  color: var(--grey-medium);
  font-weight: 400;
  margin-top: 8px;
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid var(--grey-light);
}

.remark:empty {
  display: none;
}

/* Level 2: Tests */
.level-2 {
  display: flex;
  justify-content: center;
  gap: 32px;
  width: 100%;
}

.test-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 220px;
  max-width: 320px;
  position: relative;
}

.test-branch::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 80px;
  background: var(--grey-light);
}

/* Level 3: Techniques */
.level-3 {
  display: flex;
  justify-content: center;
  gap: 32px;
  width: 100%;
}

.technique-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}

@media (max-width: 1250px) {
  .logo {
    padding-left: 0;
  }

  h1,
  p {
    padding-left: 0;
  }
}

@media (max-width: 768px) {
  .level-1::after {
    display: none;
  }

  .sticky-header {
    padding: 15px;
  }

  .control-panel {
    flex-direction: column;
    gap: 12px;
    padding: 15px;
  }

  .control-group {
    width: 100%;
    justify-content: center;
  }

  .control-group:first-child {
    width: 100%;
  }

  select {
    width: 100%;
    min-width: 100%;
    font-size: 15px;
    padding: 14px 40px 14px 16px;
  }

  .btn {
    flex: 1;
    min-width: 120px;
    font-size: 13px;
  }

  h1 {
    font-size: 22px;
  }

  .subtitle {
    font-size: 13px;
  }

  .tree-container {
    gap: 60px;
  }

  .level-1 {
    gap: 20px;
    margin-top: 50px;
  }

  .dynamic-connector {
    height: 50px !important;
    top: -50px !important;
  }

  .hypothesis-branch,
  .test-branch,
  .technique-branch {
    min-width: 160px;
    max-width: 240px;
  }

  .card {
    font-size: 12px;
    padding: 12px;
    min-height: 90px;
  }

  .card.hypothesis {
    font-size: 13px;
    min-height: 100px;
  }

  .level-2,
  .level-3 {
    gap: 20px;
  }
}

@media (max-width: 580px) {
  .sticky-header {
    padding: 12px;
  }

  body {
    font-size: 14px;
  }

  .control-panel {
    padding: 0 12px;
    gap: 10px;
  }

  select {
    font-size: 14px;
    padding: 12px 36px 12px 14px;
    background-size: 18px;
    background-position: right 10px center;
  }

  .btn {
    font-size: 12px;
    padding: 10px 12px;
  }

  h1 {
    font-size: 18px;
  }

  .subtitle {
    font-size: 12px;
  }

  .tree-container {
    gap: 50px;
    margin: 40px 0;
  }

  .level-1 {
    gap: 12px;
    margin-top: 40px;
  }

  .dynamic-connector {
    height: 40px !important;
    top: -40px !important;
  }

  .hypothesis-branch,
  .test-branch,
  .technique-branch {
    min-width: 100px;
    max-width: 150px;
  }

  .card {
    font-size: 10px;
    padding: 8px;
    min-height: 80px;
    border-radius: 8px;
  }

  .card.hypothesis {
    font-size: 11px;
    min-height: 85px;
  }

  .card.test,
  .card.technique {
    min-height: 75px;
  }

  .activity-box {
    font-size: 14px;
    padding: 14px 20px;
  }

  .level-2,
  .level-3 {
    gap: 12px;
  }

  .remark {
    font-size: 9px;
  }
}

/* Error State */
.error-message {
  background: #fee;
  border: 2px solid #c33;
  color: #c33;
  padding: 16px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: center;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--grey-medium);
  font-size: 16px;
}
