/* Variablen */
:root{
	--strFontFace:       Arial,sans-serif;
	--strFontSize:       12pt;
	--strTextColor:      #000000;
	--strTitleColor:     #000000;

	--strFuncLightColor: #999999;
	--strFuncShadeColor: #7f7f7f;
	--strLinkColor:      #000000;
	--strVLinkColor:     #000000;
	
	--strNavBarColor:    #FFFFFF;
	--strNavLightColor:  #ffffff;
	--strNavShadeColor:  #7f7f7f;
	--strNavTextColor:   #000000;
	
	--strPageBGColor:    #FFFFFF;
	--strExBGColor:      #FFFFFF;
	--strExBGColor2:	 #333333;
}
/* Seite allgemein */
	body {
		font-family: var(--strFontFace);
		background-color: rgb(255, 255, 255);
		justify-content: center;
		align-items: center;
		flex-direction: column;
		}
		
	a:link {
		color: var(--strLinkColor);
		}
		
	a:visited {
		color: var(--strLinkColor);
		}
	
	a:hover {
		color: #f00;
		}
		
	.FuncButton2:active {
		box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
		background-color: var(--strExBGColor2);
	}

	.FuncButton2:hover{
		color: var(--strExBGColor);
		background-color: var(--strExBGColor2);
	}
	
	  #custom-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
    gap: 10px;
	}
	
	.footer {
		display: block;
		position: fixed;
		bottom: 0;
		text-align: center;
		margin-left: 4px;
		font-size: 12px;
		background-color: white;
		left: 0;
		right: 0;
	}
	
/* Umschalt-Button über jedem Bruch */
.switch-mode {
  margin-bottom: 10px;
  width: 38px;
  height: 38px;
  background: #fff;
  color: #666;
  border-radius: 50%;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.switch-mode:hover {
  background: #fff;
  transform: scale(1.5);
  color: #ff8800;
}
		
/* === Hauptkreis (Operator-Auswahl) === */
.circle {
  position: relative;
  margin-top: 52px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px dotted #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #333;
  cursor: pointer;
  transition: all 0.4s ease;
  box-shadow: 2px 2px 2px 2px #ddd;
  flex-shrink: 0; /* bleibt gleich groß, auch bei vielen Elementen */
}

.circle:hover {
  background: #fff0f0;
  transform: scale(1.05);
}

/* === Blüten-Kreise korrekt um jeden Hauptkreis === */
.circle-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Container für die 8 kleinen Operator-Kreise */
.circle-options {
  position: absolute;
  margin-top: -28px;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 999;
}

/* Kleine Kreise im Kreis angeordnet */
.circle-options .circle {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  position: absolute;
  top: 40%;
  left: 40%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  transition: all 0.35s ease;
  pointer-events: auto;


}

/* Kreise sichtbar machen beim Öffnen */
.circle-options.open .circle {
  opacity: 1;
}

/* Richtige Kreisverteilung — keine Bewegung in die Mitte */
.circle-options.open .circle:nth-child(1) { transform: rotate(0deg) translate(50px) rotate(0deg); }
.circle-options.open .circle:nth-child(2) { transform: rotate(45deg) translate(60px) rotate(-45deg); }
.circle-options.open .circle:nth-child(3) { transform: rotate(90deg) translate(60px) rotate(-90deg); }
.circle-options.open .circle:nth-child(4) { transform: rotate(135deg) translate(60px) rotate(-135deg); }
.circle-options.open .circle:nth-child(5) { transform: rotate(180deg) translate(60px) rotate(-180deg); }
.circle-options.open .circle:nth-child(6) { transform: rotate(225deg) translate(60px) rotate(-225deg); }
.circle-options.open .circle:nth-child(7) { transform: rotate(270deg) translate(60px) rotate(-270deg); }
.circle-options.open .circle:nth-child(8) { transform: rotate(315deg) translate(60px) rotate(-315deg); }


/* === Canvas für Brüche === */
.visual {
  margin-top: 0.3rem;
  border: 1px dotted #ccc;
  border-radius: 6px;
  background-color: #fafafa;
  display: block;
}

/* === Eingabefelder ohne Pfeile === */
.fraction input[type=number]::-webkit-inner-spin-button,
.fraction input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fraction input[type=number] {
  -moz-appearance: textfield;
}

.mixed-part span {
  line-height: 1.1;
}

/* === Bruch-Eingabefelder === */
.fraction input[type="number"] {
  width: 38px;             /* feste, schmale Breite */
  text-align: center;
  border: 0.5px dotted #eee;
  border-radius: 4px;
  font-size: 1rem;
  padding: 2px 0;
  margin: 0;
}


/* Brüche selbst */
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;


}

