:root{
	--bg:#EEEDF2;
	--panel:#E2E3DE;
	--text:#3F433E;
	--muted:#C2C3B8;
	--key:#ADB0A4;
	--keyHover:#b7b9ae;
	--accent:#C2C3B8;
	--danger:#ff4d6d;
	--border:#D8D9D3;
	--radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
	margin:0;
	font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
	background:var(--bg);
	color:var(--text);
	display:grid;
	place-items:center;
	padding:24px;
    touch-action: manipulation;
    min-width: 320px;
}

.calculator{
	width:min(360px, 100%);
	background:var(--panel);
	border:1px solid var(--border);
    border-radius: 7px 7px 50px 50px;
	padding:30px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    position: relative; /* For absolute positioning of toggle btn */
}

.header{
	display:flex;
	align-items:baseline;
	justify-content:space-between;
	margin-bottom:12px;
    margin-left: 12px;
}

.logo{
    width: auto;
    height: 20px;
}

.display-frame{
    padding: 10px 10px 24px 10px;
    margin-bottom:30px;
    border: 1px solid var(--border);
    border-bottom: 1px solid #e5e5e5;
    border-radius: 5px;
    box-shadow: inset 0 2px 8px rgba(60, 60, 60, 0.18);
}

.display {
    padding: 8px 30px 8px 30px;
    background-color: #C4C8C7;
    border-radius: 5px;
    height:65px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-shadow: inset 0 2px 8px rgba(60, 60, 60, 0.308);
}

.display-screen {
    border-radius: 10px;
    width: 100%;
    height: 50px;
    padding:10px 20px;
    background:#C7CCC6;
    display:flex;
    flex-direction:column;
    justify-content: center;
    gap:6px;
    box-shadow: inset 0 2px 8px rgba(60, 60, 60, 0.308);
}

.result{
	font-family:"DSEG7-Classic", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
	font-size:25px;
	font-weight:800;
	letter-spacing:.06em;
	text-align:right;
	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
	font-variant-ligatures:none;
}

.settings{
    display: flex;
    justify-content: space-between;
    margin-bottom: 35px;
}

.power-buttons{
    margin-left: 15px;
    display: flex;
    gap: 40px;
}

.column{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.subtext{
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.subtext_on{
    background-color: var(--muted);
}

.subtext_off{
    border: 2px solid var(--muted);
}

.small-btn {
    border: 1px solid var(--border);
    background: var(--key);
    color: var(--text);
    border-radius: var(--radius);
    padding: 10px 10px;
    width: 10px;
    height: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.on {
    background-color: #44744C;
}

.off {
    background-color: #DD594D;
}

.keys{
	display:grid;
	grid-template-columns:repeat(5, 1fr);
	gap:12px;
    width: auto;
    margin-bottom: 20px;
}

button.key{
    display: flex;
    align-items: center;
    justify-content: center;
    appearance:none;
    border:1px solid var(--border);
    background:var(--key);
    color:var(--text);
    border-radius: 50px;
    width: 50px;
    height: 50px;
    padding:14px 10px;
    font-size:20px;
    font-weight:400;
    cursor:pointer;
    transition:transform .06s ease, background .12s ease, border-color .12s ease;
    user-select:none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    white-space: nowrap;
}

button.key:hover{background:var(--keyHover)}
button.key:active{transform:translateY(1px)}
button.key:focus-visible{outline:2px solid var(--accent); outline-offset:2px}

.key.op{color:var(--muted)}
.brown{
	color:#E3E4E1 !important;
    background-color: #5B5247 !important;
}
.key.equals{
	background:#D7B347;
}

.blue{
    background-color: #435349 !important;
    color: #E3E4E1 !important;
}

.key.equals:hover{
    background:#d5b31c;
}

@media (prefers-reduced-motion:reduce){
	button.key{transition:none}
}
.key.span-2 {
	grid-column: span 2;
	width: 100%;
	border-radius: var(--radius);
}

#clear {
    font-size: 16px;
    line-height: 1.2;
}

.rounding-switch {
	display: flex;
	gap: 6px;
	align-items: center;
	user-select: none;
    margin-right: 10px;
}

.rounding-switch .labels {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 40px;
	font-size: 10px;
	color: var(--muted);
	font-weight: 700;
    line-height: 1;
}

.rounding-switch .track {
	width: 20px;
	height: 44px;
	background: #939589;
	border-radius: 99px;
	position: relative;
    border: none;
    cursor: pointer;
}

.rounding-switch .thumb {
	width: 20px;
	height: 20px;
	background: #BCBDB8;
	border-radius: 200px;
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	top: 2px; 
	transition: top 0.15s ease-out;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.rounding-switch[data-rounding="F"] .thumb { top: 0px; }
.rounding-switch[data-rounding="0"] .thumb { top: 12px; }
.rounding-switch[data-rounding="2"] .thumb { top: 24px; }

.fullscreen-toggle {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
    padding: 5px;
}

.fullscreen-toggle:hover {
    opacity: 1;
}

body.fullscreen-active {
    padding: 0;
    display: block;
}

body.fullscreen-active .calculator {
    width: 100%;
    min-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: start;
}

body.fullscreen-active .calculator .keys {
    flex: 1;
    align-content: start; /* Center keys vertically */
    justify-content: center;
    width: min-content;
    margin: auto;
}

.info-link {
    position: absolute;
    bottom: 25px;
    right: 30px;
    color: var(--muted);
    opacity: 0.4;
    transition: opacity 0.2s;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.info-link:hover {
    opacity: 0.8;
    color: var(--text);
}

.info-link svg {
    width: 100%;
    height: 100%;
}
body.fullscreen-active .info-link {
    display: none;
}