.fraction .numerator {
  border-bottom: 1px solid #000;
  padding: 0 0.15rem;
}

.fraction .denominator {
  padding: 0 0.15rem;
}

.expression-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

/* gesamte Ergebnis-Zeile: verhindern, dass Teile umbrechen */
.expression-top,
.expression-bottom,
.expr-block {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;    /* verhindert, dass ganze Zahl/Bruch umbricht */
}

/* einzelne Ausdrucksblöcke (z.B. "1 2/3" oder "1/2 + 1/3") */
.expr-block {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}


.expression-bottom {
  margin-top: 0.25rem;
  font-weight: 600;
}

.simplified-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: #ccc; /* Lösung der Aufgabe */
}

.cmp-op.ok {
  color: #008000;
}

.cmp-op.wrong {
  color: #b00000;
}


/* === Zentrierter Aufbau für Brüche & Operatoren (Feinschliff) === */
#fraction-container {
  display: flex;
  align-items: top;
  gap: 12px;
  padding: 20px;
  height: auto;
  display: flex;
  justify-content: center;    /* Gesamtbild zentriert */
  flex-wrap: nowrap;
  vertical-align: top;

}



/* Operatoren (+, -, =) */
.operator {
  font-size: 2rem;
  line-height: 1;
  text-align: center;
  margin: 0 0.2rem;
}

/* Mülleimer-Kreis in der Mitte des Operators */
.delete-circle {
  position: absolute;
  margin-top: 0px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #d33;
  color: #d33;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 6;
  transition: all 0.25s ease;
}

.delete-circle:hover {
  background: #d33;
  color: #fff;
  transform: translate(-50%, -50%) scale(1.1);
}


/* Entferne Pfeile bei number inputs (global) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: textfield;
}

/* Einheitliches Styling für number inputs (wie bei Bruch) */
input[type="number"].numerator,
input[type="number"].denominator,
input[type="number"].whole {
  width: 38px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  padding: 2px 0;
  margin: 0;
  background: #fff;
  box-sizing: border-box;
}
input[type="number"].whole {
  font-size: 1.5rem;
}

::placeholder {
  color: #eee;
}

/* === Container / Wrapper: Einheit (whole + fraction) zentriert über Canvas === */
.fraction-column {
  display: flex;
  flex-direction: column;
  align-items: center;    /* Spalte zentriert, damit die Einheit mittig über dem Canvas steht */
  justify-content: flex-start;
  text-align: center;
}

.fraction-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;    /* WICHTIG: ganze Einheit (mixed-fraction) wird zentriert */
  width: auto;
  
}
/* === Einheitliche Höhe der Eingabefelder für ganze Zahlen === */



/* === GEMISCHTE SCHREIBWEISE: Ganze Zahl vertikal mittig neben Bruch === */
.mixed-fraction {
  display: flex;
  align-items: center;       /* ganze Zahl mittig zwischen Zähler und Nenner */
  justify-content: center;   /* Einheit bleibt zentriert über dem Canvas */
  gap: 0.4rem;
  position: relative;
}

/* Der Bruch selbst bleibt kompakt */
.mixed-fraction .fraction {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* Zähler und Nenner gleichmäßig um die Mitte */
  line-height: 1.1;
  }

/* === Einheitliche Höhe & Breite für ganze Zahlen === */

/* Ganze Zahl in gemischter Schreibweise */
.mixed-fraction .whole {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;              /* harmonisch zum Bruch */
  width: 48px;               /* angleichen an denominator/numerator-Breite */
  line-height: normal;
  font-size: 1.1rem;
  border: 1px solid #aaa;
  border-radius: 6px;
  text-align: center;
  box-sizing: border-box;
}

/* Ganze Zahl-Ansicht */
.whole-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Ganze Zahl Canvas bündig und gleich groß wie Bruch */
.whole-number .visual.whole-extra-canvas {
  display: block;
  margin-top: 1rem;
  width: 120px;
  height: 60px;
  box-sizing: border-box;
  vertical-align: middle;
}

/* Ganze Zahl Input */
.whole-number .whole {
  height: 56px;
  width: 48px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #aaa;
  border-radius: 6px;
  text-align: center;
  line-height: normal;
  box-sizing: border-box;
}





/* --- Einheitliche vertikale Abstände bei ganzen Zahlen --- */

/* Label "2×", "3×" näher an unteren Canvas rücken */
.whole-number .whole-extra-label {
  margin-top: 0.4rem;          /* etwas Abstand zum oberen Canvas */
  margin-bottom: 0.3rem;       /* kleinerer Abstand nach unten – gleicht optisch an */
  display: none;
  text-align: center;
}

/* === Einheitlicher vertikaler Abstand zum Canvas für alle Darstellungen === */

/* Normaler Bruch */
.fraction .visual {
  margin-top: 1rem;  /* gleichmäßiger Abstand unter dem Bruch */
}

/* Gemischte Schreibweise – Canvas steht im Wrapper, unter der Einheit */
.fraction-wrapper > .visual {
  margin-top: 1rem;  /* exakt derselbe Abstand wie bei .fraction .visual */
}

/* Ganze Zahl (whole-only) */
.whole-number .visual {
  margin-top: 1rem;  /* ebenfalls identisch, sorgt für gleiches visuelles Raster */
}

/* Feinkorrektur: wenn im mixed-Modus der Canvas direkt unterhalb der Einheit hängt,
   wird alles mittig über der Darstellung ausgerichtet */
.fraction-wrapper[data-type="mixed"] {
  display: flex;
  flex-direction: column;
  align-items: center;   /* Einheit mittig über Canvas */
  justify-content: flex-start;
}


/* === Ergebnisse unter Canvas === */
.check-result {
  font-size: 0.9rem;
  margin-top: 0.3rem;
  text-align: center;
  transition: color 0.3s ease;
}

/* Fehlerhafte Eingaben visuell hervorheben */
.fraction-wrapper.error {
  outline: 2px solid #d33;
  border-radius: 8px;
  padding: 4px;
}

/* === Gemeinsame Ergebniszeile unter Bruchreihe === */
.global-check-result {
  width: 100%;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.2rem;
  color: #333;
}

/* Rahmenfarbe bei falschen oder richtigen Brüchen */
.fraction-wrapper.error {
  outline: 2px solid #d33;
  border-radius: 8px;
  padding: 4px;
}

.fraction-wrapper.correct {
  outline: 2px solid #28a745;
  border-radius: 8px;
  padding: 4px;
}


	.FuncButton {
		text-align: center;
		border-style: solid;
		border-radius: 0.5em;
		padding: 0.5em;
		min-width: 3em;
		border-left-color: var(--strFuncLightColor);
		border-top-color: var(--strFuncLightColor);
		border-right-color: var(--strFuncShadeColor);
		border-bottom-color: var(--strFuncShadeColor);
		color: var(--strTextColor);
		background-color: var(--strExBGColor);
		border-width: 0.5pt;
		cursor: pointer;	
		box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
	}

	.FuncButton:active {
		box-shadow: none;
	}

	.FuncButton:hover{
		color: var(--strExBGColor);
		background-color: var(--strTextColor);
	}
	
		.FuncButton2 {
		display: inline-block;
		border-style: solid;
		border-radius: 0.4em;
		padding: 0.3em;
		min-width: 3em;
		border-left-color: var(--strFuncLightColor);
		border-top-color: var(--strFuncLightColor);
		border-right-color: var(--strFuncShadeColor);
		border-bottom-color: var(--strFuncShadeColor);
		color: var(--strTextColor);
		background-color: #ffffff;
		border-width: 0.5pt;
		cursor: pointer;	
		box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

	}

		
/* Ausdruck (z.B. 1/2 + 1/4 (3/4) = 3/4) */
.expression-result {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  align-items: center;
  font-size: 1.05rem;
}

/* Ergebnis-Darstellung: keine Input-Optik übernehmen */
.expression-block span,
.expression-block .fraction,
.expression-block .mixed-fraction,
.expression-block .simplified-result {
  box-shadow: none;
  border: none;
  background: transparent;
}

/* Falls irgendwo generische input-Styles existieren, sie haben auf spans keine Wirkung.
   Falls du aber versehentlich echte input-Elemente in die Ausgabe übernimmst, kannst du sie
   gezielt neutralisieren: */
.expression-block input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none; /* macht sie nicht interaktiv */
}



.global-check-result {
  width: 100%;
  text-align: center;
  margin-top: 1rem;
  position: relative;
}

.global-check-result .close-result {
  position: absolute;
  top: -0.5rem;
  right: 0.5rem;
  cursor: pointer;
  color: #666;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.global-check-result .close-result:hover {
  color: #c00;
}



/* Bruch / original text */
.fraction-display { color: #222; font-weight: 500; }

/* arithmetic operator (plus/minus etc) */
.arith-op { color: #444; font-size: 1rem; }

/* computed fraction in parentheses */
.computed-fraction { color: #666; font-size: 0.95rem; margin-left: 0.25rem; }

/* comparison operators: green/red */
.cmp-op.ok { color: #00dd46; font-weight: 700; }
.cmp-op.wrong { color: #f00; font-weight: 700; }

/* wrapper error outline */
.fraction-wrapper.error { outline: 2px solid #d33; border-radius: 6px; padding: 4px; }


/* === KORREKTUR: Ergebnisdarstellung für gemischte Brüche === */

/* Im Ergebnis: ganze Zahl und Bruch nebeneinander (keine Umbrüche) */
.expression-block .mixed-fraction {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  vertical-align: middle;
  white-space: nowrap;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Ganze Zahl (whole) im Ergebnis: kein Rahmen, kein Hintergrund */
.expression-block .mixed-fraction .whole {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  font-weight: 600;
  color: #222;
}

/* Bruch in gemischter Darstellung bleibt vertikal korrekt */
.expression-block .mixed-fraction .fraction {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}


/* === Neuer Ergebnis-Container === */
#result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

}

	/* Hauptcontainer mit Schatten und Ãœberschrift */
	.container2 {
		position: relative;
		background-color: #fff;
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        text-align: center;
		min-height: 320px;
		max-height: auto;
		max-width: 95%;              /* ?? volle Breite erlauben */
	    margin: 0 auto;
		min-width: 50%;
		width: max-content;
		
	}
	
	.visual {
  margin-top: 1rem;
  width: 120px;
  height: 60px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fafafa;
  display: block;
}



#btnToggleDigits.active {
	  border-color: #007bff !important;
	  box-shadow: 0 0 5px #007bff;
	}
	
	#btnToggleDigits {
  transition: background-color 0.2s ease;
}
#btnToggleDigits.inactive {
  	  position: relative;
	  border-style: solid;
	  border-width: 0.5pt;
	  border-radius: 0.4em;
	  padding: 0.3em;
	  min-width: 3em;
	  background-color: white;
	  color: var(--strTextColor);
	  cursor: pointer;
	  margin: 10px;
	  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
	  border-color: var(--strFuncShadeColor);
	  background-color: white;
}


#toggle-visuals-btn.active {
  background-color: white;

  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

}
#toggle-visuals-btn.inactive {
  background-color: #fff;

}
.button-bar {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		margin-bottom: 10px;
		gap: 10px;
		margin: 10px;
}



.button-bar button,
.button-bar input[type=range] {
  position: relative;
  border: none;
  border-radius: 0.4em;
  padding: 0.3em;
  min-width: 3em;
  color: #000;
  background-color: #fff;
  border-width: 0.5pt;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  gap: 20px;
}

/* Aktive Buttons hervorheben */
.button-bar button.active {
  border: #007bff;
  box-shadow: 0 0 5px #007bff;
}
